|
http://java.sun.com/javase/6/docs/
http://java.sun.com/javase/7/docs/index.html
Read These.
Regards
|
|
|
|
|
Okay, I have included my code below. I am supposed to have the user input a html file name (i got that part down) and then i'm supposed to look at the file and make two lists of words, one of words that are italicized between <i> </i> and one of words that are bold between <b> </b>. So I need to know how to do this. I think I should use a regular expression? Am I rite? regular expression looking for the <b> and </b> tag and creating anything in between as a string that I add to a string container. then i print the string container as output. is this okay? can you help me with the regular expression?
<pre>package final_project_2;
import java.io.*;
import javax.swing.*;
public class Main {
public static void main(String[] args) {
try{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter the name of the file: ");
String line = input.readLine();
FileInputStream in = null;
in = new FileInputStream(line);
}
catch (IOException e)
{
JOptionPane.showMessageDialog(null, "IOException: " + e.getMessage());
}
}
}</pre>
|
|
|
|
|
import java.io.File;
import java.util.*;
public class RegularExpression
{
public static void main(String[] args) throws Exception
{
Scanner scan = new Scanner(System.in);
System.out.println("Enter HTML file Name:");
File HtmlFile = new File(scan.next());
Scanner scan2 = new Scanner(HtmlFile);
int FirstIndex =0,LastIndex =0;
ArrayList<String> Bold = new ArrayList<String>();
ArrayList<String> Italics = new ArrayList<String>();
while(scan2.hasNext())
{
String q = scan2.nextLine();
for (int i =0; i <q.length(); i++)
{
if (i+3<=q.length())
{
if (q.substring(i, i+3).equalsIgnoreCase("<b>"))
{
FirstIndex = i+3;
for (int j = FirstIndex; j <q.length(); j++)
{
if (j+4<=q.length())
{
if (q.substring(j, j+4).equalsIgnoreCase("</b>"))
{
LastIndex = j;
Bold.add(q.substring(FirstIndex,LastIndex));
break;
}
}
}
}
else
if (q.substring(i, i+3).equalsIgnoreCase("<i>"))
{
for (int j = FirstIndex; j <q.length(); j++)
{
if (j+4<=q.length())
{
if (q.substring(j, j+4).equalsIgnoreCase("</i>"))
{
LastIndex = j;
Italics.add(q.substring(FirstIndex,LastIndex));
break;
}
}
}
}
}
}
}
System.out.println("Bold:");
for (int i =0; i <Bold.size(); i++)
{
System.out.println(Bold.get(i));
}
System.out.println("Italics:");
for (int i =0; i <Bold.size(); i++)
{
System.out.println(Italics.get(i));
}
}
}
|
|
|
|
|
i need Java codings of Vernam Cipher Algorithm.can anybody help me plz.
|
|
|
|
|
Before all the cross-posting, did you even bother to read this or here?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
http://www.dreamincode.net/forums/showtopic32278.htm
Read this
Regards
|
|
|
|
|
Hello all,
i have created an application in java. it basically converts the script of a language from roman urdu to formal urdu script. i want to dock this application to msn messneger so that msn users (urdu speaking) can use this addon to convert there roman urdu into formal urdu script before sending it to the far end. the problem is, i dont know if there is any API for creating plugins for msn (or yahoo) , moreover if here is any i dont know if it will be compatible with java. i appriciate any form of help in this regard
will anyone please answer my question
thank you
regards
adeel
modified on Tuesday, September 1, 2009 3:03 PM
|
|
|
|
|
http://jml.blathersource.org
Try this API
Regards
|
|
|
|
|
Hi all,
thanks a lot for ur help. actually i had come across this library earlier i tried to use it because i could not find any tutorail on JML on their page. now when u referred to this library i decided to give it another try and went through the code. i have examined code in BasicMessenger.java and PrettyMessenger.java. i was able to grasp some of the code segments. when i execute this code with my hotmail id it dumps in lot of unnecessary information on the cosole plus it does not show complete contact list. can u please help me in this regard how to get useful information from my account or refer to any useful document about this library.
moreover i get an impression that this lib will enable me to mimic msn messenger's features in my java application rather than interacting with windows live messenger client that is installed on my machine. am i right in thinking so.
once again thanks a lot for ur considerate attention.
i really really mean it
regards
adeel
|
|
|
|
|
I played around with JML and this is what I did:
1. created a dummy hotmail with user and password.
2. added the dummy to an existing hotmail through windows live messenger and accepted from both sides i.e. I accepted the mutual invitation from my dummy and existing.
3. I logged in to my existing account. I will see dummy offline.
4. Now to Java part.
Code 1: BasicMessenger.java
import net.sf.jml.MsnMessenger;
import net.sf.jml.impl.MsnMessengerFactory;
public class BasicMessenger {
private String email;
private String password;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
protected void initMessenger(MsnMessenger messenger) {
}
public void start() {
MsnMessenger messenger = MsnMessengerFactory.createMsnMessenger(email,
password);
messenger.setLogIncoming(true);
messenger.setLogOutgoing(true);
initMessenger(messenger);
messenger.login();
}
public static void main(String[] args) throws Exception {
BasicMessenger messenger = (BasicMessenger) Class.forName("EchoMessenger")
.newInstance();
messenger.setEmail("dummyhotmail@hotmail.com");
messenger.setPassword("password");
messenger.start();
}
}
I commented the 4 first lines in main and filled in the arg[0 to 3] data as shown above.
Code 2: EchoMessenger.java
import net.sf.jml.MsnContact;
import net.sf.jml.MsnMessenger;
import net.sf.jml.MsnSwitchboard;
import net.sf.jml.event.MsnMessageAdapter;
import net.sf.jml.message.MsnControlMessage;
import net.sf.jml.message.MsnDatacastMessage;
import net.sf.jml.message.MsnInstantMessage;
public class EchoMessenger extends BasicMessenger {
protected void initMessenger(MsnMessenger messenger) {
messenger.addMessageListener(new MsnMessageAdapter() {
public void instantMessageReceived(MsnSwitchboard switchboard,
MsnInstantMessage message, MsnContact contact) {
}
public void controlMessageReceived(MsnSwitchboard switchboard,
MsnControlMessage message, MsnContact contact) {
System.out.println("Type: ");
java.util.Scanner scan = new java.util.Scanner(System.in);
MsnInstantMessage message2 = new MsnInstantMessage();
message2.setContent(scan.nextLine());
switchboard.sendMessage(message2);
}
public void datacastMessageReceived(MsnSwitchboard switchboard,
MsnDatacastMessage message, MsnContact contact) {
switchboard.sendMessage(message);
}
});
}
}
I simply modified method 2 to be able to send a message I type.
For your first post:
1. you need to use the code here to give it a nice Gui
2. embed your language correction.
For your second post:
1. It communicates with MSN Messenger as a sender only for example when you send nudge or so.
2. For the contacts it does get me all the contacts. Here you need to use the information of who is online and offline to create a list, then specify to whom you want to chat with.
As I was reading about this library to make a fully functional MSN takes time thats what the MSN2Go developer stated on his website. (his/her work is great check it out if you want)
Hope this helps.
|
|
|
|
|
Hello all,
Dear sir, i worked around ur instructions and happy to tell that i have created a messenger that allows msn users to login and chat through the chat window that i designed for it with enhanced capability of writing messages in urdu. now i have one little problem, whenever this messenger disconnects from the server due to packet drops or congestion i am helpless. i dont find any method or any listener that listens to this. i am sure you would have something about it
very thankful for ur kind consideration
actually this problem has been solved by public void logout method of MsnMessngerListener but an other problem that teases me a lot is when i try to add a contact by calling addFriend(Email arg0, String arg1) of class MsnMessenger most of the times it expires the session and logs out. plz help me solving this problem
plus there is one more problem that is hindering me is that i find no way to enter proxy information in this messenger in case i m sitting on a system behind a proxy server
thanx a lot
regards
Adeel
modified on Monday, November 2, 2009 12:33 PM
|
|
|
|
|
Hello all,
can any one plz tell me how we can get through proxy using JML(java msn messenger Library). this problem has really hindered my work. bundle of thanx
@Member 4277480
dear sir, last time u solved my problem. i hope this time too, u will give it a kind consideration.
regards
adeel
modified on Thursday, November 5, 2009 1:53 AM
|
|
|
|
|
Hi,
I'm using javax.swing.JOptionPane.showOptionDialog for getting user input. But this is very slow. Please can someone let me know how to improve the functionality of this? or is there any alternative to speed up. It's so disappointing as this takes seconds to load a simple user input window.
Below is the code I have used for this,
JOptionPane.showOptionDialog( VolChangeMDIFrame.getDesktop(),VolUserInput,VolumeSelectTitle,
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.PLAIN_MESSAGE,
null,null,null);
Thanx in advance.
|
|
|
|
|
The javax.swing.JOptionPane.showOptionDialog is not slow. I would be suspicious of one of the first three parameters. What is the parent object VolChangeMDIFrame.getDesktop() ? Why not just use this ?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Thx, the problem was incorrectly tracked by profiler. It's not a problem with javax.swing.JOptionPane.showOptionDialog ...
|
|
|
|
|
I am having a very long delay with both the presentation of hte JOptionPane.showInputDialogue and when I click on the OK button, I get a 3-6 second delay.
Here is the code:
viewer.setStatus("Waiting on input");
String reason = JOptionPane.showInputDialog("Redaction Reason", "User");
if( reason != null && reason.length() > 0 )
{
viewer.setStatus("Analyzing");
..... do some analysis
}
Now, the status shows in the parent "viewer" and then a long wait ( sometimes )
until the option pane appears. Then a long wait while the components are painted, wait for the input field, wait for the OK button, and the Cancel button.
Enter input, then click OK. VERY LONG WAIT ( 3-6 seconds ) before panel hides and next statement is executed. No indication of problem. CPU useage very low.
Nothing else running to eat up cpu ( highest < 10% )
This seems to have appeared recently. Don't know if it was the upgrade in Java for Snow Leopard, or something I've done in the code, but I don't see why anything I've done that isn't eating up time would affect the time to appear or time to dissappear significantly.
Running on Mac OS X Snow Leopard 10.6.3
|
|
|
|
|
In addition, all mouse events seem to be extremely slow with long delays in dragging, clicking, etc. It isn't the time for my code to process the event, it appears to be a delay before my code gets the event.
|
|
|
|
|
Just measured 20 seconds to display the OK button after the frame of the option panel had appeared. CPU this time was at 60% after starting the show of the pane until the OK button appeared.
|
|
|
|
|
How do i concatenate this 2 lines of code:
dtProgramada.getValue()
dthoraProgramada.getValue()
And later add them as parameters on this method of type Date:
aux.setDataProgramada();
dtProgramada it's a Datebox and dthoraProgramada it's a Time box (ZK framework),
public Date getDataProgramada() {
return dataProgramada;
}
public void setDataProgramada(Date dataProgramada) {
this.dataProgramada = dataProgramada;
}
Please advise...
|
|
|
|
|
I don't know ZK, so I am making some assumptions here, there may be an easier way built into ZK.
Assuming that you want to take a Date (from the Datebox) and set its time part (from the Time box) and get a Date back as a result, you should use java.util.Calendar. Exactly how you do that depends on what the ZK components return from getValue().
|
|
|
|
|
hi
i have to make a program in which it will provide me a messenger which can connect to the internet and enter that facebook library.
it must be able to get my buddy's list from my facebook account and most espacially it must send and receive messages to and from my buddies.
|
|
|
|
|
Sin number two.
Please don't start another thread to continue a previous item. It's rude and the hamsters don't like it.
Now to repeat: We are not going to do your homework for you.
Is there something you do not understand?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Stop it. If you've waited this long to start your project, you're never going to finish it in it. Noone is going to do your work for you. Scine you've demonstrated that you can't manage your time properly, yuo'll get the grade you deserve and fail to pass the class. Oh, and by the way, your future employers will be looking for that "time management" skill.
Face it - you've screwed yourself. Now go have a cigarette.
|
|
|
|
|
Hi Guys,
I need to format an input field to accept only time with this format: "H:mm:s"
How can this be done?
|
|
|
|
|
This could be quite an intersting side project, but I think the easiest thing would be a quick google for swing time controls. There are plenty of choices here[^], I wouldn't write your own.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|