Results 1 to 5 of 5
- 05-10-2012, 02:52 PM #1
JAVA Applet resize to load problem?
Hello everyone,
My problem in the following code is that the modified component only loads when I resize the applet window. When I add the "labelOne" label, it does not appear instantly but only when I resize the output applet. I'm not using the paint() method as I don't need it.
Any help/assistance would be greatly appreciated.
Cheers.
Java Code:// The "ListenerTesting" class. import java.applet.*; import java.awt.event.*; import java.awt.*; public class ListenerTesting extends Applet implements MouseListener { Panel panelOne; Label labelOne; public void init () { setLayout (new GridLayout (3, 3)); panelOne= new Panel (); panelOne.addMouseListener (this); labelOne= new Label ("X"); add (panelOne); } //init method public void mouseClicked (MouseEvent e) { if (e.getComponent () == panelOne) panelOne.add(labelOne); } //mouseClicked method public void mouseEntered (MouseEvent e) { } //mouseEntered method public void mouseExited (MouseEvent e) { } //mouseExited method public void mousePressed (MouseEvent e) { } //mousePressed method public void mouseReleased (MouseEvent e) { } //mouseReleased method public void paint (Graphics g) { } // paint method } // ListenerTesting classLast edited by Kratos321; 05-11-2012 at 04:47 AM.
- 05-10-2012, 03:14 PM #2
Re: JAVA Applet resize to load problem?
After a container is visible, you can't just add components to it and have it magically work. You have to revalidate the component after you add something to it. Check out the API for useful functions.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-10-2012, 03:55 PM #3
Re: JAVA Applet resize to load problem?
The code overrides the paint method and does nothing. That means the component's paint() method is NOT being called. Is that what you want?I'm not using the paint() method as I don't need it.If you don't understand my response, don't ignore it, ask a question.
- 05-10-2012, 04:25 PM #4
Re: JAVA Applet resize to load problem?
Why do they call it rush hour when nothing moves? - Robin Williams
- 05-11-2012, 02:09 AM #5
Similar Threads
-
Settlers of Catan Java Applet won't load
By ragalie in forum Java AppletsReplies: 5Last Post: 02-23-2012, 04:00 PM -
Java Applet Will Not Load.
By PaulMoretti in forum Advanced JavaReplies: 3Last Post: 08-16-2011, 05:19 PM -
hide the java applet load widow from the browser document body
By sagngh8 in forum Java AppletsReplies: 1Last Post: 08-14-2011, 03:07 AM -
Java Security Applet will not load under a specific user.
By MartyF in forum Java AppletsReplies: 0Last Post: 03-31-2008, 04:35 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks