/** * Draws a simple 3d border for the given component. * * @param c The component to draw its border. * @param g The graphics context. * @param x The x coordinate of the top left corner. * @param y The y coordinate of the top left corner. * @param w The width. * @param h The height. */ public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { g.setColor(MetouiaLookAndFeel.getControlHighlight()); g.drawLine(0, 0, 0, h - 1); g.setColor(MetouiaLookAndFeel.getControlShadow()); g.drawLine(0, h - 1, w - 1, h - 1); }
/** * Draws a simple 3d border for the given component. * * @param c The component to draw its border. * @param g The graphics context. * @param x The x coordinate of the top left corner. * @param y The y coordinate of the top left corner. * @param w The width. * @param h The height. */ public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { boolean isHorizontal = ((JToolBar) c).getOrientation() == HORIZONTAL; g.setColor(MetouiaLookAndFeel.getControlHighlight()); if (isHorizontal) { g.drawLine(0, 0, w - 1, 0); } else { g.drawLine(0, 0, 0, h - 1); } g.setColor(MetouiaLookAndFeel.getControlShadow()); if (isHorizontal) { g.drawLine(0, h - 1, w - 1, h - 1); } else { g.drawLine(w - 1, 0, w - 1, h - 1); } g.translate(x, y); if (((JToolBar) c).isFloatable()) { if (((JToolBar) c).getOrientation() == HORIZONTAL) { dots.setDotsArea(5, c.getSize().height - 4); if (c.getComponentOrientation().isLeftToRight()) { dots.paintIcon(c, g, 2, 2); } else { dots.paintIcon(c, g, c.getBounds().width - 12, 2); } } else { dots.setDotsArea(c.getSize().width - 4, 5); dots.paintIcon(c, g, 2, 2); } } g.translate(-x, -y); }