anyone know how I can get hold of the currently displayed card in
a cardlayout panel, or even just the string it is stored in the cardlayout
as? So I could say e.g. :
MyCardLayoutPanel.CurrentlyDisplayedCard.add(MyWhatever);
I don't want to store an extra Vector of all the possible card's and have
to search this to compare it against the current object received in an
event. Also I don't know the string ID of the card that is currently
displayed (I can't be bothered explaining exactly why here but my program
has a hypertext system built in and the user controls which cards are
displayed)
so please tell me, how do I do something like:
Panel CurrentCard = MyCardLayoutPanel.getCurrentCard();
as I can't see anything in the docs.
Please e-mail me if you know (I don't get chance to read usenet much)
Thanks Loads,
Ian. (i.j.pe...@sheffield.ac.uk)
Ian wrote in message <6h4h0m$74c$1...@bignews.shef.ac.uk>...
> anyone know how I can get hold of the currently displayed card in
> a cardlayout panel, or even just the string it is stored in the cardlayout
> as? So I could say e.g. :
> MyCardLayoutPanel.CurrentlyDisplayedCard.add(MyWhatever);
Unfortunately, CardLayout has no way to reveal the active card. Fortunately,
though, the only way to *change* the active card is through code. This means
that you can simply record the new active card whenever *you* set it.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
rg...@sctcorp.com wrote:
--
G. Ralph Kuntz, MD, MS (Computer Science)
Diplomat of the American Board of Internal Medicine
E-mail: g...@usa.net
(W) +1-973-243-6256
> Does CardLayout trigger an event when the user changes tabs? Can a program use
> something like addActionListener() to cause a "callback" to other code? I checked
> the docs, but may not be looking in the right place.
I think you are overestimating what CardLayout actually does. CardLayout involves
no tabs, or users clicking on tabs, or other such things. ALL that CardLayout does
is let you build a couple of panes and show one of them at a time. To change the
pane that is shown, you must specifically call methods in the CardLayout for that
purpose.
Now, it would be a fairly common application of the CardLayout class to create a
tabbed dialog, but you should know that you would be responsible for actually adding
a canvas to the top where you draw the tabs yourself and handle mouse events
yourself to hit test against the location of each tab, and when a tab is clicked
change the visible pane of the CardLayout to reflect the new tab. None of this is
done in CardLayout.
That said, I'm sure that someone somewhere has written a generic tabbed dialog
component that you could use... I've just never seen it.
-------------------------------------------------------------------------------
| The most serious doubt that has been
Chris Smith | thrown on the authenticity of the biblical
University of Oklahoma | miracles is the fact that most of the
cd_s...@ou.edu | witnesses in regard to them were fishermen.
| - Arthur Binstead
-------------------------------------------------------------------------------