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

📄 tabbedpane.html

📁 jsf、swing的官方指南
💻 HTML
📖 第 1 页 / 共 3 页
字号:
  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#addTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String)">addTab(String, Icon, Component, String)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#addTab(java.lang.String, javax.swing.Icon, java.awt.Component)">addTab(String, Icon, Component)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#addTab(java.lang.String, java.awt.Component)">addTab(String, Component)</a>    </td>    <td>Add a new tab to the tabbed pane.        The first argument specifies the text on the tab.        The optional icon argument specifies the tab's icon.        The component argument specifies the component        that the tabbed pane        should show when the tab is selected.        The fourth argument, if present,        specifies the tool tip text        for the tab.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setTabLayoutPolicy(int)">void setTabLayoutPolicy(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getTabLayoutPolicy()">int getTabLayoutPolicy()</a>    </td>    <td>Set or get the policy that the tabbed pane uses in        laying out tabs when all tabs do not fit within        a single run. Possible values are <code>WRAP_TAB_LAYOUT</code>        and <code>SCROLL_TAB_LAYOUT</code>. The default        policy is <code>WRAP_TAB_LAYOUT</code>.    </td>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setTabPlacement(int)">void setTabPlacement(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getTabPlacement()">int getTabPlacement()</a>    </td>    <td>Set or get the location where the tabs appear relative to the content.        Possible values (defined in <code>SwingConstants</code>,        which is implemented by <code>JTabbedPane</code>)        are <code>TOP</code>,        <code>BOTTOM</code>,        <code>LEFT</code>, and        <code>RIGHT</code>.    </td>  </tr></table><p><table border=1><caption><a name="tabapi"><b>Inserting, Removing, Finding, and Selecting Tabs</b></a></caption><tr><th align=left>Method</th><th align=left>Purpose</th></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int)">insertTab(String, Icon, Component, String, int)</a>    </td>    <td>Insert a tab at the specified index,        where the first tab is at index 0.        The arguments are the same as for <code>addTab</code>.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#remove(java.awt.Component)">remove(Component)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#removeTabAt(int)">removeTabAt(int)</a>    </td>    <td>Remove the tab corresponding to the specified        component or index.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#removeAll()">removeAll()</a>    </td>    <td>Remove all tabs.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#indexOfComponent(java.awt.Component)">int indexOfComponent(Component)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#indexOfTab(java.lang.String)">int indexOfTab(String)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#indexOfTab(javax.swing.Icon)">int indexOfTab(Icon)</a>    </td>    <td>Return the index of the tab that has the specified        component, title, or icon.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setSelectedIndex(int)">void setSelectedIndex(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setSelectedComponent(java.awt.Component)">void setSelectedComponent(Component)</a>    </td>    <td>Select the tab that has the specified component or index.        Selecting a tab has the effect of displaying its        associated component.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getSelectedIndex()">int getSelectedIndex()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getSelectedComponent()">Component getSelectedComponent()</a>    </td>    <td>Return the index or component for the selected tab.    </td>  </tr></table><p><table border=1><caption><a name="appearanceapi"><b>Changing Tab Appearance</b></a></caption><tr><th align=left>Method</th><th align=left>Purpose</th></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setComponentAt(int, java.awt.Component)">void setComponentAt(int, Component)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getComponentAt(int)">Component getComponentAt(int)</a>    </td>    <td>Set or get which component is associated with the tab        at the specified index.        The first tab is at index 0.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setTitleAt(int, java.lang.String)">void setTitleAt(int, String)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getTitleAt(int)">String getTitleAt(int)</a>    </td>    <td>Set or get the title of the tab at the specified index.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setIconAt(int, javax.swing.Icon)">void setIconAt(int, Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getIconAt(int)">Icon getIconAt(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setDisabledIconAt(int, javax.swing.Icon)">void setDisabledIconAt(int, Icon)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getDisabledIconAt(int)">Icon getDisabledIconAt(int)</a>    </td>    <td>Set or get the icon displayed by the tab        at the specified index.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setBackgroundAt(int, java.awt.Color)">void setBackgroundAt(int, Color)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getBackgroundAt(int)">Color getBackgroundAt(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setForegroundAt(int, java.awt.Color)">void setForegroundAt(int, Color)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getForegroundAt(int)">Color getForegroundAt(int)</a>    </td>    <td>Set or get the background or foreground color        used by the tab        at the specified index.        By default, a tab uses the tabbed pane's background        and foreground colors.        For example, if the tabbed pane's foreground is black,        then each tab's title is black        except for any tabs for which you specify another color        using <code>setForegroundAt</code>.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setEnabledAt(int, boolean)">void setEnabledAt(int, boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#isEnabledAt(int)">boolean isEnabledAt(int)</a>    </td>    <td>Set or get the enabled state of the tab at the specified index.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setMnemonicAt(int, int)">void setMnemonicAt(int, int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getMnemonicAt(int)">int getMnemonicAt(int)</a>    </td>    <td>Set or get the keyboard mnemonic for accessing the specified tab.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setDisplayedMnemonicIndexAt(int, int)">void setDisplayedMnemonicIndexAt(int, int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getDisplayedMnemonicIndexAt(int)">int getDisplayedMnemonicIndexAt(int)</a>    </td>    <td>Set or get which character should be decorated to    represent the mnemonic.  This is useful    when the mnemonic character appears multiple times in the tab's title    and you don't want the first occurrence underlined.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setToolTipTextAt(int, java.lang.String)">void setToolTipTextAt(int, String)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getToolTipTextAt(int)">String getToolTipTextAt(int)</a>    </td>    <td>Set or get the text displayed on tool tips for the specified tab.    </td>  </tr></table><p><table border=1><caption><a name="tabscomponents"><b>Setting Up Custom Components on Tabs</b></a></caption><tr><th align=left>Method</th><th align=left>Purpose</th></tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setTabComponentAt(int, java.awt.Component)">void setTabComponentAt(int, Component)</a>       </td>    <td>Set the component that is responsible for rendering the title    or icon (or both) for the tab specified by the first argument.    When a null value is specified, <code>JTabbedPane</code> renders the title or icon.    The same component cannot be used for several tabs.    </td>  </tr>    <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#getTabComponentAt(int)">Component getTabComponentAt(int)</a>    </td>    <td>Get the tab component for the tab at the index specified by the argument.    If there is no tab component for the specified tab, a null value is returned.    </td>  </tr>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html#indexOfTabComponent(java.awt.Component)">int indexOfTabComponent(Component)</a>       </td>    <td>Check if the specified component belongs to one of the tabs.    Return the index of the corresponding tab or -1 if there is no such a tab.    </td></table></blockquote><h3><a name="eg">Examples That Use Tabbed Panes</a></h3><blockquote>This table lists examples that use <code>JTabbedPane</code>and points to where those examples are described.<p><table><tr><th align=left> Example</th><th align=left> Where Described</th><th align=left> Notes</th></tr><tr><td> <a href="examples/index.html#TabbedPaneDemo"><code>TabbedPaneDemo</code></a></td><td> This page</td><td> Demonstrates a few tabbed pane features,     such as tool tips, icons, scrollable layout, and mnemonics.</td></tr><tr><td> <a href="examples/index.html#TabComponentsDemo"><code>TabComponentsDemo</code></a></td><td> This page</td><td> Demonstrates custom components on tabs.Uses a tabbed pane with close buttons.</td></tr><tr><td> <a href="../layout/examples/index.html#BoxAlignmentDemo"><code>BoxAlignmentDemo</code></a></td><td><a class="TutorialLink" target="_top" href="../layout/box.html">How to Use BoxLayout</a></td><td> Uses a <code>JTabbedPane</code> as the only child     of a frame's content pane.</td></tr><tr><td> <a href="../components/examples/index.html#BorderDemo"><code>BorderDemo</code></a></td><td><a class="TutorialLink" target="_top" href="../components/border.html">How to Use Borders</a></td><td> Uses its tabbed pane in a manner similar to <code>BoxAlignmentDemo</code>.</td></tr><tr><td> <a href="examples/index.html#DialogDemo"><code>DialogDemo</code></a></td><td> <a href="dialog.html">How to Use Dialogs</a></td><td> Has a tabbed pane in the center of a frame's content pane,     with a label below it.</td></tr><tr><td> <a href="../misc/examples/index.html#DragFileDemo"><code>DragFileDemo</code></a></td><td><a class="TutorialLink" target="_top" href="../dnd/intro.html">Introduction to Drag and Drop and Data Transfer</a></td><td> Uses a tabbed pane at the bottom of the window     to display the contents of one or more files.     The tabbed pane isn't used     until the user selects a file.     The tabbed pane's state is controlled by      an object of the custom type      <code>TabbedPaneController</code>.</td></tr></table>        </blockquote>        <div class=NavBit>            <a target=_top href=splitpane.html>&laquo; Previous</a>            &bull;            <a target=_top href=../TOC.html>Trail</a>            &bull;            <a target=_top href=table.html>Next &raquo;</a>        </div>    </div>    <div id=Footer><div id=TagNotes>    Problems with the examples? Try <a target="_blank"        href=../../information/run-examples.html>Compiling and Running        the Examples: FAQs</a>.    <br>    Complaints? Compliments? Suggestions? <a target="_blank"        href="http://developer.sun.com/contact/tutorial_feedback.jsp">Give    us your feedback</a>.<br><br>    <a target="_blank" href="../../information/copyright.html">Copyright</a>    1995-2006 Sun Microsystems, Inc.  All rights reserved.    <span id=Download></span></div>     </div>    <div class=PrintHeaders>        <b>Previous page:</b> How to Use Split Panes        <br><b>Next page:</b> How to Use Tables    </div>    </body></html> 

⌨️ 快捷键说明

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