| 1 |
package com.jidesoft.swing; |
| 2 |
|
| 3 |
import java.awt.Color; |
| 4 |
import java.awt.EventQueue; |
| 5 |
import java.awt.event.ActionEvent; |
| 6 |
|
| 7 |
import javax.swing.AbstractAction; |
| 8 |
import javax.swing.BorderFactory; |
| 9 |
import javax.swing.JButton; |
| 10 |
|
| 11 |
public class TestResizableWindow { |
| 12 |
// |
| 13 |
public static void main(String[] args) { |
| 14 |
// TEST AGAIN AND AGAIN AND AGAIN |
| 15 |
EventQueue.invokeLater(new Runnable() { |
| 16 |
|
| 17 |
@Override |
| 18 |
public void run() { |
| 19 |
final ResizableWindow resizableWindow = new ResizableWindow(); |
| 20 |
resizableWindow.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3)); |
| 21 |
resizableWindow.getResizable().setResizableCorners(Resizable.ALL); |
| 22 |
resizableWindow.getContentPane().add(new JButton(new AbstractAction("Close window") { |
| 23 |
@Override |
| 24 |
public void actionPerformed(ActionEvent e) { |
| 25 |
resizableWindow.dispose(); |
| 26 |
System.exit(0); |
| 27 |
} |
| 28 |
})); |
| 29 |
resizableWindow.pack(); |
| 30 |
resizableWindow.setLocationRelativeTo(null); |
| 31 |
resizableWindow.setVisible(true); |
| 32 |
} |
| 33 |
}); |
| 34 |
} |
| 35 |
} |