Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

number of Jframes per application

 
c orange
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i need to create a swing app, startup window consisting of 5 buttons to go do different things.

question is: for each action the button is to do, is it normal practice to create a Jframe for
each button's call?

so button 1 calls a class that creates a JFrame with panels, more buttons, tables etc..and has its own dispose() or exit() call.
button 2 calls another class that creates yet another JFrame, also with its own sets of functions and with its own exit call..
button 3 etc..

how many JFrame windows is considered too many to spawn from 1 start window? or is it a normal
practice to spawn a Jframe with each action to perform?

thanks.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sounds like a candidate for a cardLayout

a single JFrame with a JPanel(cardlayout), which contains all your class panels.

much like an installation wizard with next/previous buttons where each button click
shows a different screen
 
please buy this thing and then I get a fat cut of the action:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!