This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes show OptionDialog without JTabbedPane changing tab Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "show OptionDialog without JTabbedPane changing tab" Watch "show OptionDialog without JTabbedPane changing tab" New topic
Author

show OptionDialog without JTabbedPane changing tab

khuong pham
Greenhorn

Joined: Dec 15, 2005
Posts: 6
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

Joined: Jan 14, 2004
Posts: 1535
Ben Zung
Ranch Hand

Joined: Mar 25, 2004
Posts: 109
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

Joined: Dec 15, 2005
Posts: 6
thx a lot ...The first example works great
Paulo Guzman
Greenhorn

Joined: Dec 07, 2010
Posts: 2
You can extends JTabbedPane to override the setSelectedIndex method and then call super.setSelectedIndex(index); after doing your validation something like:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: show OptionDialog without JTabbedPane changing tab
 
Similar Threads
JTabbedPane Problem
Control scheme for the client GUI
RMI & Swing
Adding java programs into JFrame
Problem to show dynamic Tabs