Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BorderLayout;
- import java.awt.Canvas;
- import java.awt.Dimension;
- import javax.swing.JFrame;
- public class test extends Canvas {
- public static final int WIDTH = 180;
- public static final int HEIGHT = 250;
- private JFrame frame;
- public test() {
- setMinimumSize(new Dimension(WIDTH,HEIGHT));
- setMaximumSize(new Dimension(WIDTH,HEIGHT));
- setPreferredSize(new Dimension(WIDTH,HEIGHT));
- frame = new JFrame();
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setLayout(new BorderLayout());
- frame.add(this, BorderLayout.CENTER);
- frame.pack();
- frame.setResizable(false);
- frame.setLocationRelativeTo(null);
- frame.setVisible(true);
- System.out.println(getWidth());
- }
- public static void main(String[] args) {
- new test();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement