📄 aboutbox.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 java.awt.Frame;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Image;
import java.awt.Graphics;
import javax.swing.BorderFactory;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.imageio.ImageIO;
import java.io.File;
public class AboutBox extends JDialog {
private static final Font ABOUT_TEXT_FONT = new Font("Lucida Sans", Font.PLAIN, 10);
private class LogoDrawer extends JPanel {
public LogoDrawer() {
setPreferredSize(InfoBox.getLogoSize(logos));
}
public void paint(Graphics g) {
InfoBox.drawLogos(g, logos);
}
}
private Image[] logos;
public AboutBox(Frame owner, String productName, String version, String aboutText, Image[] logos) {
super(owner, "About "+productName, true);
setResizable(false);
this.logos = logos;
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
getContentPane().add(new InfoBox(400, 28+InfoBox.RAINBOW_THICKNESS+32, 28,
productName, 32, version, 32));
JTextArea text = new JTextArea(aboutText, 13, 1);
text.setEditable(false);
text.setLineWrap(true);
text.setWrapStyleWord(true);
text.setBackground(this.getContentPane().getBackground());
text.setFont(ABOUT_TEXT_FONT);
text.setBorder(BorderFactory.createEmptyBorder(InfoBox.PRODUCT_NAME_X, InfoBox.PRODUCT_NAME_X,
InfoBox.PRODUCT_NAME_X, InfoBox.PRODUCT_NAME_X));
getContentPane().add(text);
getContentPane().add(new LogoDrawer());
JButton closeButton = new JButton("Close");
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { dispose(); }
});
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonPanel.add(closeButton);
getContentPane().add(buttonPanel);
pack();
setLocationRelativeTo(owner);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -