I found a chat application online that uses client/server but they just wrote out all the code to add the buttons, textfields etc to the frame.
I prefer to add a JFrame and drag and drop the stuff over and then create event handlers for the buttons.
But when i try putting the code into my frame nothing works.
I really hope someone can help
The website code works perfectly I just want to put everything in a JFrame.
I would really appreciate if someone could take a look and see what I am doing wrong
here is the website code:
Joined: Nov 19, 2012
and here is my attempt at adding the code to JFrame
Of the two, Login is the easier to convert to a JFrame. Why? Because it's not extending a class now. You can just declare it to extend JFrame, remove the JFrame frame1 field, change the first line of the constructor from "frame1 = new JFrame("Login Page") to super("Login Page"), and finally change all other references of frame1 to this. It's all bookkeeping really.
MyClient is just a bit harder since it extends WindowAdapter. You'd either have to make it implement WindowListener (and provide dummy implementations for the methods you don't care about) or create a new WindowAdapter, possibly as an anonymous inner class, with the windowClosing() method that's currently in MyClient. Still bookkeeping, but somewhat harder bookkeeping.