简单的锐捷登录界面
最近学了JAVA的CUI,经常连接锐捷上网,自己就写了一个简单的锐捷登录界面(还有很多地方需要改善的)
import java.awt.BorderLayout;
import java.awt.Checkbox;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class Ruijie_Frame extends JFrame implements ActionListener{
String[] strLanguage = {"中文","English"};
String[] strNet = {"RTL8168C(P)/8111C(P)","Wireless LAN"};
Checkbox box = new Checkbox("保存密码");
JPanel pnlNorth=new JPanel();
JPanel pnlSOUTH = new JPanel();
JPanel pnlCenter = new JPanel();
JPanel pnlGrid = new JPanel();
Box baseBox,box1,box2;
ImageIcon image = new ImageIcon("ruijie.jpg");
JLabel lblImage = new JLabel(image);
JLabel lblSupplicant = new JLabel("Supplicant 3.95");
JLabel lblUserName = new JLabel("用户名");
JLabel lblPassword = new JLabel("密码");
JLabel lblLanguage = new JLabel("language");
JLabel lblNet = new JLabel("网络");
JComboBox cboLanguage = new JComboBox(strLanguage);
JComboBox cboNet = new JComboBox(strNet);
JButton button1 = new JButton("连接");
JButton button2 = new JButton("退出");
JButton button3 = new JButton("消息管理");
JButton button4 = new JButton("设置");
public RuijieFrame(){
box1=Box.createVerticalBox();
box1.add(lblSupplicant);
box1.add(Box.createVerticalStrut(12));
box1.add(lblUserName);
box1.add(Box.createVerticalStrut(12));
box1.add(lblPassword);
box1.add(Box.createVerticalStrut(12));
box1.add(lblLanguage);
box1.add(Box.createVerticalStrut(12));
box1.add(lblNet);
box1.add(Box.createVerticalStrut(12));
box2=Box.createVerticalBox();
box2.add(new JLabel(" "));
box2.add(Box.createVerticalStrut(5));
box2.add(new JTextField(20));
box2.add(Box.createVerticalStrut(5));
box2.add(new JPasswordField(20));
box2.add(Box.createVerticalStrut(5));
box2.add(cboLanguage);
box2.add(Box.createVerticalStrut(5));
box2.add(cboNet);
box2.add(Box.createVerticalStrut(5));
baseBox=Box.createHorizontalBox();
baseBox.add(box1);
baseBox.add(Box.createHorizontalStrut(6));
baseBox.add(box2);
pnlNorth.add(lblImage);//添加图片
pnlSOUTH.setLayout(new FlowLayout(FlowLayout.CENTER,15,10));
pnlSOUTH.add(button1);
pnlSOUTH.add(button2);
pnlSOUTH.add(button3);
pnlSOUTH.add(button4);
pnlCenter.add(baseBox);
add(pnlNorth,BorderLayout.NORTH);
add(pnlCenter);
add(pnlSOUTH,BorderLayout.SOUTH);
button2.addActionListener(this);//注册监听器
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); //windows界面风格
} catch (Excepti
相关新闻>>
- 发表评论
-
- 最新评论 更多>>