static void drawActiveButtonBorder(Graphics g, int x, int y, int w, int h) { drawFlush3DBorder(g, x, y, w, h); g.setColor(MetalLookAndFeel.getPrimaryControl()); g.drawLine(x + 1, y + 1, x + 1, h - 3); g.drawLine(x + 1, y + 1, w - 3, x + 1); g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow()); g.drawLine(x + 2, h - 2, w - 2, h - 2); g.drawLine(w - 2, y + 2, w - 2, h - 2); }
static void initLookAndFeel() { MetalLookAndFeel mlf = new MetalLookAndFeel(); mlf.setCurrentTheme(new SipCommunicatorColorTheme()); try { UIManager.setLookAndFeel(mlf); } catch (UnsupportedLookAndFeelException ex) { console.error("Failed to set custom look and feel", ex); } }
/** This draws the "Flush 3D Border" which is used throughout the Metal L&F */ static void drawFlush3DBorder(Graphics g, int x, int y, int w, int h) { g.translate(x, y); g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawRect(0, 0, w - 2, h - 2); g.setColor(MetalLookAndFeel.getControlHighlight()); g.drawRect(1, 1, w - 2, h - 2); g.setColor(MetalLookAndFeel.getControl()); g.drawLine(0, h - 1, 1, h - 2); g.drawLine(w - 1, 0, w - 2, 1); g.translate(-x, -y); }
static void drawDefaultButtonPressedBorder(Graphics g, int x, int y, int w, int h) { drawPressed3DBorder(g, x + 1, y + 1, w - 1, h - 1); g.translate(x, y); g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawRect(0, 0, w - 3, h - 3); g.drawLine(w - 2, 0, w - 2, 0); g.drawLine(0, h - 2, 0, h - 2); g.setColor(MetalLookAndFeel.getControl()); g.drawLine(w - 1, 0, w - 1, 0); g.drawLine(0, h - 1, 0, h - 1); g.translate(-x, -y); }
/** * This draws a variant "Flush 3D Border" It is used for things like active toggle buttons. This * is used rarely. */ static void drawDark3DBorder(Graphics g, int x, int y, int w, int h) { g.translate(x, y); drawFlush3DBorder(g, 0, 0, w, h); g.setColor(MetalLookAndFeel.getControl()); g.drawLine(1, 1, 1, h - 2); g.drawLine(1, 1, w - 2, 1); g.setColor(MetalLookAndFeel.getControlShadow()); g.drawLine(1, h - 2, 1, h - 2); g.drawLine(w - 2, 1, w - 2, 1); g.translate(-x, -y); }
static void drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active) { drawButtonBorder(g, x + 1, y + 1, w - 1, h - 1, active); g.translate(x, y); g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawRect(0, 0, w - 3, h - 3); g.drawLine(w - 2, 0, w - 2, 0); g.drawLine(0, h - 2, 0, h - 2); g.translate(-x, -y); }
static void drawDisabledBorder(Graphics g, int x, int y, int w, int h) { g.translate(x, y); g.setColor(MetalLookAndFeel.getControlShadow()); g.drawRect(0, 0, w - 1, h - 1); g.translate(-x, -y); }