JavaGUI编程-程序员宅基地

技术标签: 面试  java  Java篇  idea  后端  考研  开发语言  

目录

GUI概念

Swing概念

组件

容器组件

窗口(JFrame)

代码

运行

面板(JPanel)

代码

运行

布局管理器

FlowLayout

代码

运行

BorderLayout

 代码

运行

GridLayout

代码

运行

常用组件 

标签(JLabel)

代码 

运行

单行文本(JTextField)

代码

运行

多行文本框(JTextArea)  滚动面板(JScrollPane)

代码 

运行

 ​编辑

密码框(JPasswordField)

代码 

运行

按钮(JButton)

代码 

运行

菜单栏组件--菜单组件--菜单项组件

代码 

运行

事件处理

事件:

代码 

运行

代码

运行

对话框

代码

运行 

内部类

概念:

特点:

匿名内部类:

内部类意义:

1.封装性

2.实现多继承


GUI概念

GUI(Graphical  User  Interface):图形用户界面--->java提供的图形用户界面

UI---用户界面

图形界面是方便用户操作的。

Swing概念

javax.swing包

此包中包含了java主要的图形界面的实现类

组件

容器组件--窗口,面板,对话框--容器

功能组件--按钮  输入框  菜单......

容器组件

功能组件不能独立地显示出来,必须将组件放在一定的容器(container)中才 可以显示出来。

容器可以容纳多个组件,通过调用容器的add(Component comp)方法向容 器中添加组件。

窗口(JFrame)和面板(JPanel)是最常用的两个容器。

窗口(JFrame)

代码

package com.ffyc.javagui.frame;

import javax.swing.*;
import java.awt.*;

public class LoginFrame extends JFrame {

    public LoginFrame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        //创建了一个窗口对象
        new LoginFrame();
    }
}

运行

面板(JPanel)

代码

package com.ffyc.javagui.panel;

import javax.swing.*;
import java.awt.*;

public class Demo1Frame extends JFrame {

    public Demo1Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();
        //背景颜色布置
        jPanel.setBackground(new Color(111, 161, 136, 255));
        //创建一个按钮组件
        JButton jButton = new JButton("按钮");
        //向面板上添加其他组件
        jPanel.add(jButton);
        //把面板添加到窗口上
        this.add(jPanel);

        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        //创建了一个窗口对象
        new Demo1Frame();
    }
}

运行

布局管理器

Java中的图形界面在布局管理上采用容器和布局管理相分离的方案,也就是说容器只是把组件放进来,但它不管怎样放置。至于如何放置需要 用到布局管理器(Container) 。Java中有几种常用的布局管理器,分 别是:FlowLayout , BorderLayout, GridLayout。

FlowLayout

          FlowLayout:流水布局  也是面板默认的布局方式 
                     把组件放在一排,从左到右排放,一行占满后,重新开启一行
                     面板默认流式布局是水平居中的 

代码

package com.ffyc.javagui.panel;

import javax.swing.*;
import java.awt.*;

public class Demo2Frame extends JFrame {

    public Demo2Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);
        //设置内容水平对齐方式
        //JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        //设置组件之间水平,垂直间距
        JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT,10,30));
        JButton jButton1 = new JButton("按钮1");
        JButton jButton2 = new JButton("按钮2");

        jPanel.add(jButton1);
        jPanel.add(jButton2);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        //创建了一个窗口对象
        new Demo2Frame();
    }
}

运行

BorderLayout

          BorderLayout边界布局:  

            总共有5个区域,每个全用于可以放置一个组件,并且占满整个区域,
            中间区域是必须的,其他几个区域按需使用
            添加组件时可以指定组件位置,如果不指定,默认添加到中间区域 

 代码

package com.ffyc.javagui.panel;

import javax.swing.*;
import java.awt.*;

public class Demo3Frame extends JFrame {

    public Demo3Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false); 
        JPanel jPanel = new JPanel(new BorderLayout());
        JButton jButton1 = new JButton("按钮1");
        JButton jButton2 = new JButton("按钮2");
        JButton jButton3 = new JButton("按钮3");
        JButton jButton4 = new JButton("按钮4");
        JButton jButton5 = new JButton("按钮5");

        jPanel.add(jButton1,BorderLayout.NORTH);
        jPanel.add(jButton2,BorderLayout.SOUTH);
        //jPanel.add(jButton3,BorderLayout.WEST);
        jPanel.add(jButton4,BorderLayout.EAST);
        jPanel.add(jButton5,BorderLayout.CENTER);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        //创建了一个窗口对象
        new Demo3Frame();
    }
}

运行

GridLayout

          GridLayout网格布局: 
            网格就类似与一个表格,可以设置行数和列数
            每个网格中只能放一个组件,占满整个区域
            从第一行开始摆放,每一行占满后,再开启第二行

代码

package com.ffyc.javagui.panel;

import javax.swing.*;
import java.awt.*;

public class Demo4Frame extends JFrame {

    public Demo4Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);
 
        JPanel jPanel = new JPanel(new GridLayout(2,2));
        JButton jButton1 = new JButton("按钮1");
        JButton jButton2 = new JButton("按钮2");
        JButton jButton3 = new JButton("按钮3");
        JButton jButton4 = new JButton("按钮4");

        jPanel.add(jButton1);
        jPanel.add(jButton2);
        jPanel.add(jButton3);
        jPanel.add(jButton4);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        //创建了一个窗口对象
        new Demo4Frame();
    }
}

运行

常用组件 

标签(JLabel)

标签是容纳文本和图标的控件,通常用来在界面中标识别的控件。

代码 

package com.ffyc.javagui.component;

import javax.swing.*;
import java.awt.*;

public class Component1Frame extends JFrame{

    public Component1Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();

        //标签组件,用来放置文字
        JLabel jLabel = new JLabel("账号");
        //设置字体
        jLabel.setFont(new Font("楷体", Font.BOLD, 20));
        //设置字体颜色
        jLabel.setForeground(new Color(20,30,40));

        jPanel.add(jLabel);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Component1Frame();
    }
}

运行

单行文本(JTextField)

代码

package com.ffyc.javagui.component;

import javax.swing.*;
import java.awt.*;

public class Component1Frame extends JFrame{

    public Component1Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();

        //单行文本框组件  设置列数 列宽
        JTextField jTextField = new JTextField(15);
        //获得文本框中输入的内容
        jTextField.getText();

        jPanel.add(jTextField);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Component1Frame();
    }
}

运行

多行文本框(JTextArea)  滚动面板(JScrollPane)

代码 

package com.ffyc.javagui.component;

import javax.swing.*;
import java.awt.*;

public class Component2Frame extends JFrame{

    public Component2Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();

        //多行文本框组件(文本域)
        JTextArea jTextArea = new JTextArea(5,20);
        //设置强制换行
        jTextArea.setLineWrap(true);
        //带滚动条的面板  把多行文本框组件加进来
        JScrollPane jsp = new JScrollPane(jTextArea);

        jPanel.add(jsp);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Component2Frame();
    }
}

运行

 

密码框(JPasswordField)

代码 

package com.ffyc.javagui.component;

import javax.swing.*;
import java.awt.*;

public class Component3Frame extends JFrame{

    public Component3Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();

        JLabel passwordjLabel = new JLabel("密码");
        JPasswordField jPasswordField = new JPasswordField(15);
        //获得输入的密码
        char[] password = jPasswordField.getPassword();

        jPanel.add(passwordjLabel);
        jPanel.add(jPasswordField);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Component3Frame();
    }
}

运行

按钮(JButton)

代码 

package com.ffyc.javagui.component;

import javax.swing.*;
import java.awt.*;

public class Component3Frame extends JFrame{

    public Component3Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();
 
        JButton jButton = new JButton("登录");
        //禁用按钮
        jButton.setEnabled(false);
        //按钮提示
        jButton.setToolTipText("点击登录");

        jPanel.add(jButton);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Component3Frame();
    }
}

运行

菜单栏组件--菜单组件--菜单项组件

代码 

package com.ffyc.javagui.component;

import javax.swing.*;
import java.awt.*;

public class Component4Frame extends JFrame{

    public Component4Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();

        //菜单栏  菜单  菜单项
        JMenuBar jMenuBar = new JMenuBar();

        //把菜单栏添加到窗口
        this.setJMenuBar(jMenuBar);
        //创建菜单
        JMenu jMenu1 = new JMenu("文件");
        JMenu jMenu2 = new JMenu("编辑");
        JMenu jMenu3 = new JMenu("帮助");

        //创建菜单项
        JMenuItem jMenuItem1 = new JMenuItem("新建");
        JMenuItem jMenuItem2 = new JMenuItem("保存");
        JMenuItem jMenuItem3 = new JMenuItem("剪切");
        JMenuItem jMenuItem4 = new JMenuItem("复制");
        JMenuItem jMenuItem5 = new JMenuItem("关于我们");

        //把菜单项添加到菜单中
        jMenu1.add(jMenuItem1);
        jMenu1.add(jMenuItem2);
        jMenu2.add(jMenuItem3);
        jMenu2.add(jMenuItem4);
        jMenu3.add(jMenuItem5);

        jMenuBar.add(jMenu1);
        jMenuBar.add(jMenu2);
        jMenuBar.add(jMenu3);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Component4Frame();
    }
}

运行

事件处理

对于采用了图形用户界面的程序来说,事件控制是非常重要的;到目前 为止,我们编写的图形用户界面程序都仅仅只是完成了界面,而没有任 何实际的功能,要实现相应的功能,必须进行事件处理;

用户与GUI组件进行交互就会发生事件,如:按下一个按钮、用键盘输 入一个字符、点击鼠标等等;

当前我们要关注的并不是“事件是如何产生的” ,而是讨论当发生事件 后,我们应当“如何处理” 。

事件:

监听器:监听组件有没有事件产生

一旦点击了某个按钮产生事件,监听器就捕获到这次事件,从而去调用对应的事件处理程序

代码 

外部类A为组件添加事件处理程序,过于繁琐,一般不用

package com.ffyc.javagui.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class A implements ActionListener {
    @Override
    public void actionPerformed(ActionEvent e) {

    }
}

使用内部类或匿名内部类 

package com.ffyc.javagui.listener;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Demo1Frame extends JFrame {

    public Demo1Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();
        JTextField jTextField = new JTextField(15);
        JButton jButton = new JButton("登录");

        jPanel.add(jTextField);
        jPanel.add(jButton);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);

        //为组件添加事件处理程序 
        //jButton.addActionListener(new B());
        //new  接口  创建一个匿名内部类,是为了简化语法
        jButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                System.out.println(jTextField.getText());
            }
        });
    }
    //内部类
    /*class B implements ActionListener {

        @Override
        public void actionPerformed(ActionEvent e) {

        }
    }*/ 
    public static void main (String[] args) {
        //创建了一个窗口对象
        new Demo1Frame();
    }
}

运行

输入后,点击登录,输入空格返回空格,输入内容返回内容

代码

package com.ffyc.javagui.listener;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Demo2Frame extends JFrame {

    public Demo2Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();
        JTextField jTextField = new JTextField(15);
        JButton jButton = new JButton("登录");
        jButton.setEnabled(false);

        jPanel.add(jTextField);
        jPanel.add(jButton);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);

        //为文本框添加事件监听
        jTextField.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                System.out.println("按键按下了"+e.getKeyChar()+":"+e.getKeyCode());
                jButton.setEnabled(true);
            }
        });

        //为菜单项添加事件的监听以及事件的处理程序
        //鼠标处理事件 共有5种
        jButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                System.out.println("鼠标点击触发 -- 一次按下不抬起");
            }

            @Override
            public void mousePressed(MouseEvent e) {
                System.out.println("鼠标按下");
            }

            @Override
            public void mouseReleased(MouseEvent e) {
                System.out.println("鼠标释放 按键抬起");
            }

            @Override
            public void mouseEntered(MouseEvent e) {
                System.out.println("鼠标移入到标签上");
            }

            @Override
            public void mouseExited(MouseEvent e) {
                System.out.println("鼠标移除标签");
            }
        });
    }
    public static void main (String[] args) {
        //创建了一个窗口对象
        new Demo2Frame();
    }
}

运行

对话框

代码

package com.ffyc.javagui.listener;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Demo3Frame extends JFrame {

    public Demo3Frame() throws HeadlessException {
        //添加标题
        this.setTitle("欢迎登录");
        //设置宽高
        this.setSize(300, 300);
        //自定义坐标位置
        this.setLocation(200, 400);
        //水平垂直居中
        this.setLocationRelativeTo(null);
        //关闭窗口时退出程序
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置禁止窗口设置拖拽调整大小
        this.setResizable(false);

        //创建一个面板
        JPanel jPanel = new JPanel();
        JTextField jTextField = new JTextField(15);
        JButton jButton = new JButton("登录");

        jPanel.add(jTextField);
        jPanel.add(jButton);

        //把面板添加到窗口上
        this.add(jPanel);
        //让窗口显示,放在设置的最后一行
        this.setVisible(true);

        //为组件添加事件处理程序
        //jButton.addActionListener(new B());
        //new  接口  创建一个匿名内部类,是为了简化语法
        jButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //获得文本框输入内容
                String account = jTextField.getText();
                if(account.length() == 0){
                    //消息提示框
                    //JOptionPane.showMessageDialog(null, "请输入账号!");
                    //JOptionPane.showMessageDialog(null, "请输入账号!","操作提示",JOptionPane.WARNING_MESSAGE);

                    int res = JOptionPane.showConfirmDialog(null, "你确定要退出吗?","操作提示",JOptionPane.OK_CANCEL_OPTION);
                    //点击确定返回0,点击取消返回2
                    System.out.println(res);
                    if(res==0){
                        //执行退出操作
                    }
                    return;
                }
                if(account.length() < 6 || account.length() > 6){
                    JOptionPane.showMessageDialog(null, "请输入一个6-10位之间的账号!");
                    return;
                }
            }
        });
    }

    public static void main (String[] args) {
        //创建了一个窗口对象
        new Demo3Frame();
    }
}

运行 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/2303_77543831/article/details/136984125

智能推荐

c# 调用c++ lib静态库_c#调用lib-程序员宅基地

文章浏览阅读2w次,点赞7次,收藏51次。四个步骤1.创建C++ Win32项目动态库dll 2.在Win32项目动态库中添加 外部依赖项 lib头文件和lib库3.导出C接口4.c#调用c++动态库开始你的表演...①创建一个空白的解决方案,在解决方案中添加 Visual C++ , Win32 项目空白解决方案的创建:添加Visual C++ , Win32 项目这......_c#调用lib

deepin/ubuntu安装苹方字体-程序员宅基地

文章浏览阅读4.6k次。苹方字体是苹果系统上的黑体,挺好看的。注重颜值的网站都会使用,例如知乎:font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, W..._ubuntu pingfang

html表单常见操作汇总_html表单的处理程序有那些-程序员宅基地

文章浏览阅读159次。表单表单概述表单标签表单域按钮控件demo表单标签表单标签基本语法结构<form action="处理数据程序的url地址“ method=”get|post“ name="表单名称”></form><!--action,当提交表单时,向何处发送表单中的数据,地址可以是相对地址也可以是绝对地址--><!--method将表单中的数据传送给服务器处理,get方式直接显示在url地址中,数据可以被缓存,且长度有限制;而post方式数据隐藏传输,_html表单的处理程序有那些

PHP设置谷歌验证器(Google Authenticator)实现操作二步验证_php otp 验证器-程序员宅基地

文章浏览阅读1.2k次。使用说明:开启Google的登陆二步验证(即Google Authenticator服务)后用户登陆时需要输入额外由手机客户端生成的一次性密码。实现Google Authenticator功能需要服务器端和客户端的支持。服务器端负责密钥的生成、验证一次性密码是否正确。客户端记录密钥后生成一次性密码。下载谷歌验证类库文件放到项目合适位置(我这边放在项目Vender下面)https://github.com/PHPGangsta/GoogleAuthenticatorPHP代码示例://引入谷_php otp 验证器

【Python】matplotlib.plot画图横坐标混乱及间隔处理_matplotlib更改横轴间距-程序员宅基地

文章浏览阅读4.3k次,点赞5次,收藏11次。matplotlib.plot画图横坐标混乱及间隔处理_matplotlib更改横轴间距

docker — 容器存储_docker 保存容器-程序员宅基地

文章浏览阅读2.2k次。①Storage driver 处理各镜像层及容器层的处理细节,实现了多层数据的堆叠,为用户 提供了多层数据合并后的统一视图②所有 Storage driver 都使用可堆叠图像层和写时复制(CoW)策略③docker info 命令可查看当系统上的 storage driver主要用于测试目的,不建议用于生成环境。_docker 保存容器

随便推点

网络拓扑结构_网络拓扑csdn-程序员宅基地

文章浏览阅读834次,点赞27次,收藏13次。网络拓扑结构是指计算机网络中各组件(如计算机、服务器、打印机、路由器、交换机等设备)及其连接线路在物理布局或逻辑构型上的排列形式。这种布局不仅描述了设备间的实际物理连接方式,也决定了数据在网络中流动的路径和方式。不同的网络拓扑结构影响着网络的性能、可靠性、可扩展性及管理维护的难易程度。_网络拓扑csdn

JS重写Date函数,兼容IOS系统_date.prototype 将所有 ios-程序员宅基地

文章浏览阅读1.8k次,点赞5次,收藏8次。IOS系统Date的坑要创建一个指定时间的new Date对象时,通常的做法是:new Date("2020-09-21 11:11:00")这行代码在 PC 端和安卓端都是正常的,而在 iOS 端则会提示 Invalid Date 无效日期。在IOS年月日中间的横岗许换成斜杠,也就是new Date("2020/09/21 11:11:00")通常为了兼容IOS的这个坑,需要做一些额外的特殊处理,笔者在开发的时候经常会忘了兼容IOS系统。所以就想试着重写Date函数,一劳永逸,避免每次ne_date.prototype 将所有 ios

如何将EXCEL表导入plsql数据库中-程序员宅基地

文章浏览阅读5.3k次。方法一:用PLSQL Developer工具。 1 在PLSQL Developer的sql window里输入select * from test for update; 2 按F8执行 3 打开锁, 再按一下加号. 鼠标点到第一列的列头,使全列成选中状态,然后粘贴,最后commit提交即可。(前提..._excel导入pl/sql

Git常用命令速查手册-程序员宅基地

文章浏览阅读83次。Git常用命令速查手册1、初始化仓库git init2、将文件添加到仓库git add 文件名 # 将工作区的某个文件添加到暂存区 git add -u # 添加所有被tracked文件中被修改或删除的文件信息到暂存区,不处理untracked的文件git add -A # 添加所有被tracked文件中被修改或删除的文件信息到暂存区,包括untracked的文件...

分享119个ASP.NET源码总有一个是你想要的_千博二手车源码v2023 build 1120-程序员宅基地

文章浏览阅读202次。分享119个ASP.NET源码总有一个是你想要的_千博二手车源码v2023 build 1120

【C++缺省函数】 空类默认产生的6个类成员函数_空类默认产生哪些类成员函数-程序员宅基地

文章浏览阅读1.8k次。版权声明:转载请注明出处 http://blog.csdn.net/irean_lau。目录(?)[+]1、缺省构造函数。2、缺省拷贝构造函数。3、 缺省析构函数。4、缺省赋值运算符。5、缺省取址运算符。6、 缺省取址运算符 const。[cpp] view plain copy_空类默认产生哪些类成员函数

推荐文章

热门文章

相关标签