Is that a bug for JTabbedPane?

J

James

Hi, I found that in JTabbedPane, when I set tabLayoutPolicy to
"SCROLL_TAB_LAYOUT", it can't return the correct number of tab for the
function "getComponentCount()", it return with add 3 so if there is 4 tab
then it return 7......
but when I set tabLayoutPolicy to "WRAP_TAB_LAYOUT", then the function
"getComponentCount()" can return correct number of tab
that is 4.
Is that a bug?!!!!!
 
P

Pedro

James said:
Hi, I found that in JTabbedPane, when I set tabLayoutPolicy to
"SCROLL_TAB_LAYOUT", it can't return the correct number of tab for the
function "getComponentCount()", it return with add 3 so if there is 4 tab
then it return 7......
but when I set tabLayoutPolicy to "WRAP_TAB_LAYOUT", then the function
"getComponentCount()" can return correct number of tab
that is 4.
Is that a bug?!!!!!
Use JTabbedPane.getTabCount() instead.

AFAIK it's not a bug. If the layout policy is set to SCROLL_TAB_LAYOUT, two arrow buttons will
become visible if not all the tabs can be displayed (allowing you to scroll the tabs). Just like the
tabs themselves, these buttons are added to the JTabbedPane container (and probably another
component that adds some space between the tabs and the buttons). That's why getComponentCount()
returns more than the number of tabs.

Regards,
Pedro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top