/** * Creates a border used by VMD node with a specific colors. * @return the VMD node border * @param borderColor the border color * @param borderThickness the border thickness * @param color1 1. color of gradient background * @param color2 2. color of gradient background * @param color3 3. color of gradient background * @param color4 4. color of gradient background * @param color5 5. color of gradient background * @since 2.5 */ public static Border createVMDNodeBorder (Color borderColor, int borderThickness, Color color1, Color color2, Color color3, Color color4, Color color5) { return new VMDNodeBorder (borderColor, borderThickness, color1, color2, color3, color4, color5); }
public void paint (Graphics2D gr, Rectangle bounds) { Shape previousClip = gr.getClip (); gr.clip (new RoundRectangle2D.Float (bounds.x, bounds.y, bounds.width, bounds.height, 4, 4)); drawGradient (gr, bounds, color1, color2, 0f, 0.3f); drawGradient (gr, bounds, color2, color3, 0.3f, 0.764f); drawGradient (gr, bounds, color3, color4, 0.764f, 0.927f); drawGradient (gr, bounds, color4, color5, 0.927f, 1f); gr.setColor (colorBorder); Stroke previousStroke = gr.getStroke (); gr.setStroke (stroke); gr.draw (new RoundRectangle2D.Float (bounds.x + 0.5f, bounds.y + 0.5f, bounds.width - 1, bounds.height - 1, 4, 4)); gr.setStroke (previousStroke); gr.setClip (previousClip); }
public void paint (Graphics2D gr, Rectangle bounds) { Shape previousClip = gr.getClip (); gr.clip (new RoundRectangle2D.Float (bounds.x, bounds.y, bounds.width, bounds.height, 4, 4)); drawGradient (gr, bounds, color1, color2, 0f, 0.3f); drawGradient (gr, bounds, color2, color3, 0.3f, 0.764f); drawGradient (gr, bounds, color3, color4, 0.764f, 0.927f); drawGradient (gr, bounds, color4, color5, 0.927f, 1f); gr.setColor (colorBorder); Stroke previousStroke = gr.getStroke (); gr.setStroke (stroke); gr.draw (new RoundRectangle2D.Float (bounds.x + 0.5f, bounds.y + 0.5f, bounds.width - 1, bounds.height - 1, 4, 4)); gr.setStroke (previousStroke); gr.setClip (previousClip); }
/** * Creates a border used by VMD node with a specific colors. * @return the VMD node border * @param borderColor the border color * @param borderThickness the border thickness * @param color1 1. color of gradient background * @param color2 2. color of gradient background * @param color3 3. color of gradient background * @param color4 4. color of gradient background * @param color5 5. color of gradient background * @since 2.5 */ public static Border createVMDNodeBorder (Color borderColor, int borderThickness, Color color1, Color color2, Color color3, Color color4, Color color5) { return new VMDNodeBorder (borderColor, borderThickness, color1, color2, color3, color4, color5); }