Results 1 to 3 of 3
Thread: Gui for applet in another class
- 07-21-2012, 08:34 AM #1
Member
- Join Date
- Jul 2012
- Posts
- 17
- Rep Power
- 0
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:
My Gui class:Java 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(){ } }
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?Java Code:package core; public class Gui{ public Gui(){ } }
- 07-21-2012, 10:45 AM #2
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 07-21-2012, 08:58 PM #3
Member
- Join Date
- Jul 2012
- Posts
- 17
- Rep Power
- 0
Similar Threads
-
. class not found when trying to run applet?
By louiedogg418 in forum New To JavaReplies: 3Last Post: 08-04-2011, 06:43 PM -
applet class inside java.applet.* or java.awt.*
By Manish87 in forum Java AppletsReplies: 1Last Post: 09-27-2010, 02:15 PM -
can Applet be an inner class?
By zweibieren in forum Java AppletsReplies: 0Last Post: 03-26-2010, 06:42 AM -
class problen with java Applet
By Tucan in forum Java AppletsReplies: 7Last Post: 07-07-2009, 05:02 PM -
Multiple class applet
By lordbob75 in forum Java AppletsReplies: 5Last Post: 01-08-2009, 01:22 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks