📄 experimentinfoscreen.java
字号:
/*
* YALE - Yet Another Learning Environment
* Copyright (C) 2001-2004
* Simon Fischer, Ralf Klinkenberg, Ingo Mierswa,
* Katharina Morik, Oliver Ritthoff
* Artificial Intelligence Unit
* Computer Science Department
* University of Dortmund
* 44221 Dortmund, Germany
* email: yale-team@lists.sourceforge.net
* web: http://yale.cs.uni-dortmund.de/
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
package edu.udo.cs.yale.gui;
import javax.swing.*;
import java.awt.event.*;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Frame;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.Component;
import java.util.List;
import java.util.Iterator;
public class ExperimentInfoScreen extends JDialog {
public ExperimentInfoScreen(Frame owner, String file, String text) {
super(owner, "Experiment Info", true);
JPanel rootPanel = new JPanel(new BorderLayout());
rootPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
GridBagLayout layout = new GridBagLayout();
JPanel mainPanel = new JPanel(layout);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.ipadx = 10;
c.ipady = 10;
c.weightx = 1.0d;
c.weighty = 0.0d;
JLabel label = new JLabel("Experiment file:");
label.setToolTipText("The name of the experiment file.");
c.gridwidth = GridBagConstraints.RELATIVE;
layout.setConstraints(label, c);
mainPanel.add(label);
label = new JLabel(file);
label.setToolTipText("The name of the experiment file.");
c.gridwidth = GridBagConstraints.REMAINDER;
layout.setConstraints(label, c);
mainPanel.add(label);
c.weighty = 1.0d;
JEditorPane description = new JEditorPane("text/html", SwingTools.text2DisplayHtml(text));
description.setToolTipText("A short description of this experiment");
description.setEditable(false);
description.setBackground(this.getBackground());
JScrollPane textScrollPane = new JScrollPane(description);
//textScrollPane.setBorder(BorderFactory.createTitledBorder("Description"));
c.gridwidth = GridBagConstraints.REMAINDER;
layout.setConstraints(textScrollPane, c);
mainPanel.add(textScrollPane);
c.weighty = 0.0d;
rootPanel.add(mainPanel, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton okButton = new JButton("Ok");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { ok(); }
});
buttonPanel.add(okButton);
rootPanel.add(buttonPanel, BorderLayout.SOUTH);
getContentPane().add(rootPanel);
pack();
setSize(400, 300);
setLocationRelativeTo(owner);
}
private void ok() {
dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -