这是一个非常好的swing开发插件,你只要对swing稍作了解,就可以利用它,在myeclipse中可视化拖出一个,很好的图形化界面。还可以换图标,换主题,做出和Extjs一样的效果的界面,安装方法,下载jigloo_464压缩文件,导到myeclipse中,重启Myeclipse,新建一个
选中一个Jframe
进入可视化编辑的
生成的代码也非常清楚
public class NewJFrame extends javax.swing.JFrame {
/**
*
*/
private static final long serialVersionUID = -7080419184907469080L;
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
} catch(Exception e) {
e.printStackTrace();
}
}
private JLabel L1;
private JTextField jT6;
private JButton jB8;
private JButton jB7;
private JButton jB6;
private JButton jB5;
private JButton jB9;
private JTextField jT5;
private JLabel jL7;
private JLabel jL6;
private JTextField jT4;
private JTextField jT3;
private JLabel jL5;
private JLabel jL4;
private JScrollPane jScrollPane1;
private JButton jButton1;
private JButton jB4;
private JButton jB2;
private JButton jB1;
private JTextField jT2;
private JTextField jT1;
private JTable Jt1;
private JLabel L3;
private JLabel L2;
/**
* Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
NewJFrame inst = new NewJFrame();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
public NewJFrame() {
super();
initGUI();
}
private void initGUI() {
try {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
{
L1 = new JLabel();
getContentPane().add(L1);
L1.setText("\u53d1\u5e16\u95f4\u9694(s)");
L1.setBounds(0, 12, 71, 22);
}
{
L2 = new JLabel();
getContentPane().add(L2);
L2.setText("\u8e29\u53cb\u95f4\u9694(s)");
L2.setBounds(77, 14, 68, 19);
}
{
L3 = new JLabel();
getContentPane().add(L3);
L3.setText("\u8d26\u53f7\u4fe1\u606f");
L3.setBounds(258, 12, 73, 15);
}
{
jScrollPane1 = new JScrollPane();
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(157, 33, 288, 278);
{
TableModel Jt1Model =
new DefaultTableModel(
new String[][] { { "l1232@163.com", "88888" }, { "123@163.com", "8888" } },
new String[] { "email", "密码" });
Jt1 = new JTable();
jScrollPane1.setViewportView(Jt1);
Jt1.setModel(Jt1Model);
Jt1.setBounds(218, 33, 272, 244);
Jt1.getTableHeader().setBounds(3, 0, 269, 21);
Jt1.setPreferredSize(new java.awt.Dimension(286, 254));
Jt1.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
}
}
{
jT1 = new JTextField();
getContentPane().add(jT1);
jT1.setBounds(0, 40, 67, 24);
jT1.setText("15");
jT1.setToolTipText("\u8f93\u5165\u53d1\u5e16\u95f4\u9694\u65f6\u95f4");
jT1.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent evt) {
jT1FocusLost(evt);
}
});
}
{
jT2 = new JTextField();
getContentPane().add(jT2);
jT2.setBounds(79, 40, 68, 24);
jT2.setText("2");
jT2.setToolTipText("\u8f93\u5165\u8e29\u53cb\u95f4\u9694\u65f6\u95f4");
}
{
jB1 = new JButton();
getContentPane().add(jB1);
jB1.setText("\u81ea\u52a8\u53d1\u5e16");
jB1.setBounds(0, 76, 69, 25);
jB1.setToolTipText("\u81ea\u52a8\u53d1\u5e16");
jB1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jB1ActionPerformed(evt);
}
});
}
{
jB2 = new JButton();
getContentPane().add(jB2);
jB2.setText("\u81ea\u52a8\u7b7e\u5230");
jB2.setBounds(79, 76, 68, 24);
jB2.setFont(new java.awt.Font("微软雅黑",0,12));
jB2.setToolTipText("\u81ea\u52a8\u7b7e\u5230");
}
{
jButton1 = new JButton();
getContentPane().add(jButton1);
jButton1.setText("\u81ea\u52a8\u8e29\u53cb");
jButton1.setBounds(0, 111, 68, 24);
jButton1.setToolTipText("\u81ea\u52a8\u8e29\u53cb");
}
{
jB4 = new JButton();
getContentPane().add(jB4);
jB4.setText("\u81ea\u52a8\u8f6c\u53d1");
jB4.setBounds(79, 111, 68, 24);
jB4.setToolTipText("\u81ea\u52a8\u8f6c\u53d1");
}
{
jL4 = new JLabel();
getContentPane().add(jL4);
jL4.setText("\u53d1\u5e16\u65f6\u95f4");
jL4.setBounds(7, 139, 61, 18);
}
{
jL5 = new JLabel();
getContentPane().add(jL5);
jL5.setText("\u7b2c\u4e00\u6b21");
jL5.setBounds(91, 140, 47, 17);
}
{
jT3 = new JTextField();
getContentPane().add(jT3);
jT3.setBounds(0, 157, 67, 24);
jT3.setToolTipText("\u53d1\u5e16\u65f6\u95f4");
}
{
jT4 = new JTextField();
getContentPane().add(jT4);
jT4.setBounds(80, 157, 67, 24);
jT4.setToolTipText("\u53d1\u5e16\u65f6\u95f4");
}
{
jL6 = new JLabel();
getContentPane().add(jL6);
jL6.setText("\u7b2c\u4e8c\u6b21");
jL6.setBounds(12, 182, 52, 18);
}
{
jL7 = new JLabel();
getContentPane().add(jL7);
jL7.setText("\u7b2c\u4e09\u6b21");
jL7.setBounds(92, 182, 55, 18);
}
{
jT5 = new JTextField();
getContentPane().add(jT5);
jT5.setBounds(0, 200, 67, 24);
jT5.setToolTipText("\u53d1\u5e16\u65f6\u95f4");
}
{
jT6 = new JTextField();
getContentPane().add(jT6);
jT6.setBounds(79, 200, 67, 24);
jT6.setToolTipText("\u53d1\u5e16\u65f6\u95f4");
}
{
jB5 = new JButton();
getContentPane().add(jB5);
jB5.setText("\u542f\u52a8\u65e0\u4eba\u76d1\u5b88\u6a21\u5f0f");
jB5.setBounds(12, 230, 128, 23);
jB5.setToolTipText("\u542f\u52a8\u65e0\u4eba\u76d1\u5b88\u6a21\u5f0f");
}
{
jB6 = new JButton();
getContentPane().add(jB6);
jB6.setText("\u8d26\u53f7\u7ba1\u7406");
jB6.setBounds(0, 258, 60, 24);
jB6.setToolTipText("\u8d26\u53f7\u7ba1\u7406");
}
{
jB7 = new JButton();
getContentPane().add(jB7);
jB7.setText("\u8d34\u5e93\u7ba1\u7406");
jB7.setBounds(80, 258, 60, 24);
jB7.setToolTipText("\u8d34\u5e93\u7ba1\u7406");
}
{
jB8 = new JButton();
getContentPane().add(jB8);
jB8.setText("\u9000\u51fa\u7a0b\u5e8f");
jB8.setBounds(0, 287, 60, 24);
jB8.setToolTipText("\u9000\u51fa\u7a0b\u5e8f");
jB8.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
System.out.println("jB8.actionPerformed, event="+evt);
System.exit(0);
}
});
}
{
jB9 = new JButton();
getContentPane().add(jB9);
jB9.setText("\u7559\u8a00\u7ba1\u7406");
jB9.setBounds(80, 287, 60, 24);
jB9.setToolTipText("\u7559\u8a00\u7ba1\u7406");
jB9.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jB9ActionPerformed(evt);
}
});
}
pack();
this.setSize(473, 375);
} catch (Exception e) {
//add your error handling code here
e.printStackTrace();
}
}
private void jB1ActionPerformed(ActionEvent evt) {
System.out.println("jB1.actionPerformed, event="+evt);
String str=jT1.getText();
System.out.println(str);
}
private void jT1FocusLost(FocusEvent evt) {
System.out.println("jT1.focusLost, event="+evt);
int sun=15;
String num=jT1.getText();
String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(num);
if(m.replaceAll("").trim().length()>0){
sun=Integer.valueOf(m.replaceAll("").trim());
}
System.out.println(sun);
}
private void jB9ActionPerformed(ActionEvent evt) {
System.out.println("jB9.actionPerformed, event="+evt);
NewJFrame1 njf1=new NewJFrame1();
njf1.setLocationRelativeTo(null);
njf1.setVisible(true);
}
}