Results 1 to 6 of 6
- 12-15-2009, 04:24 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 7
- Rep Power
- 0
JFrames or Panels to perform different tasks
Wondering what the best way to perform different tasks in one application is? I want to create a program that requires a logon (verifies through Database). After Loggin in I want to have a JFrame full of buttons that are assigned different tasks. For example: If user has permissions, they can click on button1 to bring a database entry screen up to add, delete and modify database entries. They also could click button2 to display a report of the data on the database. Button3 would bring up a screen that changes their user preferences. I can not figure out how to do this with out opening numerous JFrames at one time. The only other way I know is to create different panels and have the buttons display a different panel according to what the request is. Is there a better way? If not is the JFrame or Panel idea better? Thanks so much in advance!
-
It is almost always a better idea to code to the panel and not the frame. Having said that you should need to extend JPanel infrequently (usually when displaying graphics on the panel), and will almost never need to extend a JFrame.
- 12-15-2009, 04:45 AM #3
Member
- Join Date
- Dec 2009
- Posts
- 7
- Rep Power
- 0
Thank you for your quick reply. I will try the entire program with populating different panels instead of frames when the buttons are clicked.
-
If swapping panels, are you thinking about using a CardLayout?
- 12-15-2009, 05:09 AM #5
Member
- Join Date
- Dec 2009
- Posts
- 7
- Rep Power
- 0
Yes, a card layout should work as long as I can direct which "Card" or panel I need to go to and not have to perform it in sequential order. Each panel should allow me to connect to the database, have buttons of their own and abstract input from text fields, correct?
- 12-15-2009, 05:57 AM #6
Member
- Join Date
- Dec 2009
- Posts
- 7
- Rep Power
- 0
Thanks so much for your help. I have just searched the already posted threads and noticed that there has been many questions similar to the one I asked (And you have answered most of them with the same answer you gave to me). After reading through them I think the card layout is good for me. Thanks so much for helping me out even though the question has been asked a million times!!
Similar Threads
-
Cannot perform a PING
By mnementh64 in forum NetworkingReplies: 1Last Post: 09-17-2009, 04:39 PM -
Scheduling tasks using Threads
By Java Tip in forum Java TipReplies: 0Last Post: 12-11-2007, 10:24 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks