enddialog.java

来自「贪吃蛇网络版 运行平台 LINUX/UNIX Macintosh Window」· Java 代码 · 共 82 行

JAVA
82
字号
package ui;

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

import javax.swing.*;
import java.awt.BorderLayout;
import javax.swing.BoxLayout;
import java.awt.GridLayout;

import logic.SnakeServer;

public class EndDialog extends JFrame{
	
	private JButton contButton;
	private JButton endButton;
	private JPanel tile;
	private String[] playerName;
	
	public EndDialog() {
		initialize();
	}
	
	public EndDialog(String[] name) {
		this();
		playerName = name;
		
		endButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new ResultUI(playerName);

				dispose();
			}
			
		});
		
		contButton.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent e) {
				dispose();
			}
			
			
		});
		
	}


	/**
	 * This method initializes this
	 * 
	 */
	private void initialize() {
        GridLayout gridLayout = new GridLayout();
        gridLayout.setRows(1);
        this.setSize(new java.awt.Dimension(332,188));
        this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
        this.setTitle("Quit");
        
        contButton = new JButton();
        contButton.setText("continue");
        endButton = new JButton();
        endButton.setText("quit");
        tile = new JPanel();
        tile.setLayout(gridLayout);
        tile.add(contButton, null);
        tile.add(endButton, null);
        
        getContentPane().add(tile);
        
        setVisible(true);
        this.setContentPane(tile);
        
			
	}
	

	
	

}  //  @jve:decl-index=0:visual-constraint="10,10"

⌨️ 快捷键说明

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