用JAVA代码实现添加好友模版
答案:3 悬赏:60
解决时间 2021-02-11 22:36
- 提问者网友:喜遇你
- 2021-02-11 18:35
用JAVA代码实现添加好友模版
最佳答案
- 二级知识专家网友:星星坠落
- 2021-02-11 18:41
import javax.swing.*;
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.*;
public class ChatFrame extends JFrame implements ActionListener {
private JLabel id;
private JLabel group;
private JLabel allas;
public JTextField inputId;
public JTextField inputGroup;
public JTextField inputAllas;
private JButton submit;
private JPanel pane;
public ChatFrame(){
id = new JLabel("Id");
group = new JLabel("Group");
allas = new JLabel("Allas");
inputId = new JTextField();
inputGroup = new JTextField();
inputAllas = new JTextField();
submit = new JButton("确定");
pane=new JPanel();
pane.setLayout(null);
this.getContentPane().add(pane).setBackground(Color.white);
this.getContentPane().add(pane);
pane.add(id);
pane.add(group);
pane.add(allas);
pane.add(inputId);
pane.add(inputGroup);
pane.add(inputAllas);
pane.add(submit);
id.setBounds(5,5,50,30);
group.setBounds(5,35,50,30);
allas.setBounds(5,65,50,50);
inputId.setBounds(70,5,100,30);
inputGroup.setBounds(70,35,100,30);
inputAllas.setBounds(70,65,100,30);
submit.setBounds(150,100,60,30);
submit.addActionListener(this);
this.setSize(240,180);
this.setLocation(300,300);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);
}
public void actionPerformed(ActionEvent e){
//按键监听,可添加连接数据库的操作
}
public static void main(String args[]){
new ChatFrame();
}
}
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.*;
public class ChatFrame extends JFrame implements ActionListener {
private JLabel id;
private JLabel group;
private JLabel allas;
public JTextField inputId;
public JTextField inputGroup;
public JTextField inputAllas;
private JButton submit;
private JPanel pane;
public ChatFrame(){
id = new JLabel("Id");
group = new JLabel("Group");
allas = new JLabel("Allas");
inputId = new JTextField();
inputGroup = new JTextField();
inputAllas = new JTextField();
submit = new JButton("确定");
pane=new JPanel();
pane.setLayout(null);
this.getContentPane().add(pane).setBackground(Color.white);
this.getContentPane().add(pane);
pane.add(id);
pane.add(group);
pane.add(allas);
pane.add(inputId);
pane.add(inputGroup);
pane.add(inputAllas);
pane.add(submit);
id.setBounds(5,5,50,30);
group.setBounds(5,35,50,30);
allas.setBounds(5,65,50,50);
inputId.setBounds(70,5,100,30);
inputGroup.setBounds(70,35,100,30);
inputAllas.setBounds(70,65,100,30);
submit.setBounds(150,100,60,30);
submit.addActionListener(this);
this.setSize(240,180);
this.setLocation(300,300);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);
}
public void actionPerformed(ActionEvent e){
//按键监听,可添加连接数据库的操作
}
public static void main(String args[]){
new ChatFrame();
}
}
全部回答
- 1楼网友:两不相欠
- 2021-02-11 21:32
不知道你说的web实现还是java自己写界面实现
- 2楼网友:冷态度
- 2021-02-11 20:18
学习一下swing.就可以实现..
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯