This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Getting the size of a tab in a JTabbedPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Getting the size of a tab in a JTabbedPane" Watch "Getting the size of a tab in a JTabbedPane" New topic
Author

Getting the size of a tab in a JTabbedPane

Buckley Lee
Greenhorn

Joined: Mar 28, 2001
Posts: 19
There are no member functions in the JTabbedPane class to retrieve the size of a tab from a JTabbedPane. There are only member functions to return the # of tabs and the # of rows or columns the tabs are using. Is there a trick to get the size of each tab in the JTabbedPane?
For example, suppose there are 2 tabs in the JTabbedPane. The first tab contains the text "Tab" and the second tab contains the text "This is a Big Tab". Obviously the sizes of the tabs are going to be different, but currently there is no way to obtain their sizes based upon the member functions of the JTabbedPane class. Is there a workaround to this?
Ana Mihailescu
Greenhorn

Joined: Apr 26, 2001
Posts: 29

From my point of view you can only calculate it, from the size of the title string plus a constant number, for the margins.
The size of the string can be calculated in pixels using the
FontMetrics class, and of course it is dependent on the string and on the font that is used.
Ana
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting the size of a tab in a JTabbedPane
 
Similar Threads
Overlapping tabs in Windows XP LAF
JTabbedPane - Tab Reordering
Reg Tab Key in JTabbedPane
will Pro css and Html design pattern give solutions for these problems
Reg Tab Key in JTabbedPane