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

📄 component.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 页 / 共 5 页
字号:
    return p;  }  /**   * Tests if this component is opaque. All "heavyweight" (natively-drawn)   * components are opaque. A component is opaque if it draws all pixels in   * the bounds; a lightweight component is partially transparent if it lets   * pixels underneath show through. Subclasses that guarantee that all pixels   * will be drawn should override this.   *   * @return true if this is opaque   * @see #isLightweight()   * @since 1.2   */  public boolean isOpaque()  {    return ! isLightweight();  }  /**   * Return whether the component is lightweight. That means the component has   * no native peer, but is displayable. This applies to subclasses of   * Component not in this package, such as javax.swing.   *   * @return true if the component has a lightweight peer   * @see #isDisplayable()   * @since 1.2   */  public boolean isLightweight()  {    return peer instanceof LightweightPeer;  }  /**   * Returns the component's preferred size.   *   * @return the component's preferred size   * @see #getMinimumSize()   * @see LayoutManager   */  public Dimension getPreferredSize()  {    if (prefSize == null)      prefSize = (peer != null ? peer.getPreferredSize()                       : new Dimension(width, height));    return prefSize;  }  /**   * Returns the component's preferred size.   *   * @return the component's preferred size   * @deprecated use {@link #getPreferredSize()} instead   */  public Dimension preferredSize()  {    return getPreferredSize();  }  /**   * Returns the component's minimum size.   *   * @return the component's minimum size   * @see #getPreferredSize()   * @see LayoutManager   */  public Dimension getMinimumSize()  {    if (minSize == null)      minSize = (peer != null ? peer.getMinimumSize()                 : new Dimension(width, height));    return minSize;  }  /**   * Returns the component's minimum size.   *   * @return the component's minimum size   * @deprecated use {@link #getMinimumSize()} instead   */  public Dimension minimumSize()  {    return getMinimumSize();  }  /**   * Returns the component's maximum size.   *   * @return the component's maximum size   * @see #getMinimumSize()   * @see #getPreferredSize()   * @see LayoutManager   */  public Dimension getMaximumSize()  {    return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);  }  /**   * Returns the preferred horizontal alignment of this component. The value   * returned will be between {@link #LEFT_ALIGNMENT} and   * {@link #RIGHT_ALIGNMENT}, inclusive.   *   * @return the preferred horizontal alignment of this component   */  public float getAlignmentX()  {    return CENTER_ALIGNMENT;  }  /**   * Returns the preferred vertical alignment of this component. The value   * returned will be between {@link #TOP_ALIGNMENT} and   * {@link #BOTTOM_ALIGNMENT}, inclusive.   *   * @return the preferred vertical alignment of this component   */  public float getAlignmentY()  {    return CENTER_ALIGNMENT;  }  /**   * Calls the layout manager to re-layout the component. This is called   * during validation of a container in most cases.   *   * @see #validate()   * @see LayoutManager   */  public void doLayout()  {    // nothing to do unless we're a container  }  /**   * Calls the layout manager to re-layout the component. This is called   * during validation of a container in most cases.   *   * @deprecated use {@link #doLayout()} instead   */  public void layout()  {    doLayout();  }  /**   * Called to ensure that the layout for this component is valid. This is   * usually called on containers.   *   * @see #invalidate()   * @see #doLayout()   * @see LayoutManager   * @see Container#validate()   */  public void validate()  {    valid = true;  }  /**   * Invalidates this component and all of its parent components. This will   * cause them to have their layout redone. This is called frequently, so   * make it fast.   */  public void invalidate()  {    valid = false;    prefSize = null;    minSize = null;    if (parent != null && parent.valid)      parent.invalidate();  }  /**   * Returns a graphics object for this component. Returns <code>null</code>   * if this component is not currently displayed on the screen.   *   * @return a graphics object for this component   * @see #paint(Graphics)   */  public Graphics getGraphics()  {    if (peer != null)      {        Graphics gfx = peer.getGraphics();        if (gfx != null)          return gfx;        // create graphics for lightweight:        Container parent = getParent();        if (parent != null)          {            gfx = parent.getGraphics();            Rectangle bounds = getBounds();            gfx.setClip(bounds);            gfx.translate(bounds.x, bounds.y);            return gfx;          }      }    return null;  }  /**   * Returns the font metrics for the specified font in this component.   *   * @param font the font to retrieve metrics for   * @return the font metrics for the specified font   * @throws NullPointerException if font is null   * @see #getFont()   * @see Toolkit#getFontMetrics(Font)   */  public FontMetrics getFontMetrics(Font font)  {    return peer == null ? getToolkit().getFontMetrics(font)      : peer.getFontMetrics(font);  }  /**   * Sets the cursor for this component to the specified cursor. The cursor   * is displayed when the point is contained by the component, and the   * component is visible, displayable, and enabled. This is inherited by   * subcomponents unless they set their own cursor.   *   * @param cursor the new cursor for this component   * @see #isEnabled()   * @see #isShowing()   * @see #getCursor()   * @see #contains(int, int)   * @see Toolkit#createCustomCursor(Image, Point, String)   */  public void setCursor(Cursor cursor)  {    this.cursor = cursor;    if (peer != null)      peer.setCursor(cursor);  }  /**   * Returns the cursor for this component. If not set, this is inherited   * from the parent, or from Cursor.getDefaultCursor().   *   * @return the cursor for this component   */  public Cursor getCursor()  {    if (cursor != null)      return cursor;    return parent != null ? parent.getCursor() : Cursor.getDefaultCursor();  }  /**   * Tests if the cursor was explicitly set, or just inherited from the parent.   *   * @return true if the cursor has been set   * @since 1.4   */  public boolean isCursorSet()  {    return cursor != null;  }  /**   * Paints this component on the screen. The clipping region in the graphics   * context will indicate the region that requires painting. This is called   * whenever the component first shows, or needs to be repaired because   * something was temporarily drawn on top. It is not necessary for   * subclasses to call <code>super.paint(g)</code>. Components with no area   * are not painted.   *   * @param g the graphics context for this paint job   * @see #update(Graphics)   */  public void paint(Graphics g)  {  }  /**   * Updates this component. This is called in response to   * <code>repaint</code>. This method fills the component with the   * background color, then sets the foreground color of the specified   * graphics context to the foreground color of this component and calls   * the <code>paint()</code> method. The coordinates of the graphics are   * relative to this component. Subclasses should call either   * <code>super.update(g)</code> or <code>paint(g)</code>.   *   * @param graphics the graphics context for this update   * @see #paint(Graphics)   * @see #repaint()   */  public void update(Graphics g)  {    paint(g);  }  /**   * Paints this entire component, including any sub-components.   *   * @param graphics the graphics context for this paint job   * @see #paint(Graphics)   */  public void paintAll(Graphics g)  {    if (! visible)      return;    if (peer != null)      peer.paint(g);    paint(g);  }  /**   * Repaint this entire component. The <code>update()</code> method   * on this component will be called as soon as possible.   *   * @see #update(Graphics)   * @see #repaint(long, int, int, int, int)   */  public void repaint()  {    repaint(0, 0, 0, width, height);  }  /**   * Repaint this entire component. The <code>update()</code> method on this   * component will be called in approximate the specified number of   * milliseconds.   *   * @param tm milliseconds before this component should be repainted   * @see #paint(Graphics)   * @see #repaint(long, int, int, int, int)   */  public void repaint(long tm)  {    repaint(tm, 0, 0, width, height);  }  /**   * Repaints the specified rectangular region within this component. The   * <code>update</code> method on this component will be called as soon as   * possible. The coordinates are relative to this component.   *   * @param x the X coordinate of the upper left of the region to repaint   * @param y the Y coordinate of the upper left of the region to repaint   * @param w the width of the region to repaint   * @param h the height of the region to repaint   * @see #update(Graphics)   * @see #repaint(long, int, int, int, int)   */  public void repaint(int x, int y, int w, int h)  {    repaint(0, x, y, w, h);  }  /**   * Repaints the specified rectangular region within this component. The   * <code>update</code> method on this component will be called in   * approximately the specified number of milliseconds. The coordinates   * are relative to this component.   *   * @param tm milliseconds before this component should be repainted   * @param x the X coordinate of the upper left of the region to repaint   * @param y the Y coordinate of the upper left of the region to repaint   * @param w the width of the region to repaint   * @param h the height of the region to repaint   * @see #update(Graphics)   */  public void repaint(long tm, int x, int y, int width, int height)  {    // Handle lightweight repainting by forwarding to native parent    if (isLightweight() && parent != null)      {        if (parent != null)          parent.repaint(tm, x + getX(), y + getY(), width, height);      }    else if (peer != null)      peer.repaint(tm, x, y, width, height);  }  /**   * Prints this component. This method is provided so that printing can be   * done in a different manner from painting. However, the implementation   * in this class simply calls the <code>paint()</code> method.   *   * @param graphics the graphics context of the print device   * @see #paint(Graphics)   */  public void print(Graphics g)  {    paint(g);  }  /**   * Prints this component, including all sub-components. This method is   * provided so that printing can be done in a different manner from   * painting. However, the implementation in this class simply calls the   * <code>paintAll()</code> method.   *   * @param graphics the graphics context of the print device   * @see #paintAll(Graphics)   */  public void printAll(Graphics g)  {    paintAll(g);  }  /**   * Called when an image has changed so that this component is repainted.   * This incrementally draws an image as more bits are available, when   * possible. Incremental drawing is enabled if the system property   * <code>awt.image.incrementalDraw</code> is not present or is true, in which   * case the redraw rate is set to 100ms or the value of the system property   * <code>awt.image.redrawrate</code>.   *   * <p>The coordinate system used depends on the particular flags.   *   * @param image the image that has been updated   * @param flags tlags as specified in <code>ImageObserver</code>   * @param x the X coordinate   * @param y the Y coordinate   * @param w the width   * @param h the height   * @return true if the image has been fully loaded   * @see ImageObserver   * @see Graphics#drawImage(Image, int, int, Color, ImageObserver)   * @see Graphics#drawImage(Image, int, int, ImageObserver)   * @see Graphics#drawImage(Image, int, int, int, int, Color, ImageObserver)   * @see Graphics#drawImage(Image, int, int, int, int, ImageObserver)   * @see ImageObserver#update(Image, int, int, int, int, int)   */  public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)  {    // XXX Implement.    throw new Error("not implemented");  }  /**   * Creates an image from the specified producer.   *   * @param producer the image procedure to create the image from   * @return the resulting image   */  public Image createImage(ImageProducer producer)  {    // XXX What if peer or producer is null?    return peer.createImage(producer);  }  /**   * Creates an image with the specified width and height for use in   * double buffering. Headless environments do not support images.   *   * @param width the width of the image   * @param height the height of the image   * @return the requested image, or null if it is not supported   */  public Image createImage(int width, int height)  {    if (GraphicsEnvironment.isHeadless())      return null;    GraphicsConfiguration config = getGraphicsConfiguration();    return config == null ? null : config.createCompatibleImage(width, height);  }  /**   * Creates an image with the specified width and height for use in   * double buffering. Headless environments do not support images.   *   * @param width the width of the image   * @param height the height of the image   * @return the requested image, or null if it is not supported   * @since 1.4

⌨️ 快捷键说明

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