📄 informdialog.java
字号:
package ergo.ui;
// $Id: InformDialog.java,v 1.2 1999/08/13 01:20:08 sigue Exp $
/*
* Copyright (C) 1999 Carl L. Gay and Antranig M. Basman.
* See the file copyright.txt, distributed with this software,
* for further information.
*/
import ergo.*;
import ergo.util.*;
import ergo.server.*;
import ergo.logic.*;
import java.awt.*;
import java.awt.event.*;
/**
* Shows a message and an OK button for confirmation.
* Adds a Label for each line of text.
*/
class InformDialog extends ErgoDialog implements ActionListener {
private Button okButton = new Button(" OK ");
InformDialog (Frame frame, String title, int alignment, String[] message) {
super(frame, title, true); // modal
initialize(alignment, message);
}
// Deal with a single, possibly multi-line message.
InformDialog (Frame frame, String title, String message) {
super(frame, title, true); // modal
initialize(ColumnLayout.LEFT, Util.splitIntoLines(message));
}
private void initialize (int alignment, String[] message) {
okButton.addActionListener(this);
if (message != null) {
Panel c = new Panel();
c.setLayout(new ColumnLayout(alignment, 0, 10, false)); // vspace, margin
for (int i = 0; i < Math.min(message.length, 20); i++)
c.add(new Label(message[i], Label.CENTER), null);
add("North", c);
}
Panel p = new Panel();
p.add(okButton);
add("South", p);
}
public void actionPerformed (ActionEvent e) {
close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -