Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Main extends JPanel {
    public void paint(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        AffineTransform at = new AffineTransform();
        at.setToRotation(-Math.PI / 2.0, getWidth() / 2.0, getHeight() / 2.0);
        g2d.setTransform(at);
        g2d.drawString("Vertical text", 10, 10);
    }

    public static void main(String[] a) {
        JFrame f = new JFrame();
        f.add(new Main());

        f.setSize(300, 300);
        f.setVisible(true);
    }
}