⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aboutdialog.java

📁 具有不同语法高亮的编辑器实例
💻 JAVA
字号:
/*
 * 11/14/2003
 *
 * AboutDialog.java - Dialog that displays the program information for RText.
 * Copyright (C) 2003 Robert Futrell
 * email@address.com
 * www.website.com
 *
 * This file is a part of RText.
 *
 * RText 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 any later version.
 *
 * RText 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 org.fife.rtext;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.ResourceBundle;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;

import org.fife.ui.RScrollPane;
import org.fife.ui.UIUtilities;
import org.fife.ui.app.AbstractPluggableGUIApplication;
import org.fife.ui.app.Plugin;


/**
 * The dialog that displays the program information about <code>RText</code>.
 *
 * @author Robert Futrell
 * @version 1.0
 */
class AboutDialog extends org.fife.ui.AboutDialog {


/*****************************************************************************/


	/**
	 * Creates a new <code>AboutDialog</code>.
	 *
	 * @param rtext The owner of this dialog.
	 */
	public AboutDialog(RText rtext) {

		// Let it be known who the owner of this dialog is.
		super(rtext, rtext.getResourceBundle().getString("AboutDialogTitle"));

		ResourceBundle msg = ResourceBundle.getBundle(
									"org/fife/rtext/AboutDialog");

		// Create the picture.
		JPanel temp = UIUtilities.createTabbedPanePanel();
		temp.setLayout(new BorderLayout());
		temp.setBorder(UIUtilities.getEmpty5Border());
		ClassLoader cl = this.getClass().getClassLoader();
		URL imageURL = cl.getResource("org/fife/rtext/graphics/aboutdialogimage.jpg");
		ImageIcon icon = new ImageIcon(imageURL);
		JLabel label = new JLabel(icon);
		label.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		temp.add(label, BorderLayout.CENTER);

		// Add a panel containing the rest of the stuff.
		JPanel panel = UIUtilities.createTabbedPanePanel();
		label = new JLabel("<html><body><center>" +
						"Version " + rtext.getVersionString() + "<br>" +
						"Copyright (c) 2003-2006 Robert Futrell<br>" +
						"<a href=\"http://rtext.sourceforge.net\">" +
						"http://rtext.sourceforge.net</a>" +
						"</center></body></html>");
		panel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
		panel.add(label);
		temp.add(panel, BorderLayout.SOUTH);
		addPanel(msg.getString("Tab.Application"), temp);

		// Add a panel containing information about installed plugins.
		temp = UIUtilities.createTabbedPanePanel();
		temp.setLayout(new BorderLayout());
		temp.setBorder(UIUtilities.getEmpty5Border());
		panel = UIUtilities.createTabbedPanePanel();
		panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
		panel.add(new JLabel(msg.getString("Static.TableDescription")));
		panel.add(Box.createHorizontalGlue());
		temp.add(panel, BorderLayout.NORTH);
		JTable pluginTable = new JTable(createTableData(rtext),
					new String[] { msg.getString("Column.Plugin"),
								msg.getString("Column.Version"),
								msg.getString("Column.Author") }) {
				public Dimension getPreferredScrollableViewportSize() {
					return new Dimension(50, 50); //Will be bigger.
				};
				public boolean isCellEditable(int row, int column) {
					return false;
				}
		};
		temp.add(new RScrollPane(pluginTable));
		addPanel(msg.getString("Tab.Plugins"), temp);

	}


/*****************************************************************************/

	/**
	 * Returns the array of strings for the "Plugins" tab on the About dialog.
	 *
	 * @param app The GUI Application containing plugins.
	 * @return The contents for the "Plugins" About tab.
	 */
	private String[][] createTableData(AbstractPluggableGUIApplication app) {
		Plugin[] plugins = app.getPlugins(); // Guaranteed non-null.
		int count = plugins.length;
		if (count>0) {
			String[][] strings = new String[count][3];
			for (int i=0; i<count; i++) {
				strings[i][0] = plugins[i].getName();
				strings[i][1] = plugins[i].getVersion();
				strings[i][2] = plugins[i].getAuthor();
			}
			return strings;
		}
		else {
			String[][] strings = { { "<No plugins installed>", "", "" } };
			return strings;
		}
	}


/*****************************************************************************/

}

⌨️ 快捷键说明

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