WindowBuilder Can not render GUI [message #1011863] |
Wed, 20 February 2013 06:46  |
Sikandar Ali Messages: 3 Registered: February 2013 |
Junior Member |
|
|
package com.swimap.omc.dcctool.view;
import java.awt.EventQueue;
public class MyFrame extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MyFrame frame = new MyFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MyFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new GridBagLayout());
contentPane.add(getExpPathTf());
setContentPane(contentPane);
}
private JTextField getExpPathTf() {
JTextField exportPathTf = SwingUtil.createJTextField();
exportPathTf.setText("sikandar");
exportPathTf.setEditable(false);
return exportPathTf;
}
private static class SwingUtil {
public static JTextField createJTextField() {
JTextField tf = new JTextField();
tf.setBounds(10, 10, 100, 20);
return tf;
}
}
}
Attachment: MyFrame.java
(Size: 1.39KB, Downloaded 30 times)
|
|
|