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

📄 guiapplication.java

📁 具有不同语法高亮的编辑器实例
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * 11/20/2004
 *
 * GUIApplication.java - An interface for a basic GUI application.
 * Copyright (C) 2004 Robert Futrell
 * email@address.com
 * www.website.com
 *
 * 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 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 org.fife.ui.app;

import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.util.ResourceBundle;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JMenuBar;
import javax.swing.KeyStroke;

import org.fife.help.HelpDialog;
import org.fife.ui.AboutDialog;
import org.fife.ui.CustomizableToolBar;
import org.fife.ui.StandardAction;
import org.fife.ui.StatusBar;


/**
 * An interface for a generic GUI application.  Your Swing application can
 * override {@link org.fife.ui.app.AbstractGUIApplication} to have some of its
 * basic code already implemented.<p>
 *
 * This class provides the framework for a GUI application having the following
 * features:
 * <ul>
 *   <li>A menu bar.</li>
 *   <li>A customizable toolbar.</li>
 *   <li>A status bar.</li>
 *   <li>A "Help" dialog.</li>
 *   <li>An "About" dialog.</li>
 *   <li>Easy localization.</li>
 *   <li>A way to capture <code>Exceptions</code> and report them to
 *       the user.</li>
 *   <li>An easy to organize/maintain the actions associated with the
 *       application's menu bar, toolbar, etc.</li>
 * </ul>
 *
 * @author Robert Futrell
 * @version 0.5
 * @see AbstractGUIApplication
 * @see AbstractPluggableGUIApplication
 */
public interface GUIApplication extends GUIApplicationConstants {


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


	/**
	 * Adds an action to this application's action map.
	 *
	 * @param key The key with which to fetch the action via
	 *            <code>getAction</code>.
	 * @param action The action to add.
	 * @see #getAction
	 */
	public void addAction(String key, Action action);


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


	/**
	 * This method should be overridden to convey to the user that an
	 * Exception occured in some way, for example, in a dialog box.
	 *
	 * @param t The exception/throwable that occured.
	 */
	public void displayException(Throwable t);


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


	/**
	 * This method should be overridden to convey to the user that an
	 * Exception occured in some way, for example, in a dialog box.
	 * This version is useful if a child dialog of the GUI application
	 * threw the Exception.
	 *
	 * @param dialog The child dialog that threw the Exception.
	 * @param t The exception/throwable that occured.
	 */
	public void displayException(Dialog dialog, Throwable t);


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


	/**
	 * This method should be overridden to convey to the user that an
	 * Exception occured in some way, for example, in a dialog box.
	 * This version is useful if a child frame of the GUI application
	 * threw the Exception.
	 *
	 * @param frame The child frame that threw the Exception.
	 * @param t The exception/throwable that occured.
	 */
	public void displayException(Frame frame, Throwable t);


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


	/**
	 * Called when the user attempts to close the application, whether from
	 * an "Exit" menu item, closing the main application window, or any other
	 * means.  Applications should override this method to do any cleanup
	 * before the application exits.  You can also prevent the application
	 * from closing based on the application's state in this method.
	 */
	public void doExit();


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


	/**
	 * Returns the About dialog for this application.
	 *
	 * @return The About dialog.
	 * @see org.fife.ui.AboutDialog
	 */
	public AboutDialog getAboutDialog();


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


	/**
	 * Returns one of this application's actions.
	 *
	 * @return The action, or <code>null</code> if no action exists for the
	 *         specified key.
	 * @see #addAction
	 */
	public Action getAction(String key);



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


	/**
	 * Returns the actions of this GUI application as an array.
	 *
	 * @return The actions.
	 * @see #getAction
	 */
	public Action[] getActions();


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


	/**
	 * Returns the Help dialog for this application, or <code>null</code>
	 * if this application does not have a Help dialog.
	 *
	 * @return The Help dialog.
	 */
	public HelpDialog getHelpDialog();


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


	/**
	 * Return the image used for the icon of this GUI application.
	 *
	 * @return The image.
	 */
	public Image getIconImage();


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


	/**
	 * Returns the directory in which this GUI application is installed
	 * (running).
	 *
	 * @return The directory.
	 */
	public String getInstallLocation();


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


	/**
	 * Returns the menu bar this application is using.
	 *
	 * @return The menu bar.
	 * @see #setJMenuBar
	 */
	public JMenuBar getJMenuBar();


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


	/**
	 * Returns the language used by this GUI application, in a
	 * <code>Locale</code>-friendly language string; e.g., <code>en</code>
	 * or <code>es</code>.
	 *
	 * @return The language being used by this application.
	 */
	public abstract String getLanguage();


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


	/**
	 * Returns an integer constant representing the OS.  This can be handy for
	 * special case situations such as Mac OS-X (special application
	 * registration) or Windows (allow mixed case, etc.).
	 *
	 * @return An integer constant representing the OS.
	 */
	public int getOS();


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


	/**
	 * Returns the resource bundle associated with this application.
	 *
	 * @return The resource bundle.
	 */
	public ResourceBundle getResourceBundle();


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


	/**
	 * Returns the status bar this application is using.
	 *
	 * @return The status bar.
	 * @see #setStatusBar
	 */
	public StatusBar getStatusBar();


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


	/**
	 * Returns whether the status bar is visible.
	 *
	 * @return Whether the status bar is visible.
	 * @see #setStatusBarVisible
	 */
	public boolean getStatusBarVisible();


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


	/**
	 * Returns the toolbar this application is using.
	 *
	 * @return The toolbar.
	 * @see #setToolBar
	 */
	public CustomizableToolBar getToolBar();


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


	/**
	 * Returns whether the toolbar is visible in this application.
	 *
	 * @return Whether the toolbar is visible.
	 * @see #setToolBarVisible
	 */
	public boolean getToolBarVisible();


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


	/**
	 * Returns the version string for this application.
	 *
	 * @return The version string.
	 */
	public String getVersionString();


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


	/**
	 * Returns true if this application's main window is maximized.
	 *
	 * @return <code>true</code> if this applicaiton's window is maximized, or
	 *         <code>false</code> if it isn't.
	 */
	public boolean isMaximized();


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


	/**
	 * Loads the preferences for this GUI application.  If this application
	 * does not use preferences or something, <code>null</code> is
	 * goes wrong, <code>null</code> is returned.
	 *
	 * @return This application's preferences.
	 */
	public GUIApplicationPreferences loadPreferences();


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


	/**
	 * Repacks the GUI application's main window.  This should be called
	 * after things are added or removed from it.
	 */
	public void pack();


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


	/**
	 * Sets the menu bar to use in this application.
	 *
	 * @param menuBar The menu bar.
	 * @see #getJMenuBar

⌨️ 快捷键说明

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