Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Switching screens  RSS feed

 
Peter Kananen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a couple Screen classes (all JFrames) and I'd like my window to switch between them (via buttons), but only have one displayed at a time.

In midP I used switchTo(Displayable) with getCurrent() and setCurrent()

Anything like that in Swing??
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds like a rather unusual GUI design. I'd typically rather expect a JTabbedPane or CardLayout or something instead of multiple JFrames.

But perhaps I'm misunderstanding what you want to accomplish. Care to elaborate?
 
Peter Kananen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Understandable, I thought of using tabbed panes. My original idea was to have one window, starting with the main screen. Based on a button press, you would go to the edit screen or the new screen. But these new screens would not be new windows, they would just become the "current" screen. But I couldn't use JFrames for each screen class. Ideas?
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aren't the new and edit screens essentially the same thing: they both show a view of some data x, except with the edit screen you have some data to start off with?
 
Peter Kananen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, they aren't really the same. The edit screen is going to add you to add or delete items from a list. The new screen will allow you to create a subset (a shopping list) of the items in the larger list.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!