当前位置: 代码迷 >> Java相关 >> java中GUI编程 求大手看下异常如何修改
  详细解决方案

java中GUI编程 求大手看下异常如何修改

热度:7525   发布时间:2013-02-25 21:47:27.0
java中GUI编程 求大手看下错误怎么修改
下面是代码:
import javax.swing.*;
import java.awt.*;

public class exe1 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
  JFrame f=new JFrame();
  f.setTitle("FirstFream");
  f.setSize(300,300);
  JLabel LabOne=new JLabel("这是标签");
  JTextField txtOne=new JTextField("这是文本框");
  JPanel p=new JPanel();
  p.add(LabOne);
  p.add(txtOne);
  Border border=BorderFactory.createEtchedBorder();
  p.setBorder(border);
  Container contentPane=f.getContentPane();
  contentPane.add(p);
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.show();
}

}


------解决方案--------------------------------------------------------
Java code
import javax.swing.*;import java.awt.*;public class Exe1 {    /**      * @param args      */    public static void main(String[] args) {        // TODO Auto-generated method stub        JFrame f = new JFrame("FirstFream");        f.setSize(300,300);        JLabel LabOne = new JLabel("这是标签");        JTextField txtOne = new JTextField("这是文本框");        JPanel p = new JPanel();        p.add(LabOne);        p.add(txtOne);        p.setBorder(BorderFactory.createEtchedBorder());        Container contentPane = f.getContentPane();        contentPane.add(p);        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        f.setVisible(true);    }}
  相关解决方案