3434import java .awt .Font ;
3535import java .awt .Graphics ;
3636import java .awt .Insets ;
37+ import java .awt .JSComponent ;
3738import java .awt .Rectangle ;
39+ import java .net .URL ;
3840
3941import javax .swing .Icon ;
42+ import javax .swing .ImageIcon ;
4043import javax .swing .JLabel ;
4144import javax .swing .JTree ;
4245import javax .swing .border .EmptyBorder ;
4346import javax .swing .plaf .ColorUIResource ;
4447import javax .swing .plaf .FontUIResource ;
4548
4649import sun .swing .DefaultLookup ;
50+ import swingjs .api .js .DOMNode ;
51+ import swingjs .plaf .JSLabelUI ;
4752
4853/**
4954 * Displays an entry in a tree.
@@ -161,7 +166,7 @@ public DefaultTreeCellRenderer() {
161166 drawDashedFocusIndicator = DefaultLookup .getBoolean (
162167 this , ui , "Tree.drawDashedFocusIndicator" , false );
163168
164- fillBackground = DefaultLookup .getBoolean (this , ui , "Tree.rendererFillBackground" , true );
169+ fillBackground = false ; // DefaultLookup.getBoolean(this, ui, "Tree.rendererFillBackground", true);
165170 Insets margins = DefaultLookup .getInsets (this , ui , "Tree.rendererMargins" );
166171 if (margins != null ) {
167172 setBorder (new EmptyBorder (margins .top , margins .left ,
@@ -172,28 +177,54 @@ public DefaultTreeCellRenderer() {
172177 }
173178
174179
180+ private static Icon defOpenIcon , defClosedIcon , defLeafIcon ;
175181 /**
176182 * Returns the default icon, for the current laf, that is used to
177183 * represent non-leaf nodes that are expanded.
178184 */
179185 public Icon getDefaultOpenIcon () {
180- return DefaultLookup .getIcon (this , ui , "Tree.openIcon" );
186+ // SwingJS
187+ return (defOpenIcon == null ? (defOpenIcon = newImageIcon ("open" )) : defOpenIcon );
188+ // return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
181189 }
182190
183- /**
191+ private Icon newImageIcon (String type ) {
192+ // SwingJS
193+ String f = null ;
194+ switch (type ) {
195+ case "open" :
196+ f = "TreeOpen.gif" ;
197+ break ;
198+ case "closed" :
199+ f = "TreeClosed.gif" ;
200+ break ;
201+ case "leaf" :
202+ f = "TreeLeaf.gif" ;
203+ break ;
204+ }
205+ URL resource = ui .getClass ().getResource (f );
206+ return new ImageIcon (resource , type );
207+ }
208+
209+ /**
184210 * Returns the default icon, for the current laf, that is used to
185211 * represent non-leaf nodes that are not expanded.
186212 */
187213 public Icon getDefaultClosedIcon () {
188- return DefaultLookup .getIcon (this , ui , "Tree.closedIcon" );
214+ // SwingJS
215+ return (defClosedIcon == null ? (defClosedIcon = newImageIcon ("closed" )) : defClosedIcon );
216+ // return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
189217 }
190218
191219 /**
192220 * Returns the default icon, for the current laf, that is used to
193221 * represent leaf nodes.
194222 */
195223 public Icon getDefaultLeafIcon () {
196- return DefaultLookup .getIcon (this , ui , "Tree.leafIcon" );
224+ // SwingJS
225+ return null ;
226+ // return (defLeafIcon == null ? (defLeafIcon = newImageIcon("leaf")) : defLeafIcon);
227+ // return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
197228 }
198229
199230 /**
0 commit comments