• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Switching screens

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic