Refine search
/** * Draws a single-line highlight border rectangle. * * @param g The graphics context to use for drawing. * @param x The left edge of the border. * @param y The top edge of the border. * @param width The width of the border. * @param height The height of the border. * @param raised <code>true</code> if the border is to be drawn raised, * <code>false</code> if lowered. * @param shadow The shadow color for the border. * @param highlight The highlight color for the border. * @see javax.swing.border.EtchedBorder * @see javax.swing.plaf.basic.BasicGraphicsUtils#drawEtchedRect */ public static void drawHighlightBorder(Graphics g, int x, int y, int width, int height, boolean raised, Color shadow, Color highlight) { final Color oldColor = g.getColor(); g.translate(x, y); g.setColor(raised ? highlight : shadow); g.drawLine(0, 0, width - 2, 0); g.drawLine(0, 1, 0, height - 2); g.setColor(raised ? shadow : highlight); g.drawLine(width - 1, 0, width - 1, height - 1); g.drawLine(0, height - 1, width - 2, height - 1); g.translate(-x, -y); g.setColor(oldColor); }
public void paintIcon(Component component, Graphics g, int x, int y) { g.setColor(color); g.translate(x, y); if (direction == NORTH) { } else if (direction == SOUTH) { g.drawLine(0, 1, 14, 1); g.drawLine(1, 2, 13, 2); g.drawLine(2, 3, 4, 3); g.drawLine(6, 3, 8, 3); g.drawLine(10, 3, 12, 3); g.drawLine(3, 4, 3, 4); g.drawLine(7, 4, 7, 4); g.drawLine(11, 4, 11, 4); } g.translate(-x, -y); }
public void paintIcon(Component component, Graphics g, int x, int y) { g.setColor(color); g.translate(x, y); if (direction == NORTH) { } else if (direction == SOUTH) { g.drawLine(0, 1, 14, 1); g.drawLine(1, 2, 13, 2); g.drawLine(2, 3, 4, 3); g.drawLine(6, 3, 8, 3); g.drawLine(10, 3, 12, 3); g.drawLine(3, 4, 3, 4); g.drawLine(7, 4, 7, 4); g.drawLine(11, 4, 11, 4); } 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); }
/** * This draws a variant "Flush 3D Border" * It is used for things like pressed buttons. */ static void drawPressed3DBorder(Graphics g, int x, int y, int w, int h) { g.translate( x, y); drawFlush3DBorder(g, 0, 0, w, h); g.setColor( MetalLookAndFeel.getControlShadow() ); g.drawLine( 1, 1, 1, h-2 ); g.drawLine( 1, 1, 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 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); }
/** * 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); }
@Override public void paint(Graphics g, JComponent c) { Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON); AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); if(model.isRollover()) { paintBackground(g2d, button); paintRoundBorder(g2d, button); } g.translate(3, 5); g.setColor(Color.WHITE); g.drawLine(1, 0, 5, 4); g.drawLine(0, 0, 5, 5); g.drawLine(5, 4, 9, 0); g.drawLine(5, 5, 10, 0); g.setColor(look.colors().shadow()); g.drawLine(0, 1, 5, 6); g.drawLine(5, 6, 10, 1); }
boolean isArmed = model.isArmed(); g.translate(x, y); g.setColor( MetalLookAndFeel.getControlInfo() ); g.drawLine( 0, 0, 8, 0 ); g.drawLine( 0, 0, 0, 8 ); g.drawLine( 2, 8, 8, 8 ); g.setColor( MetalLookAndFeel.getPrimaryControl() ); g.drawLine( 1, 1, 7, 1 ); g.drawLine( 1, 1, 1, 7 ); g.drawLine( 1, 9, 9, 9 ); } else { g.setColor( MetalLookAndFeel.getControlDarkShadow() ); g.drawLine( 0, 0, 8, 0 ); g.drawLine( 0, 0, 0, 8 ); g.translate( -x, -y );
private void paintOceanIcon(Component c, Graphics g, int x, int y) { ButtonModel model = ((JCheckBoxMenuItem) c).getModel(); g.translate(x, y); int w = this.getIconWidth(); int h = this.getIconHeight(); if ( model.isEnabled() ) { if (model.isPressed() && model.isArmed()) { g.setColor(MetalLookAndFeel.getControlShadow()); g.fillRect(0, 0, w, h); g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.fillRect(0, 0, w, 2); g.fillRect(0, 2, 2, h - 2); } else if (model.isRollover()) { MetalUtilsCustom.drawGradient(c, g, "CheckBox.gradient", 0, 0, w, h, true); g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawRect(0, 0, w - 1, h - 1); g.setColor(MetalLookAndFeel.getPrimaryControl()); g.drawRect(0, 0, w - 1, h - 1); g.translate(-x, -y); if (model.isSelected()) { this.drawCheck(g, x, y);