TreeUI.
MetalTreeUI allows for configuring how to
visually render the spacing and delineation between nodes. The following
hints are supported:
| Hint | Description |
|---|---|
| Angled | A line is drawn connecting the child to the parent. For handling of
the root node refer to JTree#setRootVisible and
JTree#setShowsRootHandles.
|
| Horizontal | A horizontal line is drawn dividing the children of the root node. |
| None | Do not draw any visual indication between nodes. |
As it is typically impractical to obtain the TreeUI from
the JTree and cast to an instance of MetalTreeUI
you enable this property via the client property
JTree.lineStyle. For example, to switch to
Horizontal style you would do:
tree.putClientProperty("JTree.lineStyle", "Horizontal");
The default is Angled.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | MetalTreeUI.
This class listens for changes in line style |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final String | |
| private static final int | |
| private static final String | |
| private static final String | |
| private static Color | |
| private int | |
| private PropertyChangeListener | |
| private static final int | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static ComponentUI | Returns: the instance of theMetalTreeUIa component x)Hides javax. Constructs the |
| protected void | decodeLineStyle(Object
a flag lineStyleFlag)Converts between the string passed into the client property and the internal representation (currently and int) |
| protected int | getHorizontalLegBuffer()
Overrides javax. The horizontal element of legs between nodes starts at the right of the left-hand side of the child node by default. |
| public void | installUI(JComponent c)
Overrides javax. Configures the specified component appropriately for the look and feel. |
| protected boolean | Returns: true if a point with X coordinate mouseX
and Y coordinate mouseY is in expanded control.a row row, int a row level rowLevel, int X coordinate mouseX, int Y coordinate mouseY)Returns |
| public void | paint(Graphics g, JComponent c)
Overrides javax. Paints the specified component appropriately for the look and feel. |
| protected void | paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
Overrides javax. Paints the horizontal part of the leg. |
| protected void | paintHorizontalSeparators(Graphics
an instance of g, JComponent Graphicsa component c)Paints the horizontal separators. |
| protected void | paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
Overrides javax. Paints the vertical part of the leg. |
| public void | uninstallUI(JComponent c)
Overrides javax. Reverses configuration which was done on the specified component during
|
| HORIZ_LINE_STYLE | back to summary |
|---|---|
| private static final int HORIZ_LINE_STYLE | |
| HORIZ_STYLE_STRING | back to summary |
|---|---|
| private static final String HORIZ_STYLE_STRING | |
| LEG_LINE_STYLE | back to summary |
|---|---|
| private static final int LEG_LINE_STYLE | |
| LEG_LINE_STYLE_STRING | back to summary |
|---|---|
| private static final String LEG_LINE_STYLE_STRING | |
| LINE_STYLE | back to summary |
|---|---|
| private static final String LINE_STYLE | |
| lineColor | back to summary |
|---|---|
| private static Color lineColor | |
| lineStyle | back to summary |
|---|---|
| private int lineStyle | |
| lineStyleListener | back to summary |
|---|---|
| private PropertyChangeListener lineStyleListener | |
| NO_LINE_STYLE | back to summary |
|---|---|
| private static final int NO_LINE_STYLE | |
| NO_STYLE_STRING | back to summary |
|---|---|
| private static final String NO_STYLE_STRING | |
| MetalTreeUI | back to summary |
|---|---|
| public MetalTreeUI() Constructs the | |
| createUI | back to summary |
|---|---|
| public static ComponentUI createUI(JComponent x) Hides javax. Constructs the
| |
| decodeLineStyle | back to summary |
|---|---|
| protected void decodeLineStyle(Object lineStyleFlag) Converts between the string passed into the client property and the internal representation (currently and int)
| |
| getHorizontalLegBuffer | back to summary |
|---|---|
| protected int getHorizontalLegBuffer() Overrides javax. Doc from javax. The horizontal element of legs between nodes starts at the right of the left-hand side of the child node by default. This method makes the leg end before that. | |
| installUI | back to summary |
|---|---|
| public void installUI(JComponent c) Overrides javax. Doc from javax. Configures the specified component appropriately for the look and feel.
This method is invoked when the
| |
| isLocationInExpandControl | back to summary |
|---|---|
| protected boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY) Returns
| |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, JComponent c) Overrides javax. Doc from javax. Paints the specified component appropriately for the look and feel.
This method is invoked from the | |
| paintHorizontalPartOfLeg | back to summary |
|---|---|
| protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) Overrides javax. Doc from javax. Paints the horizontal part of the leg. The receiver should
NOT modify Note
| |
| paintHorizontalSeparators | back to summary |
|---|---|
| protected void paintHorizontalSeparators(Graphics g, JComponent c) Paints the horizontal separators.
| |
| paintVerticalPartOfLeg | back to summary |
|---|---|
| protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path) Overrides javax. Doc from javax. Paints the vertical part of the leg. The receiver should
NOT modify | |
| uninstallUI | back to summary |
|---|---|
| public void uninstallUI(JComponent c) Overrides javax. Doc from javax. Reverses configuration which was done on the specified component during
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | propertyChange(PropertyChangeEvent e)
Implements java. This method gets called when a bound property is changed. |
| LineListener | back to summary |
|---|---|
| pack-priv LineListener() | |
| propertyChange | back to summary |
|---|---|
| public void propertyChange(PropertyChangeEvent e) Implements java. Doc from java. This method gets called when a bound property is changed. | |