java - Centering the JTabbedPane but not the actual tabs -


Depending on how many rooms have been left in that row of tabs, I automatically make about the length of the size tabs How would I go?

Image:

alt text

As you can see, the width of the tab closes the text in the tab.

If you need to explain to me what I want, just ask me because I do not know that I have made it clear. / P>

You can use custom components and set it to a custom size. For example, in ButtonTabComponent :

  label.setPreferredSize (new dimension (...));  

You must choose the appropriate dimension based on other aspects of your layout, so it will not be automatic.

I want to define a size for the actual tabbed pan.

The size of JTabbedPane is a function of dimensions and LayoutManager the container of which it has been added. In, the default layout of the frame's content pane is border layout , and add (pane) connects it to the center by default.

Your goal to complete, I look at two ways:

  1. The current width of the container attached to the existing tab Divide and repeat the tabbed pane, as shown in this.

  2. Develop your own implementation and interpret SCROLL_TAB_LAYOUT accordingly.


Comments