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

📄 jtabbedpane.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/* JTabbedPane.java --   Copyright (C) 2002, 2004, 2005  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., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 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.Color;import java.awt.Component;import java.awt.Point;import java.awt.Rectangle;import java.awt.event.MouseEvent;import java.io.Serializable;import java.util.Vector;import javax.accessibility.Accessible;import javax.accessibility.AccessibleContext;import javax.accessibility.AccessibleRole;import javax.accessibility.AccessibleSelection;import javax.swing.event.ChangeEvent;import javax.swing.event.ChangeListener;import javax.swing.plaf.TabbedPaneUI;import javax.swing.plaf.UIResource;/** * This is a container for components where only one component is displayed at * a given time and the displayed component can be switched by clicking on * tabs. *  * <p> * Tabs can be oriented in several ways. They can be above, below, left and * right of the component. Tabs can either wrap around (by creating multiple * rows of tabs) or they can be scrolled (where only a subset of the  tabs * can be seen at once). More tabs can be added by calling the * add/addTab/insertTab methods. * </p> */public class JTabbedPane extends JComponent implements Serializable,                                                       Accessible,                                                       SwingConstants{  /**   * Accessibility support for <code>JTabbedPane</code>.   */  // FIXME: This inner class is a complete stub and must be implemented  // properly.  protected class AccessibleJTabbedPane extends JComponent.AccessibleJComponent    implements AccessibleSelection, ChangeListener  {    /**     * The serialization UID.     */    private static final long serialVersionUID = 7610530885966830483L;    /**     * Creates a new AccessibleJTabbedPane object.     */    public AccessibleJTabbedPane()    {      super();    }    /**     * Receives notification when the selection state of the     * <code>JTabbedPane</code> changes.     *     * @param e the change event describing the change     */    public void stateChanged(ChangeEvent e)    {      // Implement this properly.    }    /**     * Returns the accessible role of the <code>JTabbedPane</code>, which is     * {@link AccessibleRole#PAGE_TAB_LIST}.     *     * @return the accessible role of the <code>JTabbedPane</code>     */    public AccessibleRole getAccessibleRole()    {      return null;    }    /**     * Returns the number of accessible child components of the     * <code>JTabbedPane</code>.     *     * @return the number of accessible child components of the     *         <code>JTabbedPane</code>     */    public int getAccessibleChildrenCount()    {      return 0;    }    /**     * Returns the accessible child component at the specified index.     *     * @param i the index of the child component to fetch     *     * @return the accessible child component at the specified index     */    public Accessible getAccessibleChild(int i)    {      return null;    }    /**     * Returns the current selection state of the <code>JTabbedPane</code>     * as AccessibleSelection object.     *     * @return the current selection state of the <code>JTabbedPane</code>     */    public AccessibleSelection getAccessibleSelection()    {      return null;    }    /**     * Returns the accessible child component at the specified coordinates.     * If there is no child component at this location, then return the     * currently selected tab.     *     * @param p the coordinates at which to look up the child component     *     * @return the accessible child component at the specified coordinates or     *         the currently selected tab if there is no child component at     *         this location     */    public Accessible getAccessibleAt(Point p)    {      return null;    }    /**     * The number of selected child components of the     * <code>JTabbedPane</code>. This will be <code>0</code> if the     * <code>JTabbedPane</code> has no children, or <code>1</code> otherwise,     * since there is always exactly one tab selected.      *     * @return number of selected child components of the     *         <code>JTabbedPane</code>     */    public int getAccessibleSelectionCount()    {      return 0;    }    /**     * DOCUMENT ME!     *     * @param i DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Accessible getAccessibleSelection(int i)    {      return null;    }    /**     * DOCUMENT ME!     *     * @param i DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public boolean isAccessibleChildSelected(int i)    {      return false;    }    /**     * DOCUMENT ME!     *     * @param i DOCUMENT ME!     */    public void addAccessibleSelection(int i)    {      // TODO: Implement this properly.    }    /**     * DOCUMENT ME!     *     * @param i DOCUMENT ME!     */    public void removeAccessibleSelection(int i)    {      // TODO: Implement this properly.    }    /**     * DOCUMENT ME!     */    public void clearAccessibleSelection()    {      // TODO: Implement this properly.    }    /**     * DOCUMENT ME!     */    public void selectAllAccessibleSelection()    {      // TODO: Implement this properly.    }  }  /**   * A helper class that listens for changes to the model.   */  protected class ModelListener implements ChangeListener, Serializable  {    /** DOCUMENT ME! */    private static final long serialVersionUID = 497359819958114132L;    /**     * Creates a new ModelListener object.     */    protected ModelListener()    {      // Nothing to do here.    }    /**     * This method is called whenever the model  is changed.     *     * @param e The ChangeEvent that is passed from the model.     */    public void stateChanged(ChangeEvent e)    {      // Propagate to our listeners.      fireStateChanged();    }  }  /**   * A private class that holds all the information  for each tab.   */  private class Page  {    /** The tooltip string. */    private String tip;    /** The component associated with the tab. */    private Component component;    /** The active icon associated with the tab. */    private transient Icon icon;    /** The disabled icon associated with the tab. */    private transient Icon disabledIcon;    /** The tab's enabled status. */    private transient boolean enabled = true;    /** The string painted on the tab. */    private transient String title;    /** The background color of the tab. */    private transient Color bg;    /** The foreground color of the tab. */    private transient Color fg;    /** The mnemonic associated with the tab. */    private transient int mnemonicKey;    /** The index of the underlined character in the string. */    private transient int underlinedChar = -1;    /**     * Creates a new data storage for the tab.     *     * @param title The string displayed on the tab.     * @param icon The active icon displayed on the tab.     * @param component The component associated with the tab.     * @param tip The tooltip associated with the tab.     */    protected Page(String title, Icon icon, Component component, String tip)    {      this.title = title;      this.icon = icon;      this.component = component;      this.tip = tip;    }    /**     * This method returns the component associated with the tab.     *     * @return The component associated with the tab.     */    public Component getComponent()    {      return component;    }    /**     * This method sets the component associated with the tab.     *     * @param c The component associated with the tab.     */    public void setComponent(Component c)    {      int i = indexOfComponent(component);      insertTab(title, icon, c, tip, i);      component = c;      removeTabAt(i);    }    /**     * This method returns the tooltip string.     *     * @return The tooltip string.     */    public String getTip()    {      return tip;    }    /**     * This method sets the tooltip string.     *     * @param tip The tooltip string.     */    public void setTip(String tip)    {      this.tip = tip;    }    /**     * This method returns the background color.     *     * @return The background color.     */    public Color getBackground()    {      return bg;    }    /**     * This method sets the background color.     *     * @param background The background color.     */    public void setBackground(Color background)    {      bg = background;    }    /**     * This method returns the foreground color.     *     * @return The foreground color.     */    public Color getForeground()    {      return fg;    }    /**     * This method sets the foreground color.     *     * @param foreground The foreground color.     */    public void setForeground(Color foreground)    {      fg = foreground;    }    /**     * This method returns the title associated with the tab.     *     * @return The title of the tab.     */    public String getTitle()    {      return title;    }    /** DOCUMENT ME! */    private static final long serialVersionUID = 1614381073220130939L;    /**     * This method sets the title of the tab.     *     * @param text The title of the tab.     */    public void setTitle(String text)    {      title = text;      if (title != null && title.length() <= underlinedChar)	setDisplayedMnemonicIndex(title.length() - 1);    }    /**     * This method returns the active icon.     *     * @return The active icon.     */    public Icon getIcon()    {      return icon;    }    /**     * This method sets the active icon.     *     * @param icon The active icon.     */    public void setIcon(Icon icon)    {      this.icon = icon;    }    /**     * This method returns the disabled icon.     *     * @return The disabled icon.     */    public Icon getDisabledIcon()    {      if (disabledIcon == null && icon instanceof ImageIcon)	setDisabledIcon(icon);      return disabledIcon;    }    /**     * This method sets the disabled icon.     *     * @param disabledIcon The disabled icon.     */    public void setDisabledIcon(Icon disabledIcon)    {      this.disabledIcon = disabledIcon;    }    /**     * This method returns whether the tab is enabled.     *     * @return Whether the tab is enabled.     */    public boolean isEnabled()    {      return enabled;    }    /**     * This method sets whether the tab is enabled.     *     * @param enabled Whether this tab is enabled.     */    public void setEnabled(boolean enabled)    {      this.enabled = enabled;    }    /**     * This method returns the mnemonic.     *     * @return The mnemonic.     */    public int getMnemonic()    {      return (int) mnemonicKey;

⌨️ 快捷键说明

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