简单的锐捷登录界面

来源:IT的点点滴滴 责任编辑:栏目编辑 发表时间:2013-07-01 09:24 点击:

最近学了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

    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • Java编程语言的八大优点
      • JVM对象生命周期详细介绍
      • Java平台上的CRM系统
      • Java 算数测试小程序
      • Command(命令模式)
      • Java 一个简单的画图程序
      • Java环境 使用Resin在NT环境下配置JSP环境
      • Java 日历的小程序
      • Java 统计代码的小工具
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1