Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

How to design ?

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new in Swing application. I want to write an application that has login screen for user login when the application launch. After the user login, it will show another screen which has several buttons. Each button when clicks will show another screen for different functions. The new screen also has another buttons to go to the new screens etc...
How to implement? Is it using the card layout ? Or is there has any standard mechanise for the page navigation in Swing application ? Thanks.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct me if i'm wrong.
Layouts are just for content layout on a UI component. Ie how buttons/labels and other things are displayed on the screen.
For page navigation (on clicking this button go here), i don't believe that there are any flow managers built into java. Of course you could make your own flow engine or something.
 
kwwong wong
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can I create a JFrame first and then add a JPanel on the JFrame which is the one page of my application. When I click the button on page one, I remove the JPanel from the JFrame and then add another JPanel on the JFrame which is page two of my application. It also has a button on the page two to navigate to other pages for different functions in my application ?
Where can I download the sample application which has the page natvigation mechanism ?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can work with the JTabbed Pane. So each of them has the buttons and objects you need , and you can easily switch between the different Panels.
Also if one should be invisible for one kind of user, that isnt a problem
Take a look at this:
http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
kwwong wong, your initial idea about using CardLayout is correct. Use a CardLayout when you want to control the users progress through a series of panels. Use a JTabbedPane if the order doesn't matter and the user can control their movement through the panels.

Just name each "card" in the card layout a specific name and define which buttons take the user to which card in one big actionlistener. Then attach this actionlistener to all the buttons.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic