mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 23:37:13 -06:00
Tree implementation
This commit is contained in:
@@ -246,7 +246,8 @@ public abstract class FlatLaf
|
|||||||
return parseInstance( value );
|
return parseInstance( value );
|
||||||
|
|
||||||
// insets
|
// insets
|
||||||
if( key.endsWith( ".margin" ) || key.endsWith( ".padding" ) || key.endsWith( "Insets" ) )
|
if( key.endsWith( ".margin" ) || key.endsWith( ".padding" ) ||
|
||||||
|
key.endsWith( "Margins" ) || key.endsWith( "Insets" ) )
|
||||||
return parseInsets( value );
|
return parseInsets( value );
|
||||||
|
|
||||||
// size
|
// size
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 FormDev Software GmbH
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.formdev.flatlaf.ui;
|
||||||
|
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.LookAndFeel;
|
||||||
|
import javax.swing.plaf.ComponentUI;
|
||||||
|
import javax.swing.plaf.basic.BasicTreeUI;
|
||||||
|
import com.formdev.flatlaf.util.UIScale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the Flat LaF UI delegate for {@link javax.swing.JTree}.
|
||||||
|
*
|
||||||
|
* TODO document used UI defaults of superclass
|
||||||
|
*
|
||||||
|
* @uiDefault Tree.border Border
|
||||||
|
*
|
||||||
|
* @author Karl Tauber
|
||||||
|
*/
|
||||||
|
public class FlatTreeUI
|
||||||
|
extends BasicTreeUI
|
||||||
|
{
|
||||||
|
public static ComponentUI createUI( JComponent c ) {
|
||||||
|
return new FlatTreeUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void installDefaults() {
|
||||||
|
super.installDefaults();
|
||||||
|
|
||||||
|
LookAndFeel.installBorder( tree, "Tree.border" );
|
||||||
|
|
||||||
|
// scale
|
||||||
|
int rowHeight = FlatUIUtils.getUIInt( "Tree.rowHeight", 16 );
|
||||||
|
if( rowHeight > 0 )
|
||||||
|
LookAndFeel.installProperty( tree, "rowHeight", UIScale.scale( rowHeight ) );
|
||||||
|
setLeftChildIndent( UIScale.scale( getLeftChildIndent() ) );
|
||||||
|
setRightChildIndent( UIScale.scale( getRightChildIndent() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void uninstallDefaults() {
|
||||||
|
super.uninstallDefaults();
|
||||||
|
|
||||||
|
LookAndFeel.uninstallBorder( tree );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
@selectionForeground=@foreground
|
@selectionForeground=@foreground
|
||||||
@disabledText=777777
|
@disabledText=777777
|
||||||
@textComponentBackground=45494A
|
@textComponentBackground=45494A
|
||||||
|
@cellFocusColor=000000
|
||||||
@icon=adadad
|
@icon=adadad
|
||||||
|
|
||||||
|
|
||||||
@@ -173,7 +174,6 @@ TabbedPane.contentAreaColor=323232
|
|||||||
|
|
||||||
Table.background=@textComponentBackground
|
Table.background=@textComponentBackground
|
||||||
Table.gridColor=4F5152
|
Table.gridColor=4F5152
|
||||||
Table.focusSelectedCellHighlightBorder=2,3,2,3,78c0ff
|
|
||||||
|
|
||||||
|
|
||||||
#---- TableHeader ----
|
#---- TableHeader ----
|
||||||
@@ -185,3 +185,5 @@ TableHeader.bottomSeparatorColor=585858
|
|||||||
|
|
||||||
#---- Tree ----
|
#---- Tree ----
|
||||||
|
|
||||||
|
Tree.background=@textComponentBackground
|
||||||
|
Tree.hash=505355
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ TableHeaderUI=com.formdev.flatlaf.ui.FlatTableHeaderUI
|
|||||||
TextAreaUI=com.formdev.flatlaf.ui.FlatTextAreaUI
|
TextAreaUI=com.formdev.flatlaf.ui.FlatTextAreaUI
|
||||||
TextFieldUI=com.formdev.flatlaf.ui.FlatTextFieldUI
|
TextFieldUI=com.formdev.flatlaf.ui.FlatTextFieldUI
|
||||||
TextPaneUI=com.formdev.flatlaf.ui.FlatTextPaneUI
|
TextPaneUI=com.formdev.flatlaf.ui.FlatTextPaneUI
|
||||||
|
TreeUI=com.formdev.flatlaf.ui.FlatTreeUI
|
||||||
|
|
||||||
|
|
||||||
#---- variables ----
|
#---- variables ----
|
||||||
@@ -99,8 +100,8 @@ FormattedTextField.margin=@textComponentMargin
|
|||||||
#---- List ----
|
#---- List ----
|
||||||
|
|
||||||
List.cellNoFocusBorder=1,6,1,6
|
List.cellNoFocusBorder=1,6,1,6
|
||||||
List.focusCellHighlightBorder=1,6,1,6,@selectionBackground
|
List.focusCellHighlightBorder=1,6,1,6,@cellFocusColor
|
||||||
List.focusSelectedCellHighlightBorder=1,6,1,6,@selectionBackground
|
List.focusSelectedCellHighlightBorder=1,6,1,6,@cellFocusColor
|
||||||
|
|
||||||
|
|
||||||
#---- Menu ----
|
#---- Menu ----
|
||||||
@@ -225,7 +226,7 @@ Table.ascendingSortIcon=com.formdev.flatlaf.icons.FlatAscendingSortIcon
|
|||||||
Table.descendingSortIcon=com.formdev.flatlaf.icons.FlatDescendingSortIcon
|
Table.descendingSortIcon=com.formdev.flatlaf.icons.FlatDescendingSortIcon
|
||||||
Table.sortIconColor=@icon
|
Table.sortIconColor=@icon
|
||||||
Table.cellNoFocusBorder=2,3,2,3
|
Table.cellNoFocusBorder=2,3,2,3
|
||||||
Table.focusSelectedCellHighlightBorder=2,3,2,3,@foreground
|
Table.focusSelectedCellHighlightBorder=2,3,2,3,@cellFocusColor
|
||||||
|
|
||||||
|
|
||||||
#---- TableHeader ----
|
#---- TableHeader ----
|
||||||
@@ -256,6 +257,15 @@ TextPane.margin=@textComponentMargin
|
|||||||
|
|
||||||
#---- Tree ----
|
#---- Tree ----
|
||||||
|
|
||||||
|
Tree.border=1,1,1,1
|
||||||
|
Tree.textBackground=@@Tree.background
|
||||||
|
Tree.selectionBorderColor=@cellFocusColor
|
||||||
|
Tree.rendererMargins=1,2,1,2
|
||||||
|
Tree.paintLines=false
|
||||||
|
Tree.leftChildIndent=7
|
||||||
|
Tree.rightChildIndent=11
|
||||||
|
Tree.rowHeight=0
|
||||||
|
|
||||||
Tree.expandedIcon=com.formdev.flatlaf.icons.FlatTreeExpandedIcon
|
Tree.expandedIcon=com.formdev.flatlaf.icons.FlatTreeExpandedIcon
|
||||||
Tree.collapsedIcon=com.formdev.flatlaf.icons.FlatTreeCollapsedIcon
|
Tree.collapsedIcon=com.formdev.flatlaf.icons.FlatTreeCollapsedIcon
|
||||||
Tree.leafIcon=com.formdev.flatlaf.icons.FlatTreeLeafIcon
|
Tree.leafIcon=com.formdev.flatlaf.icons.FlatTreeLeafIcon
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
@selectionForeground=ffffff
|
@selectionForeground=ffffff
|
||||||
@disabledText=999999
|
@disabledText=999999
|
||||||
@textComponentBackground=ffffff
|
@textComponentBackground=ffffff
|
||||||
|
@cellFocusColor=000000
|
||||||
@icon=afafaf
|
@icon=afafaf
|
||||||
|
|
||||||
|
|
||||||
@@ -184,3 +185,5 @@ TableHeader.bottomSeparatorColor=e5e5e5
|
|||||||
|
|
||||||
#---- Tree ----
|
#---- Tree ----
|
||||||
|
|
||||||
|
Tree.background=@textComponentBackground
|
||||||
|
Tree.hash=E6E6E6
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
@background=ccffcc
|
@background=ccffcc
|
||||||
@selectionBackground=00aa00
|
@selectionBackground=00aa00
|
||||||
@textComponentBackground=ffffff
|
@textComponentBackground=ffffff
|
||||||
|
@cellFocusColor=ff0000
|
||||||
@icon=afafaf
|
@icon=afafaf
|
||||||
|
|
||||||
|
|
||||||
@@ -197,3 +198,6 @@ TableHeader.bottomSeparatorColor=00ff00
|
|||||||
|
|
||||||
#---- Tree ----
|
#---- Tree ----
|
||||||
|
|
||||||
|
Tree.background=fff0ff
|
||||||
|
Tree.paintLines=true
|
||||||
|
Tree.hash=ff0000
|
||||||
|
|||||||
Reference in New Issue
Block a user