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

📄 jcomponent.html

📁 jsf、swing的官方指南
💻 HTML
📖 第 1 页 / 共 4 页
字号:
    The foreground is generally the color used    to draw the text in a component.    The background is (not surprisingly)    the color of the background    areas of the component,    assuming that the component is opaque.    </td>    </tr>    <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#getForeground()">Color getForeground()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#getBackground()">Color getBackground()</a>    <TD>    Get the foreground or background color for the component.    </TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#setOpaque(boolean)">void setOpaque(boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#isOpaque()">boolean isOpaque()</a>    </td>    <TD>    Set or get whether the component is opaque.    An opaque component fills its background with its background color.  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#setFont(java.awt.Font)">void setFont(Font)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#getFont()">Font getFont()</a>    <TD>    Set or get the component's font.    If a font has not been set for the component,    the font of its parent is returned.  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#getFontMetrics(java.awt.Font)">FontMetrics getFontMetrics(Font)</a>    <TD>    Get the font metrics for the specified font.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#setCursor(java.awt.Cursor)">void setCursor(Cursor)</a><br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#getCursor()">Cursor getCursor()</a>    <TD>    Set or get the cursor displayed over the component    and all components it contains    (except for children that have their own cursor set).    Example: <code>aPanel.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR));</code>    </TD>  </TR></TABLE><p><TABLE BORDER="1"><caption><A NAME="stateapi"><b>Setting and Getting Component State</b></A></caption><TR> <th> Method </th> <th> Purpose</th>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#setToolTipText(java.lang.String)">void setToolTipText(String)</a>    <TD>    Set the text to display in a tool tip.    See <a href="tooltip.html">How to Use Tool Tips</a>    for more information.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#setName(java.lang.String)">void setName(String)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#getName()">String getName()</a>    <TD>    Set or get the name of the component.    This can be useful when you need to associate text    with a component that doesn't display text.   </TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#isShowing()">boolean isShowing()</a>    <TD>    Determine whether the component is showing on screen.    This means that the component must be visible,    and it must be in a container that is visible and showing.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#setEnabled(boolean)">void setEnabled(boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#isEnabled()">boolean isEnabled()</a>    </TD>    <TD>    Set or get whether the component is enabled.    An enabled component can respond    to user input and generate events.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#setVisible(boolean)">void setVisible(boolean)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#isVisible()">boolean isVisible()</a>    </TD>    <TD>    Set or get whether the component is visible.    Components are initially visible,    with the exception of top-level components.  </TR></TABLE><p><TABLE BORDER="1"><caption><A NAME="eventapi"><b>Handling Events</b><br>(see<a class="TutorialLink" target="_top" href="../events/index.html">Writing Event Listeners</a> for details)</A></caption><TR> <th> Method </th> <th> Purpose</th>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#addMouseListener(java.awt.event.MouseListener)">void addMouseListener(MouseListener)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#removeMouseListener(java.awt.event.MouseListener)">void removeMouseListener(MouseListener)</a>    </TD>    <TD>    Add or remove a<a class="TutorialLink" target="_top" href="../events/mouselistener.html">mouse listener</a>    to or from the component.    Mouse listeners are notified    when the user uses the mouse to interact with    the listened-to component.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#addMouseMotionListener(java.awt.event.MouseMotionListener)">void addMouseMotionListener(MouseMotionListener)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#removeMouseMotionListener(java.awt.event.MouseMotionListener)">void removeMouseMotionListener(MouseMotionListener)</a>    </TD>    <TD>    Add or remove a<a class="TutorialLink" target="_top" href="../events/mousemotionlistener.html">mouse motion listener</a>    to or from the component.    Mouse motion listeners are notified    when the user moves the mouse within    the listened-to component's bounds.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#addKeyListener(java.awt.event.KeyListener)">void addKeyListener(KeyListener)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#removeKeyListener(java.awt.event.KeyListener)">void removeKeyListener(KeyListener)</a>    <TD>    Add or remove a<a class="TutorialLink" target="_top" href="../events/keylistener.html">key listener</a>    to or from the component.    Key listeners are notified    when the user types at the keyboard    and the listened-to component has the keyboard focus.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#addComponentListener(java.awt.event.ComponentListener)">void addComponentListener(ComponentListener)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#removeComponentListener(java.awt.event.ComponentListener)">void removeComponentListener(ComponentListener)</a>    </font></code>    <TD>    Add or remove a<a class="TutorialLink" target="_top" href="../events/componentlistener.html">component listener</a>    to or from the component.    Component listeners are notified    when the listened-to component is hidden, shown, moved, or resized.</TD>  </TR>  <tr>    <td><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#setTransferHandler(javax.swing.TransferHandler)">void setTransferHandler(TransferHandler)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#getTransferHandler()">TransferHandler getTransferHandler()</a>    </td>    <td>Set or remove the <code>transferHandler</code> property.        The <code>TransferHandler</code> supports exchanging data        via cut, copy, or paste to/from a clipboard as well a        drag and drop. See<a class="TutorialLink" target="_top" href="../dnd/intro.html">Introduction to Drag and Drop and Data Transfer</a>        for more details.    </td>  </tr>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#contains(int, int)">boolean contains(int, int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#contains(java.awt.Point)">boolean contains(Point)</a>    </TD>    <TD>    Determine whether the specified point is within the component.    The argument should be specified    in terms of the component's coordinate system.    The two <code>int</code> arguments specify <em>x</em> and <em>y</em> coordinates,    respectively.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Container.html#getComponentAt(int, int)">Component getComponentAt(int, int)</a><br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Container.html#getComponentAt(java.awt.Point)">Component getComponentAt(Point)</a>    </TD>    <TD>    Return the component that contains the specified <em>x, y</em> position.    The top-most child component is returned    in the case where components overlap.    This is determined by finding the component closest to the index 0    that claims to contain the given point via    <code>Component.contains()</code>.</TD>  </TR></TABLE><p><TABLE BORDER="1"><caption><A NAME="custompaintingapi"><b>Painting Components</b><br>(see<a class="TutorialLink" target="_top" href="../painting/index.html">Performing Custom Painting</a> for details)</A></caption><TR> <th> Method </th> <th> Purpose</th>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#repaint()">void repaint()</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Component.html#repaint(int, int, int, int)">void repaint(int, int, int, int)</a>    </TD>    <TD>    Request that all or part of the component be repainted.    The four <code>int</code> arguments specify    the bounds (<em>x</em>, <em>y</em>, width, height, in that order)    of the rectangle to be painted.    </TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#repaint(java.awt.Rectangle)">void repaint(Rectangle)</a>    </TD>    <TD>    Request that the specified area within the component be repainted.    </TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#revalidate()">void revalidate()</a>    </TD>    <TD>    Request that the component and its affected containers    be laid out again.    You shouldn't generally need to invoke this method    unless you explicitly change a component's size/alignment hints    after it's visible    or    change a containment hierarchy after it's visible.    You might need to invoke <code>repaint</code>    after <code>revalidate</code>.    </TD>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#paintComponent(java.awt.Graphics)">void paintComponent(Graphics)</a>    </TD>    <TD>    Paint the component.    Override this method to implement painting    for custom components.</TD>  </TR></TABLE><P><TABLE BORDER="1"><caption><A NAME="containmentapi"><b>Dealing with the Containment Hierarchy</b><br>      (see<a class="TutorialLink" target="_top" href="toplevel.html">Using Top-Level Containers</a> for more information)</A></caption><TR> <th> Method </th> <th> Purpose</th>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Container.html#add(java.awt.Component)">Component add(Component)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Container.html#add(java.awt.Component, int)">Component add(Component, int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Container.html#add(java.awt.Component, java.lang.Object)">void add(Component, Object)</a>    </TD>    <TD>    Add the specified component to this container.    The one-argument version of this method adds    the component to the end of the container.    When present, the <code>int</code> argument indicates the    new component's position within the container.    When present, the <code>Object</code> argument    provides layout constraints to the current layout manager.</TD>  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Container.html#remove(int)">void remove(int)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Container.html#remove(java.awt.Component)">void remove(Component)</a>    <br><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/java/awt/Container.html#removeAll()">void removeAll()</a>    </TD>    <TD>    Remove one of or all of the components from this container.    When present, the <code>int</code> argument indicates the    position within the container of the component to remove.  </TR>  <TR>    <TD><a class="APILink" target="_blank" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#getRootPane()">JRootPane getRootPane()</a>    </TD>    <TD>    Get the root pane that contains the component.</TD>  </TR>  <TR>

⌨️ 快捷键说明

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