Exemple #1
0
 public void paintThumb(Graphics g) {
   Icon icon = null;
   if (slider.getOrientation() == JSlider.HORIZONTAL) {
     if (isRollover && slider.isEnabled()) {
       icon = getThumbHorIconRollover();
     } else {
       icon = getThumbHorIcon();
     }
   } else {
     if (isRollover && slider.isEnabled()) {
       icon = getThumbVerIconRollover();
     } else {
       icon = getThumbVerIcon();
     }
   }
   Graphics2D g2D = (Graphics2D) g;
   Composite savedComposite = g2D.getComposite();
   if (!slider.isEnabled()) {
     g.setColor(AbstractLookAndFeel.getBackgroundColor());
     g.fillRect(thumbRect.x + 1, thumbRect.y + 1, thumbRect.width - 2, thumbRect.height - 2);
     AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
     g2D.setComposite(alpha);
   }
   icon.paintIcon(null, g, thumbRect.x, thumbRect.y);
   g2D.setComposite(savedComposite);
 }
Exemple #2
0
 public void paintBackground(Graphics g, JComponent c) {
   if (c.isOpaque()) {
     if (c.getBackground() instanceof ColorUIResource) {
       g.setColor(AbstractLookAndFeel.getBackgroundColor());
     } else {
       g.setColor(c.getBackground());
     }
     g.fillRect(0, 0, c.getWidth(), c.getHeight());
   }
 }
Exemple #3
0
 public void paint(Graphics g, JComponent c) {
   boolean horizontal = true;
   if (c instanceof JSeparator) {
     horizontal = (((JSeparator) c).getOrientation() == JSeparator.HORIZONTAL);
   }
   if (horizontal) {
     int w = c.getWidth();
     g.setColor(AbstractLookAndFeel.getBackgroundColor());
     g.drawLine(0, 0, w, 0);
     g.setColor(ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30));
     g.drawLine(0, 1, w, 1);
     g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getBackgroundColor(), 50));
     g.drawLine(0, 2, w, 2);
   } else {
     int h = c.getHeight();
     g.setColor(ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30));
     g.drawLine(0, 0, 0, h);
     g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getBackgroundColor(), 50));
     g.drawLine(1, 0, 1, h);
   }
 }