Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Checking which jpanel is active in tabs  RSS feed

 
Anthony Schmitt
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering if there's a built-in way to do this. Otherwise, I was thinking of simply setting an Int to 1-3 on a mouse click event when selecting my tabs.

In case anyone wants to see the chaos that is my code...

 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your question is "How do I tell which pane of a JTabbedPane is the currently selected pane?" then the answer is that JTabbedPane has a method named "getSelectedComponent".

(And no, your 1000 lines of code doesn't help with that question. However if that wasn't your question, perhaps it might. But that's pretty unlikely.)
 
Anthony Schmitt
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getselected, that's exactly what I was after. Thank you.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
posting 1000+ lines of unreadable/uncompilable code will win you few friends.

here's a tip:

if you have a problem, create a sample program that just deals with the problem.

so, for "Checking which jpanel is active in tabs"

all you needed to post is something similar to this

 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael is right. That's called an SSCCE. And he's also right about the code length; I didn't even bother reading it because of its length.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!