
这段代码为什么运行会左上角还出现一个窗口
packageui;importjavax.swing.*;importDao.StudentDao;importDao.UserDao;importjava.awt.*...
package ui;
import javax.swing.*;
import Dao.StudentDao;
import Dao.UserDao;
import java.awt.*;
import java.awt.event.*;
import java.sql.ResultSet;
public class RegisterJFrame extends JFrame{
public RegisterJFrame(){
JFrame jf = new JFrame("新建");
jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);// 关闭
jf.setSize(300, 400); // 窗口大小
jf.setLocation(200, 200); // 窗口位置
jf.setResizable(false);
JPanel pan = new JPanel();
jf.add(pan);
jf.setVisible(true);
pan.setLayout(null);
Font f = new Font("宋体", Font.BOLD, 14);
JLabel person_id = new JLabel("ID");
person_id.setBounds(20,0,100,100);
pan.add(person_id);
person_id.setFont(f);
JTextField tf_account = new JTextField(10);
tf_account.setBounds(100, 40, 150, 25);
pan.add(tf_account);
JLabel person_name = new JLabel("姓名");
person_name.setBounds(20, 40, 100, 100);
pan.add(person_name);
person_name.setFont(f);
JTextField name = new JTextField(20);
name.setBounds(100, 80, 150, 25);
pan.add(name);
JLabel Person_sex = new JLabel("性别");
Person_sex.setBounds(20, 80, 100, 100);
pan.add(Person_sex);
Person_sex.setFont(f);
JTextField sex = new JTextField(20);
sex.setBounds(100, 120, 150, 25);
pan.add(sex);
JLabel Person_Birthday = new JLabel("生日");
Person_Birthday.setBounds(20, 120, 100, 100);
pan.add(Person_Birthday);
Person_Birthday.setFont(f);
JTextField birthday = new JTextField(20);
birthday.setBounds(100, 160, 150, 25);
pan.add(birthday);
JLabel Person_balance = new JLabel("余额");
Person_balance.setBounds(20,160, 100, 100);
pan.add(Person_balance);
Person_balance.setFont(f);
JTextField balance = new JTextField(20);
balance.setBounds(100, 200, 150, 25);
pan.add(balance);
JButton register = new JButton("新建");
register.setBounds(100, 240, 75, 30);
pan.add(register);
JButton qx = new JButton("取消");
qx.setBounds(175, 240, 75, 30);
pan.add(qx);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new RegisterJFrame().setVisible(true);
}
} 展开
import javax.swing.*;
import Dao.StudentDao;
import Dao.UserDao;
import java.awt.*;
import java.awt.event.*;
import java.sql.ResultSet;
public class RegisterJFrame extends JFrame{
public RegisterJFrame(){
JFrame jf = new JFrame("新建");
jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);// 关闭
jf.setSize(300, 400); // 窗口大小
jf.setLocation(200, 200); // 窗口位置
jf.setResizable(false);
JPanel pan = new JPanel();
jf.add(pan);
jf.setVisible(true);
pan.setLayout(null);
Font f = new Font("宋体", Font.BOLD, 14);
JLabel person_id = new JLabel("ID");
person_id.setBounds(20,0,100,100);
pan.add(person_id);
person_id.setFont(f);
JTextField tf_account = new JTextField(10);
tf_account.setBounds(100, 40, 150, 25);
pan.add(tf_account);
JLabel person_name = new JLabel("姓名");
person_name.setBounds(20, 40, 100, 100);
pan.add(person_name);
person_name.setFont(f);
JTextField name = new JTextField(20);
name.setBounds(100, 80, 150, 25);
pan.add(name);
JLabel Person_sex = new JLabel("性别");
Person_sex.setBounds(20, 80, 100, 100);
pan.add(Person_sex);
Person_sex.setFont(f);
JTextField sex = new JTextField(20);
sex.setBounds(100, 120, 150, 25);
pan.add(sex);
JLabel Person_Birthday = new JLabel("生日");
Person_Birthday.setBounds(20, 120, 100, 100);
pan.add(Person_Birthday);
Person_Birthday.setFont(f);
JTextField birthday = new JTextField(20);
birthday.setBounds(100, 160, 150, 25);
pan.add(birthday);
JLabel Person_balance = new JLabel("余额");
Person_balance.setBounds(20,160, 100, 100);
pan.add(Person_balance);
Person_balance.setFont(f);
JTextField balance = new JTextField(20);
balance.setBounds(100, 200, 150, 25);
pan.add(balance);
JButton register = new JButton("新建");
register.setBounds(100, 240, 75, 30);
pan.add(register);
JButton qx = new JButton("取消");
qx.setBounds(175, 240, 75, 30);
pan.add(qx);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new RegisterJFrame().setVisible(true);
}
} 展开
1个回答
2019-07-04 · IT职业教育领导品牌
AAA软件教育隶属于河南梦工厂教育信息咨询有限公司,从事高端计算机职业教育工作,是国内知名的教育品牌。自07年创建以来,依托先进的办学理念,AAA培养出了数万名专业型、实战型高端技术人才。
向TA提问
关注

展开全部
java是编程语言里比较难学的一门,如果有心从事编程方向的工作,最好到专业机构多实践,更贴近市场,这样更有利于将来的发展。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询