Example usage for java.awt Graphics fillRect

List of usage examples for java.awt Graphics fillRect

Introduction

In this page you can find the example usage for java.awt Graphics fillRect.

Prototype

public abstract void fillRect(int x, int y, int width, int height);

Source Link

Document

Fills the specified rectangle.

Usage

From source file:Main.java

public static void flattenSplitPane(JSplitPane jSplitPane) {
    UIDefaults defaults = javax.swing.UIManager.getDefaults();
    final Color light = defaults.getColor("SplitPane.highlight");
    final Color dark = defaults.getColor("SplitPane.darkShadow");

    // */*from   w w w .ja v  a2  s.co m*/
    jSplitPane.setUI(new BasicSplitPaneUI() {
        public BasicSplitPaneDivider createDefaultDivider() {
            BasicSplitPaneDivider divider = new BasicSplitPaneDivider(this) {
                private static final long serialVersionUID = 1L;

                @Override
                public int getDividerSize() {
                    return 5;
                }

                @Override
                public void paint(Graphics g) {
                    // super.paint(g);
                    int orientation = this.getBasicSplitPaneUI().getOrientation();

                    Dimension size = this.getSize();

                    if (orientation == JSplitPane.VERTICAL_SPLIT) {
                        int[] lines = new int[2];
                        lines[0] = 0;
                        lines[1] = size.height - 2;

                        for (int i = 0; i < size.width; i += 4) {
                            for (int j = 0; j < lines.length; j++) {
                                int y = lines[j];
                                g.setColor(light);
                                g.fillRect(i, y, 2, 2);
                                g.setColor(dark);
                                g.fillRect(i, y, 1, 1);
                            }
                        }
                    } else {
                        int[] rows = new int[2];
                        rows[0] = 0;
                        rows[1] = size.width - 2;

                        for (int i = 0; i < size.height; i += 4) {
                            for (int j = 0; j < rows.length; j++) {
                                int x = rows[j];
                                g.setColor(light);
                                g.fillRect(x, i, 2, 2);
                                g.setColor(dark);
                                g.fillRect(x, i, 1, 1);
                            }
                        }
                    }
                }
            };
            return divider;
        }
    });
    jSplitPane.setBorder(null);
    // */
}

From source file:MainClass.java

public void paint(Graphics g) {
    g.fillRect(5, 15, 50, 75);
}

From source file:Main.java

public void paint(Graphics g) {
    g.fillRect(100, 10, 60, 50);
}

From source file:MyCanvas.java

public void paint(Graphics g) {
    g.fillRect(20, 20, 200, 200);
}

From source file:MainClass.java

public void paint(Graphics g) {
    g.fillRect(0, 0, 200, 200);

}

From source file:Main.java

public void paint(Graphics g) {
    g.fillRect(0, 0, 20, 20);

    Graphics2D g2 = (Graphics2D) g;

    g2.translate(50, 50);/*from  w ww  .  j  av a  2 s . c o m*/
    g2.rotate(30.0 * Math.PI / 180.0, 13, 12);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);
}

From source file:Main.java

public void paint(Graphics g) {
    g.fillRect(0, 0, 20, 20);

    Graphics2D g2 = (Graphics2D) g;

    g2.translate(50, 50);/*from www  .ja v a  2 s .co  m*/
    g2.rotate(30.0 * Math.PI / 180.0);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);
}

From source file:Main.java

public void paint(Graphics g) {
    g.fillRect(0, 0, 20, 20);

    Graphics2D g2 = (Graphics2D) g;

    g2.shear(5.3, 5.4);//from  w w w. j  a v a2s  .c o  m
    g2.rotate(30.0 * Math.PI / 180.0);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);
}

From source file:Main.java

public void paint(Graphics g) {
    g.fillRect(0, 0, 20, 20);

    Graphics2D g2 = (Graphics2D) g;

    g2.translate(5.3, 5.4);/* w ww  .ja  va 2 s . c o  m*/
    g2.rotate(30.0 * Math.PI / 180.0);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);
}

From source file:MainClass.java

public void paint(Graphics g) {

    g.fillRect(0, 0, 20, 20);

    Graphics2D g2 = (Graphics2D) g;

    g2.translate(50, 50);//from  w w  w . ja  v a2s.c o  m
    g2.rotate(30.0 * Math.PI / 180.0);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);

}