📄 ldhelpdialog.java
字号:
/**
* Copyright (C) 2006, Laboratorio di Valutazione delle Prestazioni - Politecnico di Milano
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package jmt.gui.exact.ld;
import jmt.gui.exact.ld.eval.Evaluator;
import jmt.gui.exact.utils.BrowserControl;
import jmt.gui.wizard.Wizard;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import java.awt.*;
import java.awt.event.ActionEvent;
/**
* @author alyf (Andrea Conti)
* Date: 20-set-2003
* Time: 14.44.38
*/
/**
* the "help" dialog for the LD editor
*/
public class LDHelpDialog extends JDialog {
private Dialog owner;
private static final String generalHelp = "<html>To enter values, single-click on the desired cell" +
" and start typing.<br> To select multiple cells drag the mouse on them; click or drag on" +
" row/column headers to select whole rows/columns.<br> <b>For a list of the available operations right-click" +
" on the table</b>; all operations except pasting affect selected cells.<br>" +
" To copy one value to multiple cells click on the cell containing the value, select the" +
" target cells by dragging and select <b>Fill</b>.<br>" +
" <b>Copy down</b> copies the value in the focused cell down to all cells in the same column." +
"<br><br>The expression evaluator allows you to automatically set service times as a function of the number of" +
" customers. Just select the cells you want to fill, enter an expression and press Enter or click <b>Evaluate</b>.<br>" +
" For detailed information on expression syntax and supported functions select the <b>Evaluator</b> tab above.</html>";
/*" Cells can be filled by evaluating a mathematical expression:<br> enter it in the text field,"+
" make sure the desired cells are selected and click on <b>\"Evaluate\"</b>.<br><br>";*/
private String evalHelp;
private AbstractAction close = new AbstractAction("OK") {
public void actionPerformed(ActionEvent e) {
hide();
}
};
public LDHelpDialog(Dialog owner, Evaluator eval) {
super(owner, "Help", true);
this.owner = owner;
evalHelp = eval.getHelpText();
setSize(600, 400);
setResizable(false);
Wizard.centerOnScreen(this);
initComponents();
setDefaultCloseOperation(HIDE_ON_CLOSE);
}
private void initComponents() {
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
JPanel butPane = new JPanel();
butPane.add(new JButton(close), BorderLayout.SOUTH);
cp.add(butPane, BorderLayout.SOUTH);
JTabbedPane jtp = new JTabbedPane();
JPanel general = new JPanel(new BorderLayout());
JLabel ghelp = new JLabel(generalHelp);
ghelp.setHorizontalAlignment(SwingConstants.CENTER);
ghelp.setVerticalAlignment(SwingConstants.CENTER);
JLabel icon = new JLabel(UIManager.getIcon("OptionPane.informationIcon"));
Box lbox = Box.createHorizontalBox();
lbox.add(Box.createHorizontalStrut(10));
lbox.add(icon);
lbox.add(Box.createHorizontalStrut(10));
general.add(ghelp, BorderLayout.CENTER);
general.add(lbox, BorderLayout.WEST);
general.add(Box.createHorizontalStrut(10), BorderLayout.EAST);
jtp.add("General", general);
JPanel evaluator = new JPanel(new BorderLayout());
JEditorPane ehelp = new JEditorPane("text/html", evalHelp);
ehelp.setEditable(false);
ehelp.setCaretPosition(0);
ehelp.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
BrowserControl.displayURL(e.getURL().toString());
}
}
});
evaluator.add(Box.createHorizontalStrut(10), BorderLayout.WEST);
evaluator.add(new JScrollPane(ehelp), BorderLayout.CENTER);
evaluator.add(Box.createHorizontalStrut(10), BorderLayout.EAST);
jtp.add("Evaluator", evaluator);
cp.add(jtp, BorderLayout.CENTER);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -