|
-
May 16th, 2007, 06:14 PM
#2
Re: Set size of scroll button in JTabbedPane with SCROLL_TAB_LAYOUT policy
The reason it doesn't work is because the scroll button created is a subclass of BasicArrowButton, which returns hard-coded values from it's getPreferredSize and getMinimumSize methods. If you override the getPreferredSize method it should work.
Unfortunately, to do this, you need to create the scroll button yourself, instead of calling the superclass method.
Fortunately, in principle, it shouldn't be difficult:
Code:
return new BasicArrowButton(direction,
UIManager.getColor("TabbedPane.selected"),
UIManager.getColor("TabbedPane.shadow"),
UIManager.getColor("TabbedPane.darkShadow"),
UIManager.getColor("TabbedPane.highlight")) {
public Dimension getPreferredSize() {
return new Dimension(50, 50);
}
};
OK, this is pure guesswork, and it's untested, but if it doesn't work, it's got to be fairly close
Genius is 1 percent inspiration and 99 percent perspiration. As a result, genius is often a talented person who has simply done all of his homework...
T. Edison
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|