From c6ca9a48d262bd12120bc312a1cb24c45e106c42 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 30 Aug 2019 09:10:34 +0200 Subject: [PATCH] Tree: leafIcon, closedIcon and openIcon added --- .gitattributes | 1 + .../flatlaf/icons/FlatTreeClosedIcon.java | 56 +++++++++++++++ .../flatlaf/icons/FlatTreeLeafIcon.java | 66 +++++++++++++++++ .../flatlaf/icons/FlatTreeOpenIcon.java | 68 ++++++++++++++++++ .../formdev/flatlaf/FlatDarkLaf.properties | 3 +- .../com/formdev/flatlaf/FlatLaf.properties | 9 +++ .../formdev/flatlaf/FlatLightLaf.properties | 3 +- .../formdev/flatlaf/FlatTestLaf.properties | 3 +- flatlaf-core/svg/FlatLaf Icons.sketch | Bin 0 -> 3809 bytes flatlaf-core/svg/TreeClosedIcon.svg | 3 + flatlaf-core/svg/TreeLeafIcon.svg | 6 ++ flatlaf-core/svg/TreeOpenIcon.svg | 6 ++ 12 files changed, 218 insertions(+), 6 deletions(-) create mode 100644 flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeClosedIcon.java create mode 100644 flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeLeafIcon.java create mode 100644 flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatTreeOpenIcon.java create mode 100644 flatlaf-core/svg/FlatLaf Icons.sketch create mode 100644 flatlaf-core/svg/TreeClosedIcon.svg create mode 100644 flatlaf-core/svg/TreeLeafIcon.svg create mode 100644 flatlaf-core/svg/TreeOpenIcon.svg 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 0000000000000000000000000000000000000000..6193699ff0da649703fa48d1674dff55b7e9659f GIT binary patch literal 3809 zcmb7HcTiK?_6{ID^bQ(C1nDId=~6;7fJl%c5eX0}3eu5Yq)3t8JBakAp@Z~}iqb+6 z3j{DA{Yrok_{Dqg@4dOsdw;xrW}kKT%>MSw`PN!{t}ga>O@I#4rP_GAU{v`%|6 ztMs`;`k$mszGXlOQRQ9syvJHh>nN)P7o!^}WpunV&YpQwxHLBU-LWlXHr8COY{6n_ zSIz>wxSzw*oY)o=!j&K|xG6FePv}|Yu_nz{3r-^^j14|4JjGB{lDC-BPqGT0S}PSS4mcxOu_moNBB5^yZo1 zx%@m(`|iTPc$EF+G-pz+wCkhMgFhQI(VcK!G{{AW3A{4dHS)P|Yf5Wti_2=rOG|6Z%R#i{rT_H7mX(#~i&o|{QJ9LA1hqcZ+Vf4< zDsTrZJI_y1u1Pzd8O8UNG;iEswY!kr21p-+QcxT%vw;J@Pj0w+SL0JhB)96dnb{)` zEv+IsOmdxWADa6dw!qVLL997%53-T-&ra&%EWUyv(RbX?}DGA{4CdO^Av2V-QQe)cg|u za>Mh>COY}yJMK({0zHA*^+^70cX-;_mWY7{Pr0wC<*PKaE6(>3lWLV*#yh%lA>wUt z_Pq&(H*VK$$@(dlGFk@qYaW%=&Qzq1@9sk_;O)@wb1874+eOt?$0^$0IHW~u{(iIj z?au-PzY3^L*VK1t*8Q9{YHCH%VxHuup>e(fj-I+hiOztK7!dHH8hV zM9SoQsZnr0<;)Ux+OR#}pn@qJOX~aM3Kx}imYYF#q!^{uGxudaC?hZ8=Qj1CKr^8? zoP*Em79zboY3$Y?IIO_6{5HI=b^}T*5tLGN!~NFidm(F1V&NVLcCXTDFXa&!rlRagE4wca|(}Cf!;C zaJY4Ck^AlX>0I0$iYOmuoxOH947f7^?wz^%GE-lPe-zBe0*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%M_ct$#;<$J|oY>Zt-0q@AJnb-0vO(>P{RHG zx_5hAxf;;W8UM{k=KLAd^V)36cBX7}^jwN~|0RUx2mi)uLb~e3F6*7{ClEOpa6DG= z9Buh=I8O3P+`IPHuAM}oinis!j=VGFwZeC&s$}e~L#J~S&>YaK)^Y4wCauRo^Hh1^ zUtR+IEe9k?#G^EcUQ#7a)?dx42hzt0>FX)^_lJa=s{@HDN#9wFv5_tv4L1#O51qaq z#Dr+oiIb6vg7_|5_Y)=>5>FFdO+elIi&)|Urw`FEwV+-#@1=iw890dKXd7dzKRaJP zV(|ajzV*t6-CV?RA$k77iw|nnyzGsBop0fD+vhoWm5H)VC7Fa3^Voi=njj6p*r*~0 zz-)r$`s9(7vtDpcnb=v2i(4QCAhgtg=7wP5c&<1}5(GNGUY)l8?L_gEf9~bzQyx)( zZr70Xw94I>N}3P2H%^Pq5%-fNo6tWEJi@t_%fqXZBa_VFaJhq*D!5_HA8* zJkyA8tfXQz53$Vn5y;4IDUtjv7SL3u1~Fy=u*|fcIFn9W;PpW4Mq&KCmv(kLtN$=6 z7!E%)5hd|I`GS)-Kfe@AD*XU<9U!)Lmq-CXU)u;$r)d*z3?(6E!G9NFzxEOx@b~zK zB>NruySn&=`3q`GH2Aq?0mzAu9`Sdd{!*}j{{zR@p^g9m literal 0 HcmV?d00001 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 @@ + + + + + +