用JAVA代码实现添加好友模版

用JAVA代码实现添加好友模版,第1张

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()

}

}

介绍你一本书,《java开发利器 Eclipse从入门到精通》

里面前200页就是讲界面开发的,拿他的例子改改,就可以了

你想让别人给你写好,估计在这里很少有人这么有空帮你

你照着做吧,如果出现问题了再上来提问。呵呵

这本书的电子书下载地址:http://bbs.tech.ccidnet.com/read.php?tid=224558


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/7960159.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-12
下一篇 2023-04-12

发表评论

登录后才能评论

评论列表(0条)

保存