菜单

4166am金沙下载设定二个登录窗口

2020年1月19日 - 4166m金沙

import  java.swing.*;

Manage m=new Manage();提示 Multiple markers at this line,Manage can not be resolved to a type,
package com.test;import java.awt.Dimension;import
java.awt.Toolkit;import java.awt.event.ActionEvent;import
java.awt.event.ActionListener;import java.io.IOException;import
javax.swing.ButtonGroup;import javax.swing.JButton;import
javax.swing.JFrame;import javax.swing.JLabel;import
javax.swing.JOptionPane;import javax.swing.JPanel;import
javax.swing.JPasswordField;import javax.swing.JRadioButton;import
javax.swing.JTextField;/** * 教 师: * 账号:143821 *
密码:143821 * * 管理员: *4166am金沙下载, 账号:14 * 密码:123 * * 学 生: *
账号:学号 * 密码:学号 */public class Login extends JFrame { public
static void main(String[] args) { // TODO Auto-generated method stub
final boolean[] rb=new boolean[3]; final String userName = “abc”;
final String passwrod = “123”; JFrame jFrame = new
JFrame(“教务管理系统–登陆界面”);// jFrame.setSize(1000,1000); Dimension
dimension = Toolkit.getDefaultToolkit().getScreenSize();
jFrame.setBoundsdimension.getWidth / 2, dimension.getHeight / 2, 220,
180); //去掉最大化 jFrame.setResizable; jFrame.setLayout;
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label1 =
new JLabel; label1.setBounds(10, 10, 100, 30); jFrame.add; JLabel label2
= new JLabel; label2.setBounds(10, 40, 100, 30); jFrame.add; final
JTextField text1 = new JTextField(); text1.setBounds(50, 15, 150, 20);
jFrame.add; final JPasswordField text2 = new JPasswordField();
text2.setBounds(50, 45, 150, 20); jFrame.add; JRadioButton rb1=new
JRadioButton; JRadioButton rb2=new JRadioButton; JRadioButton rb3=new
JRadioButton; JPanel jp=new JPanel(); jp.add; jp.add; jp.add;
jp.setBounds(0, 75, 220, 40); jFrame.add; ButtonGroup group = new
ButtonGroup();// 创建单选按钮组 group.add;//
将radioButton1增加到单选按钮组中 group.add;//
将radioButton2增加到单选按钮组中 group.add;//
将radioButton3增加到单选按钮组中 rb1.addActionListener(new
ActionListener(){ public void actionPerformed(ActionEvent e) { // TODO
Auto-generated method stub
if(“14″.equals(text1.getText&&”123”.equals(text2.getText rb[0]=true; }
}); rb2.addActionListener(new ActionListener(){ public void
actionPerformed(ActionEvent e) { // TODO Auto-generated method stub
if(“143821″.equals(text1.getText&&”143821”.equals(text2.getText
rb[1]=true; }

import  java.awt.*;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JTextFieldDemo extends JFrame implements ActionListener{

class   StringDemo  extends  JFrame{

    JTextField jtf=new
JTextField(10);
    JPasswordField jpf=new
JPasswordField(10);//创建密码框
    JButton jb=new
JButton(“提交”);//创建按钮
    JLabel jl=new
JLabel(“用户名”);//创建标签
    JLabel j2=new
JLabel(“密码”);//创建标签
    JLabel j3=new
JLabel(“等待你的登陆!”);//创建标签
    JPanel jp=new
JPanel();//创建面板
    //定义构造器
    public JTextFieldDemo()
    {
        this.setTitle(“登陆系统”);
        jp.setLayout(null);//采用空布局
        jl.setBounds(30,20,80,30);//设置标签1的位置和大小
        jp.add(jl);
        j2.setBounds(30,70,80,30);//设置标签2的位置和大小
        jp.add(j2);
        jtf.setBounds(80,20,180,30);//设置文本框的位置和大小
        jp.add(jtf);
        jpf.setBounds(80,70,180,30);//设置密码框的位置和大小
        jp.add(jpf);
        jb.setBounds(50,130,80,30);//设置按钮的位置和大小
        jp.add(jb);
        j3.setBounds(10,180,300,30);//设置标签3的位置和大小
        jp.add(j3);
        jb.addActionListener(this);//为文本框注册监听器
        this.add(jp);//将面板添加到窗口中
        this.setBounds(300,250,300,300);//设置窗口的位置和大小
        this.setVisible(true);
    }
    public void actionPerformed(ActionEvent e)
    {
        String s=jtf.getText();//获取文本框的内容
        String s1=new
String(jpf.getPassword());//获取密码框的内容
        if(s.equals(“java”)&&s1.equals(“1234”))
        {
            j3.setText(“登陆成功!”);
        }
        else
        {
            j3.setText(“登陆失败!”);
        }
    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        JTextFieldDemo f=new
JTextFieldDemo();
    }

          String key1  =”郑州标牌厂家”;

}

          String  key2 =”郑州路牌厂家”;

执行结果为:

          String  key3 =”郑州停车场设施”;

4166am金沙下载 1

          String  key4  =”国通标牌”;

 

          String  key5 =”郑州国通交通设施有限公司”;

输入内容后为:

          Label l1,l2,l3,l4,l5;

4166am金沙下载 2

         JPanel  jp;

       public   StringDemo(){

                 setTitle(“国通标牌”);

                 setSize(800,800);

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图