Code
public void tabComponentResized(ComponentEvent e, JTabbedPane tabs) {
Component c = e.getComponent();
if (c.equals(tabs.getSelectedComponent())) {
Dimension d = c.getPreferredSize();
if (isTopBottomTabPlacement(tabs.getTabPlacement())) {
d.height = splitPane.getDividerLocation() - tabAreaSize.height;
} else {
d.width = splitPane.getDividerLocation() - tabAreaSize.width;
}
c.setPreferredSize(d);
}
}
public void updateDividerLocation(JTabbedPane tabs) {
Component c = tabs.getSelectedComponent();
int loc;
if (isTopBottomTabPlacement(tabs.getTabPlacement())) {
loc = c.getPreferredSize().height + tabAreaSize.height);
} else {
loc = c.getPreferredSize().width + tabAreaSize.width;
}
splitPane.setDividerLocation(loc);
}
References
No comments:
Post a Comment