diff --git a/.gitattributes b/.gitattributes index 699751bb..3ab79411 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,4 +18,5 @@ *.gif binary *.jar binary *.png binary +*.sketch binary *.zip binary diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeClosedIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeClosedIcon.java new file mode 100644 index 00000000..292807d4 --- /dev/null +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeClosedIcon.java @@ -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 ) { + /* + + + + */ + + 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 ); + } +} diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeLeafIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeLeafIcon.java new file mode 100644 index 00000000..21b01dc9 --- /dev/null +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeLeafIcon.java @@ -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 ) { + /* + + + + + + + */ + + 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 ); + } +} diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeOpenIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeOpenIcon.java new file mode 100644 index 00000000..9f022db7 --- /dev/null +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeOpenIcon.java @@ -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 ) { + /* + + + + + + + */ + + 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 ); + } +} diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index d9560bd3..6fa474e6 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -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 diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index c8e23ba2..eb0bce58 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -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 diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index e92e5dde..52483fff 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -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 diff --git a/flatlaf-core/src/test/resources/com/formdev/flatlaf/FlatTestLaf.properties b/flatlaf-core/src/test/resources/com/formdev/flatlaf/FlatTestLaf.properties index f161ea7d..db8a8f38 100644 --- a/flatlaf-core/src/test/resources/com/formdev/flatlaf/FlatTestLaf.properties +++ b/flatlaf-core/src/test/resources/com/formdev/flatlaf/FlatTestLaf.properties @@ -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 diff --git a/flatlaf-core/svg/FlatLaf Icons.sketch b/flatlaf-core/svg/FlatLaf Icons.sketch new file mode 100644 index 00000000..6193699f Binary files /dev/null and b/flatlaf-core/svg/FlatLaf Icons.sketch differ diff --git a/flatlaf-core/svg/TreeClosedIcon.svg b/flatlaf-core/svg/TreeClosedIcon.svg new file mode 100644 index 00000000..5ea459f4 --- /dev/null +++ b/flatlaf-core/svg/TreeClosedIcon.svg @@ -0,0 +1,3 @@ + + + diff --git a/flatlaf-core/svg/TreeLeafIcon.svg b/flatlaf-core/svg/TreeLeafIcon.svg new file mode 100644 index 00000000..8f3665f5 --- /dev/null +++ b/flatlaf-core/svg/TreeLeafIcon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/flatlaf-core/svg/TreeOpenIcon.svg b/flatlaf-core/svg/TreeOpenIcon.svg new file mode 100644 index 00000000..a694e804 --- /dev/null +++ b/flatlaf-core/svg/TreeOpenIcon.svg @@ -0,0 +1,6 @@ + + + + + +