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

📄 the jcomponent class.htm

📁 几个简单的java学习代码
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>The JComponent Class</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="Microsoft FrontPage 4.0" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff link=#000099>
<BLOCKQUOTE> 
  <UL>
    <LI><A 
    href="file:///E:/mdf/java/tutorial/uiswing/components/jcomponent.html#complookapi">Customizing 
    Component Appearance</A> 
    <LI><A 
    href="file:///E:/mdf/java/tutorial/uiswing/components/jcomponent.html#stateapi">Setting 
    Component State</A> 
    <LI><A 
    href="file:///E:/mdf/java/tutorial/uiswing/components/jcomponent.html#eventapi">Handling 
    Events</A> 
    <LI><A 
    href="file:///E:/mdf/java/tutorial/uiswing/components/jcomponent.html#custompaintingapi">Painting 
    Components</A> 
    <LI><A 
    href="file:///E:/mdf/java/tutorial/uiswing/components/jcomponent.html#containmentapi">Dealing 
    with the Containment Hierarchy</A> 
    <LI><A 
    href="file:///E:/mdf/java/tutorial/uiswing/components/jcomponent.html#layoutapi">Laying 
    Out Components</A> 
    <LI><A 
    href="file:///E:/mdf/java/tutorial/uiswing/components/jcomponent.html#sizeapi">Getting 
    Size and Position Information</A> 
    <LI><A 
    href="file:///E:/mdf/java/tutorial/uiswing/components/jcomponent.html#absoluteapi">Specifying 
    Absolute Size and Position</A> </LI></UL>
  <P>
  <TABLE border=1>
    <CAPTION><A name=complookapi><B>Customizing Component Appearance</B> 
    </A></CAPTION>
    <TBODY>
    <TR>
      <TH>Method </TH>
      <TH>Purpose</TH>
    <TR>
      <TD><CODE><FONT size=2>void setBorder(Border) <BR>Border getBorder() 
        </FONT></CODE><BR><EM>(in <CODE>JComponent</CODE>)</EM></TD>
      <TD>Set or get the border of the component. See <A 
        href="file:///E:/mdf/java/tutorial/uiswing/misc/border.html" 
        target=_top>How to Use Borders</A><A 
        href="file:///E:/mdf/java/tutorial/uiswing/misc/border.html" 
        target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
        height=20 src="The JComponent Class.files/uiIcon.gif" width=20></A> for 
        details. </TD></TR>
    <TR>
      <TD><CODE><FONT size=2>void setForeground(Color) <BR>Color 
        getForeground() <BR>void setBackground(Color) <BR>Color 
        getBackground()</FONT></CODE> <BR><EM>(in 
        <CODE>java.awt.Component</CODE>)</EM> </TD>
      <TD>Set or get the foreground or background color for the component. 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><CODE><FONT size=2>void setOpaque(boolean) </FONT></CODE><BR><EM>(in 
        <CODE>JComponent</CODE>)</EM></TD>
      <TD>Set whether the component is opaque. An opaque component fills its 
        background with its background color.</TD></TR>
    <TR>
      <TD><CODE><FONT size=2>boolean isOpaque </FONT></CODE><BR><EM>(in 
        <CODE>JComponent</CODE>)</EM></TD>
      <TD>Get whether the component is opaque. This method (but not 
        <CODE>setOpaque</CODE>) was added to <CODE>Component</CODE> in 1.2. </TD>
    <TR>
      <TD><CODE><FONT size=2>void setFont(Font) <BR>Font getFont() 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Component</CODE>)</EM></TD>
      <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.</TD></TR>
    <TR>
      <TD><CODE><FONT size=2>FontMetrics getFontMetrics(Font) 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Get the font metrics for the specified 
font.</TD></TR></TR></TBODY></TABLE>
  <P>
  <TABLE border=1>
    <CAPTION><A name=stateapi><B>Setting Component State</B> </A></CAPTION>
    <TBODY>
    <TR>
      <TH>Method </TH>
      <TH>Purpose</TH>
    <TR>
      <TD><CODE><FONT size=2>void setToolTipText(String) 
        </FONT></CODE><BR><EM>(in <CODE>JComponent</CODE>)</EM></TD>
      <TD>Set the text to display in a tool tip. See <A 
        href="file:///E:/mdf/java/tutorial/uiswing/components/tooltip.html">How 
        to Use Tool Tips</A> for more information.</TD></TR>
    <TR>
      <TD><CODE><FONT size=2>void setEnabled(boolean b) <BR>boolean 
        isEnabled() </FONT></CODE><BR><EM>(in 
        <CODE>java.awt.Component</CODE>)</EM></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><CODE><FONT size=2>void setLocale(Locale l) <BR>Locale getLocale() 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Set or get the component's locale. If the component does not have a 
        locale, the locale of its parent is returned. See <A 
        href="file:///E:/mdf/java/tutorial/i18n/index.html" 
        target=_top>Internalization</A><A 
        href="file:///E:/mdf/java/tutorial/i18n/index.html"><IMG 
        alt="(in the Internationalization trail)" border=0 height=20 
        src="The JComponent Class.files/internatsm.GIF" width=20></A> for 
        information about locales. </TD></TR>
    <TR>
      <TD><CODE><FONT size=2>void setCursor(Cursor) <BR>Cursor getCursor() 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Set or get the cursor image to display when the mouse is over the 
        component.</TD></TR>
    <TR>
      <TD><CODE><FONT size=2>void setVisible(boolean) <BR>boolean isVisible() 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Set or get whether the component is visible. Components are 
        initially visible, with the exception of top-level components. 
    </TD></TR></TBODY></TABLE>
  <P>
  <TABLE border=1>
    <CAPTION><A name=eventapi><B>Handling Events</B> <BR>(see <A 
    href="file:///E:/mdf/java/tutorial/uiswing/overview/event.html" 
    target=_top>Event Handling</A><A 
    href="file:///E:/mdf/java/tutorial/uiswing/overview/event.html" 
    target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
    height=20 src="The JComponent Class.files/uiIcon.gif" width=20></A> for 
    details) </A></CAPTION>
    <TBODY>
    <TR>
      <TH>Method </TH>
      <TH>Purpose</TH>
    <TR>
      <TD><CODE><FONT size=2>void addComponentListener(ComponentListener) 
        <BR>void removeComponentListener(ComponentListener) 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Add or remove a <A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/componentlistener.html" 
        target=_top>component listener</A><A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/componentlistener.html" 
        target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
        height=20 src="The JComponent Class.files/uiIcon.gif" width=20></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><CODE><FONT size=2>void addKeyListener(KeyListener) <BR>void 
        removeKeyListener(KeyListener l) </FONT></CODE><BR><EM>(in 
        <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Add or remove a <A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/keylistener.html" 
        target=_top>key listener</A><A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/keylistener.html" 
        target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
        height=20 src="The JComponent Class.files/uiIcon.gif" width=20></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><CODE><FONT size=2>addMouseListener(MouseListener l) <BR>void 
        removeMouseListener(MouseListener) </FONT></CODE><BR><EM>(in 
        <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Add or remove a <A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/mouselistener.html" 
        target=_top>mouse listener </A><A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/mouselistener.html" 
        target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
        height=20 src="The JComponent Class.files/uiIcon.gif" width=20></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><CODE><FONT size=2>void addMouseMotionListener(MouseMotionListener) 
        <BR>void removeMouseMotionListener(MouseMotionListener) 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Add or remove a <A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/mousemotionlistener.html" 
        target=_top>mouse motion listener </A><A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/mousemotionlistener.html" 
        target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
        height=20 src="The JComponent Class.files/uiIcon.gif" width=20></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><CODE><FONT size=2>void addContainerListener(ContainerListener) 
        <BR>void removeContainerListener(ContainerListener) 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Container</CODE>)</EM></TD>
      <TD>Add or remove a <A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/containerlistener.html" 
        target=_top>container listener</A><A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/containerlistener.html" 
        target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
        height=20 src="The JComponent Class.files/uiIcon.gif" width=20></A> to 
        or from the container. Container listeners are notified when a component 
        is added to or removed from the listened-to container.</TD></TR>
    <TR>
      <TD><CODE><FONT size=2>void addFocusListener(FocusListener) <BR>void 
        removeFocusListener(FocusListener) </FONT></CODE><BR><EM>(in 
        <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Add or remove a <A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/focuslistener.html" 
        target=_top>focus listener</A><A 
        href="file:///E:/mdf/java/tutorial/uiswing/events/focuslistener.html" 
        target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
        height=20 src="The JComponent Class.files/uiIcon.gif" width=20></A> to 
        or from the component. Focus listeners are notified when the listened-to 
        component gains or loses keyboard focus.</TD></TR>
    <TR>
      <TD><CODE><FONT size=2>Component getNextFocusableComponent() <BR>void 
        setNextFocusableComponent(Component) </FONT></CODE><BR><EM>(in 
        <CODE>JComponent</CODE>)</EM></TD>
      <TD>Set or get the next focusable component. <CODE>null</CODE> indicates 
        that the focus manager should choose the next focusable component 
        automatically.</TD></TR>
    <TR>
      <TD><CODE><FONT size=2>void requestFocus() <BR>boolean hasFocus() 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Component</CODE>)</EM></TD>
      <TD>Request that the component get the keyboard focus, or detect whether 
        it has the focus. </TD></TR>
    <TR>
      <TD><CODE><FONT size=2>boolean contains(int, int) <BR>boolean 
        contains(Point p) </FONT></CODE><BR><EM>(in 
        <CODE>java.awt.Component</CODE>)</EM></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 x and y coordinates, 
        respectively.</TD></TR>
    <TR>
      <TD><CODE><FONT size=2>Component getComponentAt(int, int) 
        </FONT></CODE><BR><EM>(in <CODE>java.awt.Container</CODE>)</EM></TD>
      <TD>Return the component that contains the specified x, y 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></TBODY></TABLE>
  <P>
  <TABLE border=1>
    <CAPTION><A name=custompaintingapi><B>Painting Components</B> <BR>(see <A 
    href="file:///E:/mdf/java/tutorial/uiswing/overview/draw.html" 
    target=_top>Painting</A><A 
    href="file:///E:/mdf/java/tutorial/uiswing/overview/draw.html" 
    target=_top><IMG alt="(in the Creating a User Interface trail)" border=0 
    height=20 src="The JComponent Class.files/uiIcon.gif" width=20></A> for 
    details) </A></CAPTION>
    <TBODY>
    <TR>
      <TH>Method </TH>

⌨️ 快捷键说明

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