Java Utililty Methods Graphics Draw

List of utility methods to do Graphics Draw

Description

The list of methods to do Graphics Draw are organized into topic(s).

Method

voidrenderByLineGraphics(JComponent c, Graphics g)
render By Line Graphics
int colorI = 0;
for (int i = 0; i < c.getHeight(); i++) {
    GradientPaint gp = new GradientPaint(0, 0, new Color(200, 200, colorI), c.getWidth(), i,
            new Color(200, 200, colorI + 1), true);
    ((Graphics2D) g).setPaint(gp);
    g.fillRect(0, i, c.getWidth(), i);
    if (colorI < 254)
        colorI++;
...
voidrenderGraphics(JComponent c, Graphics g)
render Graphics
GradientPaint gp = new GradientPaint(0, 0, new Color(240, 240, 240), 0, c.getHeight() / 2,
        new Color(230, 230, 255), true);
((Graphics2D) g).setPaint(gp);
g.fillRect(0, 0, c.getWidth(), c.getHeight());
ObjectuseAntiAliasing(Graphics2D g)
Tell the G to use anti aliased drawing and text
Object oldAA = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
return oldAA;