Gui for applet in another class
So, I want my code organized and created a Gui class to handle my GUI, here's what i got so far:
Code:
package core;
import javax.swing.JApplet;
public class Client extends JApplet{
public void init(){
try{
javax.swing.SwingUtilities.invokeAndWait(new Runnable(){
public void run(){
new Gui();
}});
}catch (Exception e){
System.err.println("EE");
}
}
public void start(){
}
public void stop(){
}
public void destroy(){
}
}
My Gui class:
Code:
package core;
public class Gui{
public Gui(){
}
}
Ok, so here's my problem the Gui class doesn't extend JApplet so there for, I can't set the size, or add components how would I do this?
Re: Gui for applet in another class
1) The size of an Applet is set by the HTML tag that displays it, not by any Java code
2) Whatever GUI Components your GUI class might instantiate, they won't be shown without being added to a top level window -- in this case, the Applet. The GUI class should either extend a Container subclass or (usually better) have a method that returns a Container populated with the desired Components.
db
Re: Gui for applet in another class