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

📄 abstractbutton.java

📁 this gcc-g++-3.3.1.tar.gz is a source file of gcc, you can learn more about gcc through this codes f
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* AbstractButton.java -- Provides basic button functionality.   Copyright (C) 2002 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING.  If not, write to theFree Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version. */package javax.swing;import java.awt.*;import java.awt.event.*;import javax.swing.event.*;import javax.swing.plaf.*;import javax.swing.text.*;import javax.accessibility.*;import java.util.*;import java.beans.*;/** * Provides basic button functionality * * @author Ronald Veldema (rveldema@cs.vu.nl) */public abstract class AbstractButton extends JComponent			implements ItemSelectable, SwingConstants{	Icon default_icon, pressed_button, disabled_button,	selected_button, disabled_selected_button, current_icon;	String text;	int vert_align = CENTER;	int hori_align = CENTER;	int hori_text_pos = CENTER;	int vert_text_pos = CENTER;	boolean paint_border = true, paint_focus;	Action action_taken;	ButtonModel model;	Insets margin;	public static final String FOCUS_PAINTED_CHANGED_PROPERTY = "focusPainted";	/**	 * AccessibleAbstractButton	 */	protected abstract class AccessibleAbstractButton 		extends AccessibleJComponent 		implements AccessibleAction, AccessibleValue, AccessibleText {		//-------------------------------------------------------------		// Initialization ---------------------------------------------		//-------------------------------------------------------------		/**		 * Constructor AccessibleAbstractButton		 * @param component TODO		 */		protected AccessibleAbstractButton(AbstractButton component) {			super(component);			// TODO		} // AccessibleAbstractButton()		//-------------------------------------------------------------		// Methods ----------------------------------------------------		//-------------------------------------------------------------		/**		 * getAccessibleStateSet		 * @returns AccessibleStateSet		 */		public AccessibleStateSet getAccessibleStateSet() {			return null; // TODO		} // getAccessibleStateSet()		/**		 * getAccessibleName		 * @returns String		 */		public String getAccessibleName() {			return null; // TODO		} // getAccessibleName()		/**		 * getAccessibleIcon		 * @returns AccessibleIcon[]		 */		public AccessibleIcon[] getAccessibleIcon() {			return null; // TODO		} // getAccessibleIcon()		/**		 * getAccessibleRelationSet		 * @returns AccessibleRelationSet		 */		public AccessibleRelationSet getAccessibleRelationSet() {			return null; // TODO		} // getAccessibleRelationSet()		/**		 * getAccessibleAction		 * @returns AccessibleAction		 */		public AccessibleAction getAccessibleAction() {			return null; // TODO		} // getAccessibleAction()		/**		 * getAccessibleValue		 * @returns AccessibleValue		 */		public AccessibleValue getAccessibleValue() {			return null; // TODO		} // getAccessibleValue()		/**		 * getAccessibleActionCount		 * @returns int		 */		public int getAccessibleActionCount() {			return 0; // TODO		} // getAccessibleActionCount()		/**		 * getAccessibleActionDescription		 * @param value0 TODO		 * @returns String		 */		public String getAccessibleActionDescription(int value0) {			return null; // TODO		} // getAccessibleActionDescription()		/**		 * doAccessibleAction		 * @param value0 TODO		 * @returns boolean		 */		public boolean doAccessibleAction(int value0) {			return false; // TODO		} // doAccessibleAction()		/**		 * getCurrentAccessibleValue		 * @returns Number		 */		public Number getCurrentAccessibleValue() {			return null; // TODO		} // getCurrentAccessibleValue()		/**		 * setCurrentAccessibleValue		 * @param value0 TODO		 * @returns boolean		 */		public boolean setCurrentAccessibleValue(Number value0) {			return false; // TODO		} // setCurrentAccessibleValue()		/**		 * getMinimumAccessibleValue		 * @returns Number		 */		public Number getMinimumAccessibleValue() {			return null; // TODO		} // getMinimumAccessibleValue()		/**		 * getMaximumAccessibleValue		 * @returns Number		 */		public Number getMaximumAccessibleValue() {			return null; // TODO		} // getMaximumAccessibleValue()		/**		 * getAccessibleText		 * @returns AccessibleText		 */		public AccessibleText getAccessibleText() {			return null; // TODO		} // getAccessibleText()		/**		 * getIndexAtPoint		 * @param value0 TODO		 * @returns int		 */		public int getIndexAtPoint(Point value0) {			return 0; // TODO		} // getIndexAtPoint()		/**		 * getCharacterBounds		 * @param value0 TODO		 * @returns Rectangle		 */		public Rectangle getCharacterBounds(int value0) {			return null; // TODO		} // getCharacterBounds()		/**		 * getCharCount		 * @returns int		 */		public int getCharCount() {			return 0; // TODO		} // getCharCount()		/**		 * getCaretPosition		 * @returns int		 */		public int getCaretPosition() {			return 0; // TODO		} // getCaretPosition()		/**		 * getAtIndex		 * @param value0 TODO		 * @param value1 TODO		 * @returns String		 */		public String getAtIndex(int value0, int value1) {			return null; // TODO		} // getAtIndex()		/**		 * getAfterIndex		 * @param value0 TODO		 * @param value1 TODO		 * @returns String		 */		public String getAfterIndex(int value0, int value1) {			return null; // TODO		} // getAfterIndex()		/**		 * getBeforeIndex		 * @param value0 TODO		 * @param value1 TODO		 * @returns String		 */		public String getBeforeIndex(int value0, int value1) {			return null; // TODO		} // getBeforeIndex()		/**		 * getCharacterAttribute		 * @param value0 TODO		 * @returns AttributeSet		 */		public AttributeSet getCharacterAttribute(int value0) {			return null; // TODO		} // getCharacterAttribute()		/**		 * getSelectionStart		 * @returns int		 */		public int getSelectionStart() {			return 0; // TODO		} // getSelectionStart()		/**		 * getSelectionEnd		 * @returns int		 */		public int getSelectionEnd() {			return 0; // TODO		} // getSelectionEnd()		/**		 * getSelectedText		 * @returns String		 */		public String getSelectedText() {			return null; // TODO		} // getSelectedText()		/**		 * getTextRectangle		 * @returns Rectangle		 */		private Rectangle getTextRectangle() {			return null; // TODO		} // getTextRectangle()	} // AccessibleAbstractButton	static private class JFocusListener implements FocusListener	{		AbstractButton c;		JFocusListener(AbstractButton c)		{			this.c = c;		}		public void focusLost(FocusEvent event)		{			c.getModel().setArmed(false);			System.out.println("LOST FOCUS");			if (c.isFocusPainted())			{				c.repaint();			}		}		public void focusGained(FocusEvent event)		{			System.out.println("GAIN FOCUS");		}	}	/**********************************************	 *	 * 	 *       Constructors	 *	 *	 ****************/	AbstractButton()	{		this("",null);	}	AbstractButton(String text,	               Icon icon)	{		this.text    = text;		setIcon(icon);		setAlignmentX(LEFT_ALIGNMENT);		setAlignmentY(CENTER_ALIGNMENT);		addFocusListener( new JFocusListener(this) );		setModel(new DefaultButtonModel(this));		updateUI(); // get a proper ui	}	/**********************************************	 *	 * 	 *       Actions etc	 *	 *	 ****************/	public ButtonModel getModel()	{	return model;    }	public void setModel(ButtonModel newModel)	{	model = newModel;    }	public String getActionCommand()	{	return getModel().getActionCommand();    }	public void setActionCommand(String aCommand)	{   getModel().setActionCommand(aCommand);   }

⌨️ 快捷键说明

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