| | |
JFrame Issue
![]() |
This is a really strange bug...
I'm doing a 'game' of sorts for Computer Science, and it works wonderfully. We have a main method that initializes things and starts the game loop. The game itself works when GUI.java is executed.
Every method call in the main method is static.
Now, the odd thing is that when that exact same code (copy and paste) is run from a different class, and either executed statically, or even when creating a new object and using that as a reference, both JFrames show up as necessary, but they are EMPTY. Big gaping transparent holes of nothing.
Can someone explain this phoenomenon?
FYI: Here's the main method I'm referring to:
And when called externally, either this:
or this
does the transparent frame effect.
Let me know if you need more information.
I'm doing a 'game' of sorts for Computer Science, and it works wonderfully. We have a main method that initializes things and starts the game loop. The game itself works when GUI.java is executed.
Every method call in the main method is static.
Now, the odd thing is that when that exact same code (copy and paste) is run from a different class, and either executed statically, or even when creating a new object and using that as a reference, both JFrames show up as necessary, but they are EMPTY. Big gaping transparent holes of nothing.
Can someone explain this phoenomenon?
FYI: Here's the main method I'm referring to:
java Syntax (Toggle Plain Text)
// In class GUI: public static void main(String[] args) { init(); //static Console.run(frame, 808, 635); //Console class is static, frame is static panel.paintLevel(); // static panel.paintLevel(); // static frame.run(); // static }
java Syntax (Toggle Plain Text)
// In External Class: GUI.init(); Console.run(GUI.frame, 808, 635); GUI.panel.paintLevel(); GUI.panel.paintLevel(); GUI.frame.run();
java Syntax (Toggle Plain Text)
// In External Class: GUI gui = new GUI(); gui.init(); Console.run(gui.frame, 808, 635); gui.panel.paintLevel(); gui.panel.paintLevel(); gui.frame.run();
Let me know if you need more information.
Last edited by Sp!ke; Jun 1st, 2007 at 1:49 am.
Geek and a Half Blog
I don't think we can provide any insight without seeing the panel and frame classes.
On a side note, your may want to reconsider your design in making everything static and trying to manage the interactions by calling static methods on the objects. The main method should really only be responsible for creating whatever minimal number of objects are needed to set up the environment of your program. All other operations should be performed by those objects themselves.
On a side note, your may want to reconsider your design in making everything static and trying to manage the interactions by calling static methods on the objects. The main method should really only be responsible for creating whatever minimal number of objects are needed to set up the environment of your program. All other operations should be performed by those objects themselves.
![]() |
Similar Threads
- Adding an icon to JFrame (Java)
- Power boot up issue (Motherboards, CPUs and RAM)
- Memory Issue's! Please Help!! (Motherboards, CPUs and RAM)
- Internet Explorer Connection Issue (Web Browsers)
- Netgear router issue...read this if you have one (Networking Hardware Configuration)
Other Threads in the Java Forum
- Previous Thread: Sun Java Programmer Certification
- Next Thread: Accepting audio in a java servlet
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows






