KidsLovePC Contact Us
  Home   PHP  Graphics ASP  JavaScript   HTML  JAVA   Swing   Webtip  Lyric  Free sheet music  Ringtones
java,jtable,jtree,swing Return to JAVA JTree list

Best books about JAVA programming:

JAVA JTree Diabled icon

The following code disable JTree node dynamically. Disabled icon has different icons assigned. This example has three files: DisabledNodeTreeExample.java,DisabledNode.java, GraydIcon.java, DisabledLeafIcon.java, DisabledFolderIcon.java

/*Example modified from http://www.crionics.com/products/opensource/faq/swing_ex/JTableExamples2.html
*/



import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.metal.*;

public class DisabledLeafIcon implements Icon {
int width = 16;
int height = 16;
int additionalHeight = 4;

public void paintIcon(Component c, Graphics g, int x, int y) {
int right = width - 1;
int bottom = height + 1;

g.setColor(c.getBackground());
g.fillRect(0,0, width, getIconHeight());

// Draw frame
g.setColor( MetalLookAndFeel.getControlDisabled() );
g.drawLine( 2, 2, 2, bottom ); // left
g.drawLine( 2, 2, right -4, 2 ); // top
g.drawLine( 2,bottom, right -1, bottom ); // bottom
g.drawLine( right -1, 8, right -1, bottom ); // right
g.drawLine( right -6, 4, right -2, 8 ); // slant 1
g.drawLine( right -5, 3, right -4, 3 ); // part of slant 2
g.drawLine( right -3, 4, right -3, 5 ); // part of slant 2
g.drawLine( right -2, 6, right -2, 7 ); // part of slant 2
}

public int getIconWidth() { return width; }
public int getIconHeight() { return height + additionalHeight; }
}

 

 

 


 


Sponsored link
Java JTabbedPane
JTabbedPane Preview List
Java JComboBox
JComboBox Preview List
Java JTooltip
JTooltip Preview List
Java JList
JList Preview List
Java JTree
JTree Preview List 1
JTree Preview List 2
JAVA JTable
JTable Preview List 1
JTable Preview List 2
JTable Preview List 3
JTable Preview List 4
JTable Preview List 5
JTable Preview List 6
JTable Preview List 7
JAVA Jslide
JSlide Preview List

 

 

Best books about JAVA programming from Amazon
Professional Java, JDK 5 Edition (Paperback Simply Java Programming: An Application-Driven Tutorial Approach (Paperback) Effective Java Programming Language Guide (Paperback) Head First Java, 2nd Edition (Paperback) Java : An Introduction to Problem Solving and Programming (4th Edition)

 

Printer Inkjet A Z lyricsLearn ChineseHome|PHP|Swing|HTML|JavaScript|ASP|JAVA|Forum|WebTip|Contact Us
Copyright © kidslovepc.com All rights reserved(new). Privacy|Copyright
designed by info@kidslovepc.com

Please help us cover the web site maintenance fee.
barcode scanner Thermal Printer credit card machine bar code printer