Thanks, but no luck. Didn't see any menthod in JTabbedPane called
setOrientation(...)
I did find this:
jTabbedPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
jTabbedPane.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
But, this didn't work either.
Chris
> Thanks, but no luck. Didn't see any menthod in JTabbedPane called
> setOrientation(...)
>
> I did find this:
jTabbedPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
jTabbedPane.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
yes setComponentOrientation ir right one.
> But, this didn't work either.
then you have to write your own AlignedTabbedPaneUI:
public class AlignedTabbedPaneUI extends BasicTabbedPaneUI {
public static ComponentUI createUI(JComponent c) {
return new AlignedTabbedPaneUI ();
}
protected void layoutLabel(int tabPlacement,
FontMetrics metrics, int tabIndex,
String title, Icon icon,
Rectangle tabRect, Rectangle iconRect,
Rectangle textRect, boolean isSelected ) {
textRect.x = textRect.y = iconRect.x = iconRect.y = 0;
SwingUtilities.layoutCompoundLabel((JComponent) tabPane,
metrics, title, icon,
SwingUtilities.CENTER,
SwingUtilities.LEADING, //changed
from CENTER to LEADING
SwingUtilities.CENTER,
SwingUtilities.TRAILING,
tabRect,
iconRect,
textRect,
textIconGap);
int xNudge = getTabLabelShiftX(tabPlacement, tabIndex, isSelected);
int yNudge = getTabLabelShiftY(tabPlacement, tabIndex, isSelected);
iconRect.x += xNudge;
iconRect.y += yNudge;
textRect.x += xNudge;
textRect.y += yNudge;
}
}
____________
http://reader.imagero.com the best java image reader.
Chris Gokey - 03 Jan 2004 20:23 GMT
That worked! Looking at this class, it seems like you can have a lot of
control over the layout of the tabs once you study how it puts thing
together.
Thanks again.
Chris
>> Thanks, but no luck. Didn't see any menthod in JTabbedPane called
>> setOrientation(...)
[quoted text clipped - 48 lines]
>
> http://reader.imagero.com the best java image reader.
--
ak - 03 Jan 2004 20:53 GMT
> That worked! Looking at this class, it seems like you can have a lot of
> control over the layout of the tabs once you study how it puts thing
> together.
To hardcode text align is just a mistake.
Such things are _properties_ and should be accessible without writing new
ComponentUI.
____________
http://reader.imagero.com the best java image reader.