File: TestResizableWindow.java

package info (click to toggle)
libjide-oss-java 3.7.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,444 kB
  • sloc: java: 91,177; xml: 661; makefile: 35
file content (35 lines) | stat: -rw-r--r-- 1,250 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.jidesoft.swing;

import java.awt.Color;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JButton;

public class TestResizableWindow {
    //
    public static void main(String[] args) {
        // TEST AGAIN AND AGAIN AND AGAIN
        EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                final ResizableWindow resizableWindow = new ResizableWindow();
                resizableWindow.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3));
                resizableWindow.getResizable().setResizableCorners(Resizable.ALL);
                resizableWindow.getContentPane().add(new JButton(new AbstractAction("Close window") {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        resizableWindow.dispose();
                        System.exit(0);
                    }
                }));
                resizableWindow.pack();
                resizableWindow.setLocationRelativeTo(null);
                resizableWindow.setVisible(true);
            }
        });
    }
}