コード例 #1
0
ファイル: JMenu.java プロジェクト: flesire/jnode.mirror
  /**
   * Sets the foreground color of this JMenu and all its contained JMenuItems that do not yet have
   * their foreground color set. Overrides the same method in the Component class.
   */
  public void setForeground(Color color_) {
    super.setForeground(color_);

    Enumeration<Component> e = _menuItems.elements();
    while (e.hasMoreElements()) {
      Component c = e.nextElement();
      if (c.getForeground() == null) c.setForeground(color_);
    }
  }
コード例 #2
0
ファイル: JMenu.java プロジェクト: flesire/jnode.mirror
  /**
   * This package-private method is called by JMenuwhen this JMenu is added to it as a submenu. It
   * is not intended to be called by application programmers.
   */
  void setParentMenu(Component parent_) {
    _parentMenu = new WeakReference<Component>(parent_);

    // If the colors of this menu have not been set yet, inherit the
    // colors of the parent.
    if (super.getForeground() == null) super.setForeground(parent_.getForeground());

    if (super.getBackground() == null) super.setBackground(parent_.getBackground());
  }
コード例 #3
0
ファイル: LineBorder.java プロジェクト: flesire/jnode.mirror
  /**
   * Paints the border for the specified component with the specified position and size.
   *
   * <p>
   *
   * @param component_ the component around which this border is being drawn. The background color
   *     of the border is obtained from the component. If the line color of this border is also set
   *     to null, the foreground color of the border is also obtained from component_.
   * @param graphics_ This parameter is just a placeholder where the Swing "Graphics" parameter
   *     would be.
   * @param x_ The x coordinate of the top left corner.
   * @param y_ The y coordinate of the top left corner.
   * @param width_ the width of the border box.
   * @param height_ the height of the border box.
   * @param toolkit
   */
  public void paintBorder(
      Component component_,
      int graphics_,
      int x_,
      int y_,
      int width_,
      int height_,
      Toolkit toolkit) {

    Color background = component_.getBackground();
    if (_lineColor == null) _lineColor = component_.getForeground();

    int curses_colorpair = Color.getCursesColor(_lineColor, background);

    toolkit.drawBoxNative(x_, y_, x_ + width_ - 1, y_ + height_ - 1, curses_colorpair);
  }