This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting JOprionPane to appear within the confines of JFrame

 
Rich Charlton
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ive written medium sized program with a sizeable GUI and am having problems scoping my JOptionPanes to appear in the confines of my main JFrame. This has become a big problem for me and i have tried lots of things to solve it but nothing has worked. The Dialogs that im having trouble with all reside in actionListeners and then some reside in if statements once in the actionlistener method etc. For example:

Customer Class:


All the optionpanes im having problem with are in bold. The options below all compile but do not move the JOptionPanes anywhere. I need them within the confines of the main frame.

I need help if anyone is helpful....

Thanks a lot.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a few changes

addActionListener(new SelectButton());
to
addActionListener(new SelectButton(datecombos));//4 of these

the constructor for SelectButton


the JOptionPanes then change to (note parent)
JOptionPane.showMessageDialog(parent, "There are no showings...etc)
 
Rich Charlton
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been a great help.

Thanks a lot Michael.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic