| | |
building instant messenger
![]() |
hi
you know I'm doing a project on java instant messenger. I was thinking how would i implement it. should i use a seperate class for each component of the messenger. for example one class for its gui, one class for its chat diaglog, one for it jtree panel(to show the users).....etc, or should I implement it all together.
but now im confused if I implement it as seperate classes, how would i compile all these, like in main, and how would i put it together e.g. if i implement jtree, which would be to show the users who are logged in and out, in other file how would i call it in main gui part etc...
btw its a client and server based application
any advice will be appreciated
thanks
you know I'm doing a project on java instant messenger. I was thinking how would i implement it. should i use a seperate class for each component of the messenger. for example one class for its gui, one class for its chat diaglog, one for it jtree panel(to show the users).....etc, or should I implement it all together.
but now im confused if I implement it as seperate classes, how would i compile all these, like in main, and how would i put it together e.g. if i implement jtree, which would be to show the users who are logged in and out, in other file how would i call it in main gui part etc...
btw its a client and server based application
any advice will be appreciated
thanks
First, it is good programming practice to keep the various components separated (separate class files for gui, chat etc..)
Second I would strongly recommend getting an IDE to develop with. I can easily recommend both Netbeans (www.netbeans.org) or Eclipse (www.eclipse.org) They will help you organize the many files that are likely to make up your project. They will also speed up your development with GUI editors, compiling and packaging. There is a learning curve, but there are excellent tutorials available to help.
I wrote a small chat client a while back and I implemented a Hashtable to contain User and socket (user was the key, socket the value) So, you could iterate through the hashtable keys to build the JTree of users.
To compile multiple .java files you would run the following command line: javac -d <directoryforoutput> *.java
That is the simplest method. See javac -help for more details on compiling.
In order to use the various classes in the main() you would need to create objects representing your classes:
void main(String[] args){
MyGUIClass gui = new MyGUIClass();
gui.setVisible(true);
}
This snippet presumes that your class MyGUIClass extends one of the Java window classes (like JFrame).
Again, I would urge you to look into getting one of the IDE's mentioned above. It will make development much easier, as most of the details will be handled by it, leaving you free to work on implementing the important bits that hold everything together.
Second I would strongly recommend getting an IDE to develop with. I can easily recommend both Netbeans (www.netbeans.org) or Eclipse (www.eclipse.org) They will help you organize the many files that are likely to make up your project. They will also speed up your development with GUI editors, compiling and packaging. There is a learning curve, but there are excellent tutorials available to help.
I wrote a small chat client a while back and I implemented a Hashtable to contain User and socket (user was the key, socket the value) So, you could iterate through the hashtable keys to build the JTree of users.
To compile multiple .java files you would run the following command line: javac -d <directoryforoutput> *.java
That is the simplest method. See javac -help for more details on compiling.
In order to use the various classes in the main() you would need to create objects representing your classes:
void main(String[] args){
MyGUIClass gui = new MyGUIClass();
gui.setVisible(true);
}
This snippet presumes that your class MyGUIClass extends one of the Java window classes (like JFrame).
Again, I would urge you to look into getting one of the IDE's mentioned above. It will make development much easier, as most of the details will be handled by it, leaving you free to work on implementing the important bits that hold everything together.
•
•
•
•
Originally Posted by sfbell
First, it is good programming practice to keep the various components separated (separate class files for gui, chat etc..)
Second I would strongly recommend getting an IDE to develop with. I can easily recommend both Netbeans (www.netbeans.org) or Eclipse (www.eclipse.org) They will help you organize the many files that are likely to make up your project. They will also speed up your development with GUI editors, compiling and packaging. There is a learning curve, but there are excellent tutorials available to help.
I wrote a small chat client a while back and I implemented a Hashtable to contain User and socket (user was the key, socket the value) So, you could iterate through the hashtable keys to build the JTree of users.
To compile multiple .java files you would run the following command line: javac -d <directoryforoutput> *.java
That is the simplest method. See javac -help for more details on compiling.
In order to use the various classes in the main() you would need to create objects representing your classes:
void main(String[] args){
MyGUIClass gui = new MyGUIClass();
gui.setVisible(true);
}
This snippet presumes that your class MyGUIClass extends one of the Java window classes (like JFrame).
Again, I would urge you to look into getting one of the IDE's mentioned above. It will make development much easier, as most of the details will be handled by it, leaving you free to work on implementing the important bits that hold everything together.
![]() |
Similar Threads
- creating an instant messenger program in java (Java)
- Instant Messenger Help (Visual Basic 4 / 5 / 6)
- building chatroom or web instant messenger (Growing an Online Community)
- instant messenger project (Java)
- Travel AOL Instant Messenger (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: suggestion with multiple arrays
- Next Thread: SUN java Exam.....Need help
| Thread Tools | Search this Thread |
911 addball addressbook android api append applet application apps array arrays automation binary bluetooth businessintelligence button card class client code collision component crashcourse css csv database eclipse ee error fractal free ftp game gis givemetehcodez graphics gui html ide image integer integration j2me japplet java javaarraylist javadoc javafx javaprojects jni jpanel julia jvm linked linux list loan machine map method methods migrate mobile netbeans objects oriented output phone physics printf problem program programming project projects radio recursion replaydirector reporting researchinmotion rotatetext scanner se server service set sms software sort sql string swing test textfield threads tree trolltech ubuntu utility windows






