1 14 package org.compiere.plaf; 15 16 import java.awt.Graphics ; 17 import java.awt.Graphics2D ; 18 19 import javax.swing.AbstractButton ; 20 import javax.swing.ButtonModel ; 21 import javax.swing.JComponent ; 22 import javax.swing.plaf.ComponentUI ; 23 import javax.swing.plaf.metal.MetalButtonUI ; 24 25 31 public class CompiereButtonUI extends MetalButtonUI 32 { 33 38 public static ComponentUI createUI (JComponent c) 39 { 40 return s_buttonUI; 41 } 43 44 private static CompiereButtonUI s_buttonUI = new CompiereButtonUI(); 45 46 47 48 52 public void installDefaults(AbstractButton b) 53 { 54 super.installDefaults(b); 55 b.setOpaque(false); 56 } 58 73 public void update(Graphics g, JComponent c) 74 { 75 if (c.isOpaque()) 77 CompiereUtils.fillRectange((Graphics2D )g, c, CompiereLookAndFeel.ROUND); 78 paint (g, c); 79 } 81 86 public void paint (Graphics g, JComponent c) 87 { 88 super.paint( g, c); 89 AbstractButton b = (AbstractButton ) c; 90 ButtonModel model = b.getModel(); 91 boolean in = model.isPressed() || model.isSelected(); 92 if (b.isBorderPainted()) 94 CompiereUtils.paint3Deffect((Graphics2D )g, c, CompiereLookAndFeel.ROUND, !in); 95 } 97 102 protected void paintButtonPressed(Graphics g, AbstractButton b) 103 { 104 } 112 } | Popular Tags |