java中文本框,按钮的使用案列
程序员文章站
2022-05-29 20:02:23
...
package com.deos.start;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Component;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.client.HttpResponse;
import io.vertx.ext.web.client.WebClient;
public class test extends JFrame {
public test(String title) throws Exception {
super(title);
this.setSize(700,300);
this.setLocation(300, 200);
JPanel panel = new JPanel();
panel.setLayout(null);
JLabel jla0 = new JLabel("执行进程");
jla0.setBounds(175, 0, 60, 30);
JLabel jla00 = new JLabel("结束进程");
jla00.setBounds(525, 0, 60, 30);
JLabel jla1 = new JLabel("用户名:");
jla1.setBounds(0, 35, 60, 30);
JTextField name = new JTextField();
name.setBounds(60, 35, 250, 25);
JLabel jla11 = new JLabel("job_id:");
jla11.setBounds(360, 35, 60, 30);
JTextField name1 = new JTextField();
name1.setBounds(420, 35, 250, 25);
JLabel jal2 = new JLabel("密码:");
jal2.setBounds(0, 70, 60, 30);
JTextField password =new JTextField();
password.setBounds(60, 80, 250, 25);
JLabel jal3 = new JLabel("命令:");
jal3.setBounds(0, 105, 60, 30);
JTextField commond =new JTextField();
commond.setBounds(60, 120, 250, 25);
JButton butt = new JButton("执行进程");
butt.setBounds(420, 110, 100, 34);
JButton butt0 = new JButton("结束进程");
butt0.setBounds(570, 110, 100, 34);
JTextArea area = new JTextArea();
area.setBounds(0, 160, 700, 200);
panel.add(jla0);
panel.add(jla00);
panel.add(jla1);
panel.add(name);
panel.add(jla11);
panel.add(name1);
panel.add(jal2);
panel.add(password);
panel.add(jal3);
panel.add(commond);
panel.add(butt);
panel.add(butt0);
panel.add(area);
butt.addActionListener(new ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
}
});
butt0.addActionListener(new ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
}
});
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
this.setLayout(new BorderLayout());
this.add(panel);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
public static void main(String[] args) throws Exception{
test DAY21 = new test("win远程代理工具");
}
}
执行结果: