Example usage for javax.swing JPanel subclass-usage

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

Introduction

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

Usage

From source file Main.java

public class Main extends JPanel {

    public void paint(Graphics g) {
        int[] xs = { 25, 75, 125, 85, 125, 75, 25, 65 };
        int[] ys = { 50, 90, 50, 100, 150, 110, 150, 100 };
        g.drawPolyline(xs, ys, 8);

From source file MainClass.java

public class MainClass extends JPanel {

    public void paint(Graphics g) {
        byte[] barray = { 0x41, 0x42, 0x43 };

        g.drawBytes(barray, 0, barray.length, 10, 30);

From source file MainClass.java

public class MainClass extends JPanel {

    public void paint(Graphics g) {
        char[] carray = { 'w', 'w', 'w', '.', 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o', 'm' };

        g.drawChars(carray, 0, carray.length, 10, 60);

From source file Main.java

public class Main extends JPanel {

    public Main() {
        JLabel lblMarried = new JLabel("Are you married?", JLabel.LEFT);
        JLabel lblGolf = new JLabel("Do you play golf?", JLabel.RIGHT);

From source file MainClass.java

public class MainClass extends JPanel {

    public MainClass() {
        JLabel lblMarried = new JLabel("Are you married?", JLabel.LEFT);
        JLabel lblGolf = new JLabel("Do you play golf?", JLabel.RIGHT);

From source file Main.java

public class Main extends JPanel {

    public void paint(Graphics g) {
        int xpoints[] = { 25, 145, 25, 145, 25 };
        int ypoints[] = { 25, 25, 145, 145, 25 };
        int npoints = 5;

From source file MainClass.java

public class MainClass extends JPanel {

    public void paint(Graphics g) {
        int[] xs = { 25, 75, 125, 85, 125, 75, 25, 65 };
        int[] ys = { 50, 90, 50, 100, 150, 110, 150, 100 };
        g.drawPolyline(xs, ys, 8);

From source file Main.java

public class Main extends JPanel {

    private void drawString(Graphics g, String text, int x, int y) {
        for (String line : text.split("\n"))
            g.drawString(line, x, y += g.getFontMetrics().getHeight());
    }

From source file Main.java

public class Main extends JPanel {
    private static final int PREF_W = 400;
    private static final int PREF_H = 300;

    @Override
    public Dimension getPreferredSize() {

From source file Main.java

public class Main extends JPanel {
    String s = "Vertical text";
    int v;

    public void paint(Graphics g) {
        v = g.getFontMetrics(getFont()).getHeight() + 1;