Article View: borland.public.jbuilder.java.swing
Article #10916Re: JTabbedPane questions
From: Tad Frysinger TeamB Tad Frysinge...
Date: Mon, 26 Jul 1999 00:00
Date: Mon, 26 Jul 1999 00:00
44 lines
1832 bytes
1832 bytes
In article <7nefpl$so06@forums.borland.com>, slneo@cybergal.com says...
> Hi,
>
> How do we know that the user is switching to another tab on the JTabbedPane?
> I need to do some checking before I can allow the user to do this, and if
> necessary, disallow the switching of tab.
>
> --
> Thanks for any help given
>
> Lois
>
>
>
You can't do it ahead of time. All you can do is catch it after the
fact using the state changed event, test to make sure it is ok, and
switch it back prior to giving the user a message. This actually happens
such that no tab switching is perceived, at least in my apps:
void conControlPanel_stateChanged(ChangeEvent e)
{
Frame frameObj = null;
if ( (conControlPanel.getSelectedIndex() == SQL_PANEL) &&
!connectBean.isConnected())
{
// Don't allow access to the Query panel if we are not connected
// to a DB.
conControlPanel.setSelectedIndex( CONNECT_PANEL );
frameObj = RDUtils.getFirstFrame(this);
if (( frameObj != null ))
{
JOptionPane.showMessageDialog(frameObj,
"You must be connected to a database \n" +
"before entering a query.",
"Not Connected to Database!",
JOptionPane.OK_OPTION,
null);
}
}
}
}
Tad Frysinger (TeamB)
Technical Details
Message-ID:
<MPG.12068110828bafb6989681@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7nefpl$so06@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,a8c235fcd1a12568 X-Google-Attributes: gid111d45,public From: Tad Frysinger (TeamB) (Tad Frysinger) Subject: Re: JTabbedPane questions Date: 1999/07/26 Message-ID: <MPG.12068110828bafb6989681@forums.borland.com> X-Deja-AN: 505530368 References: <7nefpl$so06@forums.borland.com> Organization: RTOne Newsgroups: borland.public.jbuilder.java.swing