This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
what will happen while adding already existing panel in JTabbedPane?
i have already added a panel Object in JTabbedPane.if i add the same panel again what will happen ?
and while adding panel i want to check whether a panel is exists in tat jtabbedpane or not..how to check tat..
mohan rajv wrote:what will happen while adding already existing panel in JTabbedPane?
i have already added a panel Object in JTabbedPane.if i add the same panel again what will happen ?
and while adding panel i want to check whether a panel is exists in tat jtabbedpane or not..how to check tat..
How difficult is it to try out on your own and see? Takes less time than posting here doesn't it? Check out JTabbedPane#getComponentAt(int index). If no panel exists you would get null.
i dont know the index of that panel.i have that panel object.and i have the jtabbedpane object.i want to check whether that panel is already there in my jtabbedpane or not..what should i do now?
You do not need to know the index of the panel.
Just iterate through all the tabs (check out the API to figure out how to find out the tab count). Once you retrieve the Object at some specific index, check if it is the same panel you want and process accordingly.
Did you check out if you can add the panel twice? What result did you get?
mohan rajv
Ranch Hand
Joined: Jan 28, 2009
Posts: 30
posted
0
if i add the same panel object again it is replacing the old one with that.i tried to add with new title it replaced the old one.
and i got a solution for my problem..instead of comparing the panel objects now i am comparing the panel titles.that s easy one..