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

📄 testdialog.java

📁 开发一个用于进行魔方游戏的小型软件。在16个文本域中的4个随机位置上出现不多于二位的随机整数
💻 JAVA
字号:
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

class DialogFrame extends JFrame implements ActionListener{

    JLabel jLabel2 = new JLabel("你成功啦!");
    JLabel jLabel3 = new JLabel("再玩一把么?");
    JButton jButton2 = new JButton("好的");
    JButton jButton3 = new JButton("不了");
 
  
    public DialogFrame(){
    	setTitle("恭喜你");
    	setSize(200,100);
    	addWindowListener(new WL());
    	
    	Container contentPane = getContentPane();
    	
    	contentPane.setLayout(new FlowLayout());
    	contentPane.add(jLabel2);
	    contentPane.add(jLabel3);	    
	    contentPane.add(jButton2);
	    contentPane.add(jButton3);



      jButton2.addActionListener(this);
      jButton3.addActionListener(this);
    }
    public void actionPerformed(ActionEvent e){
    	if(e.getSource() == jButton2) {
        }
        else if(e.getSource() == jButton3) {dispose();
            
         }

  }
}

class WL extends WindowAdapter{
	public void windowClosing(WindowEvent e){System.exit(0);}
}
	
public class TestDialog{
      public static void main(String[] args){
        DialogFrame d = new DialogFrame();  d.setVisible(true);
      }
    }

⌨️ 快捷键说明

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