> > To switch pages, the JTabbedPane use the SingleSelectionModel instance
> > (model field).
[quoted text clipped - 5 lines]
> changeevent, show a dialog, then let the changeevent continue to
> actually displaying the tab the user clicked on.
the event originally is sent by model, handled by tabbed pane UI and
after that transferred to you.
So you can include your additional code into the model before it fires
a change event:
// DefaultSingleSelectionModel.java
public void setSelectedIndex(int index) {
// show a dialog here
// or create and fire your own additional event
// or do something else you want
// or return without switching pages
if (this.index != index) {
this.index = index;
fireStateChanged();
}
}
Joe - 24 Feb 2008 06:07 GMT
> the event originally is sent by model, handled by tabbed pane UI and
> after that transferred to you.
> So you can include your additional code into the model before it fires
> a change event:
This is working for me, but the only problem I'm having is that I can't
figure out how to get the source of the event before the
setSelectedIndex() method is called. I see it afterwards.
I've implemented ChangeListener on my class extended from
DefaultSingleSelectionModel, but the stateChanged() doesn't get called.
What am I doing wrong there?
Alexander.V.Kasatkin@gmail.com - 24 Feb 2008 12:58 GMT
> > the event originally is sent by model, handled by tabbed pane UI and
> > after that transferred to you.
[quoted text clipped - 9 lines]
>
> What am I doing wrong there?
It too hard for me to understand it without code you wrote,
so I've updoaded my simple example on the Google code:
http://code.google.com/p/javacodesnippets/downloads/list
Try to download these files.
BR, Alex