我的文本域为什么显示不出来呢
packagecom.student.studentadministration;importjava.awt.BorderLayout;importjavax.swin...
package com.student.studentadministration;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class MainJpanel extends JFrame{
JPanel mb1,mb2;
JButton an1,an2,an3,an4;
JTextField wbk;
JTextArea wby;
JScrollPane gd;
JLabel bq;
MainJpanel(){
mb1=new JPanel();
mb2=new JPanel();
//上部
bq=new JLabel("请输入姓名");
wbk=new JTextField(10);
an4=new JButton("查询");
mb1.add(bq); mb1.add(wbk); mb1.add(an4);
this.add(mb1,BorderLayout.NORTH);
//中部
wby=new JTextArea();
gd=new JScrollPane(wby);
gd.add(wbk);
this.add(gd,BorderLayout.CENTER);
//下部
an1=new JButton("添加");
an2=new JButton("修改");
an3=new JButton("更新");
mb2.add(an1); mb2.add(an2); mb2.add(an3);
this.add(mb2,BorderLayout.SOUTH);
this.setTitle("StudentAdministration");
this.setSize(500,300);
this.setLocation(300, 280);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
} 展开
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class MainJpanel extends JFrame{
JPanel mb1,mb2;
JButton an1,an2,an3,an4;
JTextField wbk;
JTextArea wby;
JScrollPane gd;
JLabel bq;
MainJpanel(){
mb1=new JPanel();
mb2=new JPanel();
//上部
bq=new JLabel("请输入姓名");
wbk=new JTextField(10);
an4=new JButton("查询");
mb1.add(bq); mb1.add(wbk); mb1.add(an4);
this.add(mb1,BorderLayout.NORTH);
//中部
wby=new JTextArea();
gd=new JScrollPane(wby);
gd.add(wbk);
this.add(gd,BorderLayout.CENTER);
//下部
an1=new JButton("添加");
an2=new JButton("修改");
an3=new JButton("更新");
mb2.add(an1); mb2.add(an2); mb2.add(an3);
this.add(mb2,BorderLayout.SOUTH);
this.setTitle("StudentAdministration");
this.setSize(500,300);
this.setLocation(300, 280);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询