• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing Windowing

 
Austin Henggi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure how to describe this, but basically, I want a program that will have a single window, but multiple "views". So say that there is one option on the toolbar that shows a JPanel with some stuff on it, surrounded by three other JPanels with other options to the left, bottom, and right of the main JPanel. Then the user can click on another option under the JMenu bar and get a different view, this time just showing the main panel, although enlarged slightly. And there will probably be at least one other view as well. How would I do this?

One approach that I thought of would be to create one JFrame and just add and remove panels from it as needed. However, it would be nice also to just setup the multiple views once and then switch the display between them as needed vs. adding and removing components from a single JFrame. Question is: what is the best way to implement these multiple views (keep in mind that they should all share the same window), it is a single-window program.
 
Brian Cole
Author
Ranch Hand
Posts: 912
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you familiar with JDesktopPane and MDI?
 
Austin Henggi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I think I it would have been better to describe what I am looking as how to show a different view on the fly. In other words, I would have something like a BorderLayout view with a main panel in the center surrounded by other panels in the BorderLayout west and east. Then I would change views by stripping away the other panels on the west and east, but eventually I would want to go back to the first view, or maybe a different view which does not contain the main panel at all. However, all this would happen in one frame or panel, despite the title of my post, there is no window. Sorry, my title is misleading.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CardLayout?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic