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

📄 first.java~45~

📁 这是我最得意的一件小作品。它是一个基于C/S模式的网络考试系统
💻 JAVA~45~
字号:
package testsystem;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class first extends Frame implements ActionListener
{
    static first frm=new first();
    static Button bt1=new Button("变色");
    static Button  bt2=new Button("关闭");

    public static void main(String[] args)
    {
        frm.setLayout(new FlowLayout());
        frm.setSize(200,300);
        frm.setLocation(300,300);
        frm.add(bt1);
        frm.add(bt2);
        bt1.addActionListener(frm);
        bt2.addActionListener(frm);
        frm.setVisible(true);

    }


    public void actionPerformed(ActionEvent e)
    {
        if(e.getSource()==bt1)
        {
            if(frm.getBackground()==Color.cyan)
            frm.setBackground(Color.red);
            if(frm.getBackground()==Color.red)
            frm.setBackground(Color.cyan);
        }
        else
        {
            System.exit(0);
        }


    }
}

⌨️ 快捷键说明

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