Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Ron McLeod
paul wheaton
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Himai Minh
Bartenders:
Forum:
Swing / AWT / SWT
First land Last card in Cardlayout
Sandesh Jadhav
Greenhorn
Posts: 14
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is there any direct way in Cardlayout to find out whether the currently displaying card is the first or the last card ?
Thanks
Rob Spoor
Sheriff
Posts: 22850
132
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No direct way; Sun decided to keep the "currentCard" field hidden from us, without a public accessor.
An indirect way:
if (getComponent(0).isVisible()) { // the current card is the first card } else if (getComponent(getComponentCount() - 1).isVisible()) { // the current card is the last card }
You see, a CardLayout simply hides all non-shown
cards
, and only one of them is visible at a time.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Sandesh Jadhav
Greenhorn
Posts: 14
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks Rob, it worked.
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
buttons in card layout
How to navigate between multiple GUI classes
JApplet & CardLayout display problem
How to exit JFrame2 when going back to JFrame1
Recycle/Re-use
More...