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

class MyComponent extends JComponent {

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

From source file BasicDraw.java

class MyComponent extends JComponent {
    public void paint(Graphics g) {
        Font font = new Font("Serif", Font.PLAIN, 12);
        g.setFont(font);
        g.drawString("a String", 10, 10);

From source file MyCanvas.java

public class MyCanvas extends JComponent {
    private static Color m_tRed = new Color(255, 0, 0, 150);

    private static Color m_tGreen = new Color(0, 255, 0, 150);

    private static Color m_tBlue = new Color(0, 0, 255, 150);

From source file FontShow.java

public class FontShow extends JComponent {
    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        Font font = new Font("Dialog", Font.PLAIN, 96);

From source file Main.java

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

        RenderingHints rhints = g2d.getRenderingHints();
        boolean antialiasOn = rhints.containsValue(RenderingHints.VALUE_ANTIALIAS_ON);

From source file Main.java

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

        RenderingHints rhints = g2d.getRenderingHints();
        boolean antialiasOn = rhints.containsValue(RenderingHints.VALUE_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;

        AffineTransform at = new AffineTransform();

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

class MyComponent extends JComponent {
    Slice[] slices = { new Slice(5, Color.black), new Slice(33, Color.green), new Slice(20, Color.yellow),
            new Slice(15, Color.red) };

    MyComponent() {