This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

show OptionDialog without JTabbedPane changing tab

 
khuong pham
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to show an optionDialog when an user click on a tab in a JTabbedPane but the JTabbedPane must not show the clicked tab before the user selected the right option in the Dialog.

Thx in advance.
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ben Zung
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. extend JOptionPane


2. have the component, say comp that contains the tabbed pane implements "ChangeListener"

3. in your "public void stateChanged(ChangeEvent e) "
method, instead of
use

Gook luck.
[ March 30, 2006: Message edited by: Ben Zung ]
 
khuong pham
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx a lot ...The first example works great
 
Paulo Guzman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can extends JTabbedPane to override the setSelectedIndex method and then call super.setSelectedIndex(index); after doing your validation something like:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic