1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| public class DegradClassJtree extends JTree {
public void paintComponent(Graphics g,Color JTree) {
Graphics2D g2 = (Graphics2D)g;
// GradientPaint grad = new GradientPaint(0,0, Color.white,
// 250,50,Color.white);
GradientPaint grad = new GradientPaint(0,0, Color.GREEN,
1550,1250,Color.white);
g2.setPaint(grad);
g2.fillRect(0,0, 1550,1250);
// GradientPaint grad1 = new GradientPaint(250,50,Color.blue,
// 500f,245f,Color.WHITE,true);
GradientPaint grad1 = new GradientPaint(550,250,Color.LIGHT_GRAY,
2100,1500,Color.CYAN,true);
g2.setPaint(grad1);
g2.fillRect(0,0, 1550,1250);
}
public void Test() {
DefaultTreeCellRenderer Norenderer = new DefaultTreeCellRenderer();
JTree Jtree1 = new JTree();
Norenderer.setBackgroundNonSelectionColor(Jtree1);
Norenderer.setBackground(Color.BLACK);
setCellRenderer(Norenderer);
Jtree1.setCellRenderer(Norenderer);
}
} |
Partager