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 BasicDraw.java

class MyComponent extends JComponent {

    public void paint(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    }

From source file BasicDraw.java

class MyComponent extends JComponent {
    public void paint(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        FontMetrics fontMetrics = g2d.getFontMetrics();

        int width = fontMetrics.stringWidth("aString");

From source file BasicDraw.java

class MyComponent extends JComponent {

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

        RenderingHints rhints = g2d.getRenderingHints();

From source file Hypnosis1.java

public class Hypnosis1 extends JComponent implements Runnable {
    private int[] coordinates;

    private int[] deltas;

    private Paint paint;

From source file BasicDraw.java

class MyComponent extends JComponent {

    public void paint(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        int x = 10;
        int y = 10;

From source file BasicDraw.java

class MyComponent extends JComponent {
    public void paint(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;

        g2d.drawString("aString", 100, 100);
        AffineTransform at = new AffineTransform();

From source file BasicDraw.java

class MyComponent extends JComponent {

    public void paint(Graphics g) {
        // Retrieve the graphics context; this object is used to paint shapes
        Graphics2D g2d = (Graphics2D) g;

From source file Main.java

class MyCanvas extends JComponent {

    @Override
    public void paintComponent(Graphics g) {
        if (g instanceof Graphics2D) {
            Graphics2D g2 = (Graphics2D) g;

From source file BasicDraw.java

class MyComponent extends JComponent {
    public void paint(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        Shape shape = new java.awt.geom.Ellipse2D.Float(20, 20, 200, 200);

        g2d.setClip(shape);

From source file Main.java

class MyAccessory extends JComponent implements PropertyChangeListener {
    public MyAccessory(JFileChooser chooser) {
        chooser.addPropertyChangeListener(this);
        setPreferredSize(new Dimension(50, 50));
    }