Example usage for javax.swing JComponent subclass-usage

List of usage examples for javax.swing JComponent subclass-usage

Introduction

In this page you can find the example usage for javax.swing JComponent subclass-usage.

Usage

From source file MyCanvas.java

class MyCanvas extends JComponent {
    public void paint(Graphics g) {
        g.drawLine(20, 20, 200, 200);

    }
}

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        g.drawOval(10, 10, 200, 200);
    }
}

From source file MyCanvas.java

class MyCanvas extends JComponent {

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

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        g.drawRect(10, 10, 200, 200);
    }
}

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        g.drawArc(10, 10, 200, 200, 50, 50);
    }
}

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        int[] x = new int[] { 100, 200, 300, 400 };
        int[] y = new int[] { 400, 300, 300, 100 };
        g.drawPolygon(x, y, x.length);

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        g.drawString(Long.toString(System.currentTimeMillis()), 10, 30);
        repaint(1000);
    }

From source file MyComponent.java

class MyComponent extends JComponent {
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        // Customize after calling super.paintComponent(g)

        g.drawString("string", 20, 20);

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        g.setColor(Color.RED);
        g.fill3DRect(20, 20, 200, 200, true);
    }

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        g.setColor(Color.RED);
        g.fillArc(20, 20, 200, 200, 200, 200);
    }