200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > eclipse java shell 窗体显示 bat运行不显示_java eclipse中如何实现点击主窗口s

eclipse java shell 窗体显示 bat运行不显示_java eclipse中如何实现点击主窗口s

时间:2021-06-05 07:44:23

相关推荐

eclipse java shell 窗体显示 bat运行不显示_java eclipse中如何实现点击主窗口s

java eclipse中如何实现点击主窗口sShell中的按钮打开另外一个子窗口sShell

关注:97答案:2mip版

解决时间 -01-31 13:01

提问者╬═掵中注定

-01-31 01:34

java eclipse中如何实现点击主窗口sShell中的按钮打开另外一个子窗口sShell

最佳答案

二级知识专家小河边唱歌

-01-31 02:09

import java.awt.*;

import java.awt.event.*;

import javax.swing.AbstractButton;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JTextField;

public class button extends JFrame{

public button(){

JButton button=new JButton("查找");

setLayout(new FlowLayout());

add(button);

button.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){

selectinterface sl = new selectinterface();

sl.setVisible(true);

sl.pack();

}

});

}

public static void main(String[] args) {

// TODO Auto-generated method stub

button frame=new button();

frame.setTitle("按钮");

frame.setLocationRelativeTo(null);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setSize(400,600);

frame.setVisible(true);

}

}

class selectinterface extends JFrame{

public selectinterface(){

JPanel p1=new JPanel();

p1.setLayout(new GridLayout(9,2,5,5));

p1.add(new JLabel("编号"));

p1.add(new JTextField(6));

p1.add(new JLabel("姓名"));

p1.add(new JTextField(8));

p1.add(new JLabel("性别"));

p1.add(new JTextField(1));

p1.add(new JLabel("年龄"));

p1.add(new JTextField(2));

p1.add(new JLabel("职位"));

p1.add(new JTextField(20));

p1.add(new JLabel("学历"));

p1.add(new JTextField(4));

p1.add(new JLabel("学位"));

p1.add(new JTextField(4));

p1.add(new JLabel("工龄"));

p1.add(new JTextField(2));

p1.add(new JLabel("工资等级"));

p1.add(new JTextField(2));

JPanel p2=new JPanel();

p2.add(new JButton("确定"));

p2.add(new JButton("取消"));

setLayout(new GridLayout(2,1,0,100));

add(p1);

add(p2);

}

}

全部回答

1楼看厌了山川

-01-31 03:39

先用eclipse的界面设计器设计好你要用的两个界面

然后在主界面的一个button上添加一个单击事件在事件的处理代码中产生一个界面2的类并且将该对象的可视化属性设置为可见即可

我要举报

如以上问答内容为低俗/色情/暴力/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!

→点此我要举报以上信息!←

推荐资讯

大家都在看

eclipse java shell 窗体显示 bat运行不显示_java eclipse中如何实现点击主窗口sShell中的按钮打开另外一个子窗口sShell...

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。