⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 新建 文本文档.txt

📁 JAVA小程序
💻 TXT
字号:
import java.awt.*;
import java.awt.event.*;
import java.text.DateFormat;
import java.util.Date;
import javax.swing.*;

public class SecurityPanel extends JFrame
{

    private JLabel securityCodeJLabel;
    private JPasswordField securityCodeJPasswordField;

    private JButton oneJButton;
    private JButton twoJButton;
    private JButton threeJButton;
    private JButton fourJButton;
    private JButton fiveJButton;
    private JButton sixJButton;
    private JButton sevenJButton;
    private JButton eightJButton;
    private JButton nineJButton;
    private JButton clearJButton;
    private JButton zeroJButton;
    private JButton enterJButton;

    private JLabel accessLogJLabel;
    private JTextArea accessLogJTextArea;
    private JScrollPane accessLogJScrollPane;

    public SecurityPanel()
    {

        creatUserInterface();
    }

    private voidcreateUserInterface()
    {

        Container contentPane = getContentPane();
        contentPane.setLayout(null);

        securityCodeJLabel = new JLabel();
        securityCodeJLabel.setBounds(16,16,90,21);
        securityCodeJLabel.setText("Security code:");
        contentPane.add(securityCodeJLabel);

        securityCodeJPasswordField = new JPasswordField();
        securityCodeJPasswordField.setBounds(114,16,172,26);
        securityCodeJPasswordField.setEditable(false);
        contentPane.add(securityCodeJPasswordField);

        oneJButton = new JButton();
        oneJButton.setBounds(80,64,50,50);
        oneJButton.setText("1");
        contentPane.add(oneJButton);
        oneJButton.addActionListener(

           new ActionListener()
           {

               public void actionPerformed(ActionEvent event)
               {

                    oneJButtonActionPerformed(event);
               }

            }
 
        );

        twoJButton = new JButton();
        twoJButton.setBounds(130,64,50,50);
        twoJButton.setText("2");
        contentPane.add(twoJButton);
        twoJButton.addActionListener(

           new ActionListener()
           {

               public void actionPerformed(ActionEvent event)
               {

                    twoJButtonActionPerformed(event);
               }

           }

        );
        
        threeJButton = new JButton();
        threeJButton.setBounds(180,64,50,50);
        threeJButton.setText("3");
        contentPane.add(threeJButton);
        threeJButton.addActionListener(

           new ActionListener()
           {

               public void actionPerformed(ActionEvent event)
               {

                   threeJButtonActionPerformed(event);
                }

           }
 
        );

        fourJButton = new JButton();
        fourJButton.setBounds(80,114,50,50);
        fourJButton.setText("4");
        contentPane.add(fourJButton);
        fourJButton.addActionListener(

           new ActionListener()
           {

                public void actionPerformed(ActionEvent event)
                {

                    fourJButtonActionPerformed(event);
                 }

            }

        );

        fiveJButton = new JButton();
        fiveJButton.setBounds(130,114,50,50);
        fiveJButton.setText("5");
        contentPane.add(fiveJButton);
        fiveJButton.addActionListener(
              
            new ActionListener()
            {

                public void actionPerformed(ActionEvent event)
                {

                    fiveJButtonActionPerformed(event);
                }

            }

        );

        sixJButton = new JButton();
        sixJButton.setBounds(180,114,50,50);
        sixJButton.setText("6");
        contentPane.add(sixJButton);
        sixJButton.addAcitonListener(
            
            new ActionListener()
            {

               public void actionPerformed(ActionEvent event)
               {

                   sixJButtonActionPerformed(event);
               }

            }

        );

        sevenJButton = new JButton();
        sevenJButton.setBounds(80,164,50,50);
        sevenJButton.setText("7");
        contentPane.add(sevenJButton);
        sevenJButton.addActionListener(

           new ActionListener()
           {

               pubilc void actionPerformed(ActionEvent event)
               {

                   sevenJButtonActionPerformed(event);
               }

            }

        );  

        eightJButton = new JButton();
        eightJButton.setBounds(130,164,50,50);
        eightJButton.setText("8");
        contentPane.add(eightJButton);
        eightJButton.addActionListener(

            new ActionListener()
            {

                public void actionPerformed(ActionEvent event)
                {

                      eightJButtonActionPerformed(event);
                }

             }

        );

        nineJButton = new JButton();
        nineJButton.setBounds(180,164,50,50);
        nineJButton.setText("9");
        contentPane.add(nineJButton);
        nineJButton.addActionListener(

            new ActionListener()
            {

                public void actionPerformed(ActionEvent event)
                {
         
                     nineJButtonActionPerformed(event);
                }

            }

        );

        clearJButton = new JButton();
        clearJButton.setBounds(80,214,50,50);
        clearJButton.setText("C");
        contentPane.add(clearJButton);
        clearJButton.addActionListener(

            new ActionListener()
            {

                public void actionPerfomed(ActionEvent event)
                {

                     clearJButtonActionPerformed(event);
                }

            }

        );

        zeroJButton = new JButton();
        zeroJButton.setBounds(130,214,50,50);
        zeroJButton.setText("0");
        contentPane.add(zeroJButton);
        zeroJButton.addActionListener(

           new ActionListener()
           {

               public void actionPerformed(ActionEvent event)
               {

                   zeroJButtonActionPerformed(event);
               }

           }

        );

        enterJButton = new JButton();
        enterJButton.setBounds(180,214,50,50);
        enterJButton.setText("#");
        contentPane.add(enterJButton);
        enterJButton.addActionListener(
            
           new ActionListener()
           {

               public void actionPerformed(ActionEvent event)
               {

                    enterJButtonActionPerformed(event);
               }

           }

        );

        accessLogJLabel= new JLabel();
        accessLogJLabel.setBounds(16,285,100,16);
        accessLogJLabel.setText("Access log");
        contentPane.add(accessLogJLabel);
  
        accessLogJTextArea = new JTextArea();

        accessLogJScrollPane = new JScrollPane(accessLogJTextArea);
        accessLogJScrollPane.setBounds(16,309,270,95);
        contentPane.add(accessLogJScrollPane);

        setTitle("Security Panel");
        setSize(310,450);
        setVisible(true);
    
    }

    private void oneJButtonActionPerformed(ActionEvent event)
    {

         securityCodeJPasswordField.setText(String.valueOf())



 

    












































































⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -