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) {
        Graphics2D g2 = (Graphics2D) g;

        //Draw the chord

From source file MyCanvas.java

class MyCanvas extends JComponent {

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

        //Draw the chord

From source file MyCanvas.java

class MyCanvas extends JComponent {
    public void paint(Graphics g) {
        Graphics2D g2D = (Graphics2D) g;
        Point2D.Float point = new Point2D.Float(100, 100); // store start point
        GeneralPath p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
        p.moveTo(point.x, point.y);

From source file Main.java

class Main extends JComponent {
    public void paint(Graphics g) {
        Graphics2D g2D = (Graphics2D) g;
        Point2D.Float point = new Point2D.Float(100, 100); // store start point
        GeneralPath p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
        p.moveTo(point.x, point.y);

From source file MyCanvas.java

class MyCanvas extends JComponent {
    public void paint(Graphics g) {
        Graphics2D g2D = (Graphics2D) g;
        Point2D.Float point = new Point2D.Float(100, 100); // store start point
        GeneralPath p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
        p.moveTo(point.x, point.y);

From source file BasicPrint.java

public class BasicPrint extends JComponent implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) {

        double x = 0;
        double y = 0;
        double w = pf.getWidth();

From source file BasicPrint.java

public class BasicPrint extends JComponent implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) {

        double ix = pf.getImageableX();
        double iy = pf.getImageableY();
        double iw = pf.getImageableWidth();

From source file ColorPan.java

public class ColorPan extends JComponent {
    BufferedImage image;

    public void initialize() {
        int width = getSize().width;
        int height = getSize().height;

From source file BasicPrint.java

public class BasicPrint extends JComponent implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) {
        if (pageIndex > 0) {
            return Printable.NO_SUCH_PAGE;
        }
        Graphics2D g2d = (Graphics2D) g;

From source file GradientPane.java

class GradientPane extends JComponent {
    public void paint(Graphics g) {
        Graphics2D g2D = (Graphics2D) g;
        Point2D.Float p1 = new Point2D.Float(150.f, 75.f); // Gradient line start
        Point2D.Float p2 = new Point2D.Float(250.f, 75.f); // Gradient line end
        float width = 300;