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.setColor(Color.RED);
        g.drawString("text", 20, 30);
    }

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        Font courier = new Font("Courier", Font.PLAIN, 12);
        Font system = new Font("System", Font.BOLD, 16);
        Font helvetica = new Font("Helvetica", Font.BOLD, 18);

From source file ColorPan.java

public class ColorPan extends JComponent {
    public void paint(Graphics g) {
        int width = getSize().width;
        int height = getSize().height;
        int[] data = new int[width * height];
        int i = 0;

From source file MyCanvas.java

class MyCanvas extends JComponent {
    Color[] colors = new Color[24];

    public MyCanvas() {
        int rgb = 0xff;
        for (int i = 0; i < 24; i++) {

From source file MyCanvas.java

class MyCanvas extends JComponent {
    Color[] colors = new Color[24];

    public MyCanvas() {
        int rgb = 0xff;
        for (int i = 0; i < 24; i++) {

From source file Main.java

public class Main extends JComponent {
    public void paint(Graphics g) {
        int width = getSize().width;
        int height = getSize().height;
        int[] data = new int[width * height];
        int i = 0;

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        Image img1 = Toolkit.getDefaultToolkit().getImage("yourFile.gif");

        int width = img1.getWidth(this);

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;

        Image img1 = Toolkit.getDefaultToolkit().getImage("yourFile.gif");

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;

        //Draw the open arc 

From source file MyCanvas.java

class MyCanvas extends JComponent {

    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;

        // Draw the pie chart