Tree: leafIcon, closedIcon and openIcon added

This commit is contained in:
Karl Tauber
2019-08-30 09:10:34 +02:00
parent 9eabaaef64
commit c6ca9a48d2
12 changed files with 218 additions and 6 deletions

1
.gitattributes vendored
View File

@@ -18,4 +18,5 @@
*.gif binary
*.jar binary
*.png binary
*.sketch binary
*.zip binary

View File

@@ -0,0 +1,56 @@
/*
* 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.icons;
import java.awt.Component;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;
import javax.swing.UIManager;
/**
* "closed" icon for {@link javax.swing.JTree} used by {@link javax.swing.tree.DefaultTreeCellRenderer}.
*
* @uiDefault Tree.icon.closedColor Color
*
* @author Karl Tauber
*/
public class FlatTreeClosedIcon
extends FlatAbstractIcon
{
public FlatTreeClosedIcon() {
super( 16, 16, UIManager.getColor( "Tree.icon.closedColor" ) );
}
@Override
protected void paintIcon( Component c, Graphics2D g ) {
/*
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#D8D8D8" fill-rule="evenodd" d="M1 2L6 2 8 4 15 4 15 13 1 13z"/>
</svg>
*/
Path2D arrow = new Path2D.Float();
arrow.moveTo( 1, 2 );
arrow.lineTo( 6, 2 );
arrow.lineTo( 8, 4 );
arrow.lineTo( 15, 4 );
arrow.lineTo( 15, 13 );
arrow.lineTo( 1, 13 );
arrow.closePath();
g.fill( arrow );
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.icons;
import java.awt.Component;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;
import javax.swing.UIManager;
/**
* "leaf" icon for {@link javax.swing.JTree} used by {@link javax.swing.tree.DefaultTreeCellRenderer}.
*
* @uiDefault Tree.icon.leafColor Color
*
* @author Karl Tauber
*/
public class FlatTreeLeafIcon
extends FlatAbstractIcon
{
public FlatTreeLeafIcon() {
super( 16, 16, UIManager.getColor( "Tree.icon.leafColor" ) );
}
@Override
protected void paintIcon( Component c, Graphics2D g ) {
/*
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path fill="#D8D8D8" d="M8 6L8 1 13 1 13 15 3 15 3 6z"/>
<path fill="#D8D8D8" d="M3 5L7 5 7 1z"/>
</g>
</svg>
*/
Path2D arrow = new Path2D.Float();
arrow.moveTo( 8, 6 );
arrow.lineTo( 8, 1 );
arrow.lineTo( 13, 1 );
arrow.lineTo( 13, 15 );
arrow.lineTo( 3, 15 );
arrow.lineTo( 3, 6 );
arrow.closePath();
g.fill( arrow );
arrow = new Path2D.Float();
arrow.moveTo( 3, 5 );
arrow.lineTo( 7, 5 );
arrow.lineTo( 7, 1 );
arrow.closePath();
g.fill( arrow );
}
}

View File

@@ -0,0 +1,68 @@
/*
* 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.icons;
import java.awt.Component;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;
import javax.swing.UIManager;
/**
* "open" icon for {@link javax.swing.JTree} used by {@link javax.swing.tree.DefaultTreeCellRenderer}.
*
* @uiDefault Tree.icon.openColor Color
*
* @author Karl Tauber
*/
public class FlatTreeOpenIcon
extends FlatAbstractIcon
{
public FlatTreeOpenIcon() {
super( 16, 16, UIManager.getColor( "Tree.icon.openColor" ) );
}
@Override
protected void paintIcon( Component c, Graphics2D g ) {
/*
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path fill="#D8D8D8" d="M1 2L6 2 8 4 14 4 14 6 3.5 6 1 11z"/>
<path fill="#D8D8D8" d="M4 7L16 7 13 13 1 13z"/>
</g>
</svg>
*/
Path2D arrow = new Path2D.Float();
arrow.moveTo( 1, 2 );
arrow.lineTo( 6, 2 );
arrow.lineTo( 8, 4 );
arrow.lineTo( 14, 4 );
arrow.lineTo( 14, 6 );
arrow.lineTo( 3.5, 6 );
arrow.lineTo( 1, 11 );
arrow.closePath();
g.fill( arrow );
arrow = new Path2D.Float();
arrow.moveTo( 4, 7 );
arrow.lineTo( 16, 7 );
arrow.lineTo( 13, 13 );
arrow.lineTo( 1, 13 );
arrow.closePath();
g.fill( arrow );
}
}

View File

@@ -24,6 +24,7 @@
@foreground=bbbbbb
@disabledText=777777
@textComponentBackground=45494A
@icon=adadad
#---- globals ----
@@ -144,5 +145,3 @@ TabbedPane.contentAreaColor=323232
#---- Tree ----
Tree.icon.expandedColor=adadad
Tree.icon.collapsedColor=adadad

View File

@@ -174,3 +174,12 @@ TextPane.margin=@textComponentMargin
Tree.expandedIcon=com.formdev.flatlaf.icons.FlatTreeExpandedIcon
Tree.collapsedIcon=com.formdev.flatlaf.icons.FlatTreeCollapsedIcon
Tree.leafIcon=com.formdev.flatlaf.icons.FlatTreeLeafIcon
Tree.closedIcon=com.formdev.flatlaf.icons.FlatTreeClosedIcon
Tree.openIcon=com.formdev.flatlaf.icons.FlatTreeOpenIcon
Tree.icon.expandedColor=@icon
Tree.icon.collapsedColor=@icon
Tree.icon.leafColor=@icon
Tree.icon.closedColor=@icon
Tree.icon.openColor=@icon

View File

@@ -24,6 +24,7 @@
@foreground=000000
@disabledText=999999
@textComponentBackground=ffffff
@icon=afafaf
#---- globals ----
@@ -144,5 +145,3 @@ TabbedPane.contentAreaColor=bfbfbf
#---- Tree ----
Tree.icon.expandedColor=afafaf
Tree.icon.collapsedColor=afafaf

View File

@@ -18,6 +18,7 @@
@background=ccffcc
@textComponentBackground=ffffff
@icon=afafaf
#---- globals ----
@@ -138,5 +139,3 @@ TabbedPane.contentAreaColor=bbbbbb
#---- Tree ----
Tree.icon.expandedColor=ad00ad
Tree.icon.collapsedColor=00adad

Binary file not shown.

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#D8D8D8" fill-rule="evenodd" d="M1 2L6 2 8 4 15 4 15 13 1 13z"/>
</svg>

After

Width:  |  Height:  |  Size: 170 B

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path fill="#D8D8D8" d="M8 6L8 1 13 1 13 15 3 15 3 6z"/>
<path fill="#D8D8D8" d="M3 5L7 5 7 1z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 242 B

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path fill="#D8D8D8" d="M1 2L6 2 8 4 14 4 14 6 3.5 6 1 11z"/>
<path fill="#D8D8D8" d="M4 7L16 7 13 13 1 13z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 255 B