descriptiondialog.java

来自「Dijkstra algorithm in Java.」· Java 代码 · 共 68 行

JAVA
68
字号
/*
 * DescriptionDialog.java
 *
 * Created on April 29, 2007, 4:24 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package termproject_dijkstra;
/**
 *
 * @author Peto
 */

import java.awt.*;
import java.awt.event.*;

public class DescriptionDialog extends Dialog implements ActionListener 
{
    
    Button bt1;
    Panel panel;

    public DescriptionDialog(Frame owner,boolean modal)
    {
        super(owner,modal);
        this.setLayout(new FlowLayout(FlowLayout.LEADING));
        this.setSize(320,240);
        this.setTitle("Dijkstra algorithm");
        this.setResizable(false);
        this.addWindowListener(new ClosingClass(this));
        
        this.add(new Label("Author: Peter Kristof 6.2.2007"));
        this.add(new Label("e-mail: peter.kristof@gmail.com                    "));
        this.add(new Label("Description:                                     "));
        this.add(new Label("    Green sphere - node"));
        this.add(new Label("    Red Sphere - edge orientation"));
        this.add(new Label("    Under Node - Node's name [distance]"));
        
        panel = new Panel();
        panel.setLayout(new FlowLayout(FlowLayout.CENTER));
        panel.add(new Label("                                   "));
        bt1 = new Button("OK");
        panel.add(bt1);        
        bt1.addActionListener(this);
        this.add(panel);
        this.setVisible(true);
    }
    
    class ClosingClass extends WindowAdapter 
    {
        DescriptionDialog m_Dialog;
        ClosingClass(DescriptionDialog dialog)
        {
            m_Dialog = dialog;
        }
        public void windowClosing(WindowEvent e)
        {
            m_Dialog.dispose();
        }
    }    
    
    public void actionPerformed(ActionEvent e)
    {
        this.dispose();
    }
    
}

⌨️ 快捷键说明

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