Results 1 to 5 of 5
Thread: JPanel question.
- 02-27-2012, 03:51 PM #1
JPanel question.
I decided to work with JPanels in staid of JInternalFrame. The JPanel will be displayed inside another JPanel (MainPanel) at the mouse pointer and will contain information about the object that was clicked on by the mouse.
So my question is; Is it better to create a new panel every time the panel is to be displayed or "show and hide" the panel with new data in staid?
Also will it work if i just add the new panel to the "MainPanel" and then use the setlocation(x,y); to position it by the mouse?
Thanks...
- 02-27-2012, 04:33 PM #2
Re: JPanel question.
That depends on what your definition of "better" is as well as the specifics of your requirements (where your data is coming from, what's being displayed, what changes, etc) . I'd recommend you do a test of each and decide for yourself.
As for adding the new panel, you might want to make sure you remove old panels, and you have to keep in mind things like overlapping components, revalidating, etc. You might want to look into adding it to a GlassPane instead.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 02-27-2012, 05:55 PM #3
Re: JPanel question.
Sounds like its better to use the glassPane ... If i want to add a JPanel on the glasspane should I use the default glassPane? I have no experience with the glasspane. Thanks
- 02-27-2012, 06:03 PM #4
Re: JPanel question.
What happened when you tried?
Recommended reading: A well-behaved GlassPane | Java.netHow to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 02-27-2012, 06:16 PM #5
Re: JPanel question.
Yeah ... I didn't try yet :P still reading about it in How to Use Root Panes (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components). Im still amazed by that my java book has zero on the glassPane ..
Similar Threads
-
Using an ActionListener To move from One JPanel in a JtabbedPane to another JPanel...
By Ermm in forum AWT / SwingReplies: 1Last Post: 12-13-2011, 02:38 AM -
Change JPanel text of Parent JPanel from JDialog
By bikashlama in forum AWT / SwingReplies: 7Last Post: 12-09-2011, 03:47 AM -
Question about repainting a JPanel
By Nosrettap in forum Advanced JavaReplies: 5Last Post: 01-02-2011, 08:29 PM -
Need help with array list jpanel question!!! Plz help!!!
By helpmeplease in forum New To JavaReplies: 17Last Post: 12-11-2009, 12:37 PM -
calling JPanel's JTextField from another JPanel class
By k2k in forum AWT / SwingReplies: 3Last Post: 04-20-2009, 11:31 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks