Example usage for java.awt Dimension Dimension

List of usage examples for java.awt Dimension Dimension

Introduction

In this page you can find the example usage for java.awt Dimension Dimension.

Prototype

public Dimension(int width, int height) 

Source Link

Document

Constructs a Dimension and initializes it to the specified width and specified height.

Usage

From source file:MainClass.java

MainClass() throws IOException {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    view = new JEditorPane("http://www.java2s.com");
    view.setEditable(false);//w w  w . j av  a2 s. c  o m
    view.setPreferredSize(new Dimension(400, 400));
    view.addHyperlinkListener(this);

    getContentPane().add(new JScrollPane(view), BorderLayout.CENTER);

    pack();
    setVisible(true);
}

From source file:org.jfree.chart.demo.LogarithmicAxisDemo1.java

public LogarithmicAxisDemo1(String s) {
    super(s);/*from   www .  jav  a  2  s. c  o  m*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

From source file:Main.java

public MyViewport() {
    setOpaque(false);
    setPreferredSize(new Dimension(6 * TILE, 6 * TILE));
}

From source file:org.jfree.chart.demo.LineChart3DDemo1.java

public LineChart3DDemo1(String s) {
    super(s);/*  w  ww .ja v  a 2  s. c  o m*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

From source file:org.jfree.chart.demo.LogarithmicAxisDemo2.java

public LogarithmicAxisDemo2(String s) {
    super(s);/*from ww  w . ja va  2s  .  c  om*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}

From source file:Main.java

public Main() throws Exception {
    super();/*  w w  w  .java2s  .c o  m*/
    ImageIcon ii = new ImageIcon(new URL("http://www.java2s.com/style/download.png"));
    GrabAndScrollLabel label = new GrabAndScrollLabel(ii);
    label.setPreferredSize(new Dimension(300, 300));

    JScrollPane jsp = new JScrollPane(label);
    getContentPane().add(jsp);
    setSize(300, 250);
    setVisible(true);

    WindowListener l = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(l);
}

From source file:Main.java

private void addComponentsToPane() {
    display = new JTextArea();
    display.setEditable(false);/* w w  w  .  j  a  va  2s  . co m*/
    JScrollPane scrollPane = new JScrollPane(display);
    scrollPane.setPreferredSize(new Dimension(500, 450));
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    addWindowFocusListener(this);
}

From source file:Main.java

public CirclePanel() {
    this.setPreferredSize(new Dimension(80, 80));
    this.setForeground(new Color(r.nextInt()));
    this.addMouseListener(new MouseAdapter() {
        @Override/*from  ww w.java2 s .  com*/
        public void mousePressed(MouseEvent e) {
            update();
        }
    });
}

From source file:Main.java

public Main() {
    this.setLayout(null);
    jlabel4.setBounds(0, 0, 100, 30);/*from  w  w w.  j  a va2 s  .  c  o m*/
    this.add(jlabel4);
    this.pack();
    t = new Timer(1000, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            jlabel4.setText(new SimpleDateFormat("HH:mm:ss", Locale.FRANCE).format(new Date()));
        }
    });
    t.start();
    setSize(new Dimension(200, 60));
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}

From source file:org.jfree.chart.demo.XYErrorRendererDemo2.java

public XYErrorRendererDemo2(String s) {
    super(s);/*from  w  w  w .  ja v a 2s.  c  om*/
    JPanel jpanel = createDemoPanel();
    jpanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(jpanel);
}