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

📄 metaliconfactory.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        /**     * Creates a new instance.     */    public InternalFrameMaximizeIcon()     {      // Nothing to do here.    }        /**     * Returns the width of the icon, in pixels.     *      * @return The width of the icon.     */    public int getIconWidth()     {      return 16;    }        /**     * Returns the height of the icon, in pixels.     *      * @return The height of the icon.     */    public int getIconHeight()     {      return 16;    }        /**     * Paints the icon at the specified location.     *      * @param c  the component.     * @param g  the graphics device.     * @param x  the x coordinate.     * @param y  the y coordinate.     */    public void paintIcon(Component c, Graphics g, int x, int y)     {      Color savedColor = g.getColor();            AbstractButton b = (AbstractButton) c;            // fill the interior      if (b.getModel().isPressed())        g.setColor(MetalLookAndFeel.getPrimaryControlShadow());      else        g.setColor(MetalLookAndFeel.getPrimaryControl());      g.fillRect(x + 2, y + 6, 7, 7);      if (b.getModel().isPressed())        g.setColor(MetalLookAndFeel.getBlack());      else        g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());                g.drawLine(x + 9, y + 1, x + 10, y + 1);      g.fillRect(x + 11, y + 1, 3, 3);      g.fillRect(x + 12, y + 4, 2, 2);      g.drawLine(x + 10, y + 3, x + 10, y + 3);      g.drawLine(x + 9, y + 4, x + 10, y + 4);      g.drawLine(x + 1, y + 5, x + 9, y + 5);      g.drawLine(x + 1, y + 6, x + 1, y + 12);      g.drawLine(x + 9, y + 6, x + 9, y + 12);      g.drawLine(x + 1, y + 13, x + 9, y + 13);            // fill      g.drawLine(x + 7, y + 6, x + 8, y + 6);      g.drawLine(x + 6, y + 7, x + 8, y + 7);      g.drawLine(x + 5, y + 8, x + 6, y + 8);      g.drawLine(x + 4, y + 9, x + 5, y + 9);      g.drawLine(x + 3, y + 10, x + 4, y + 10);      g.drawLine(x + 2, y + 11, x + 3, y + 11);      g.drawLine(x + 2, y + 12, x + 4, y + 12);      g.drawLine(x + 8, y + 8, x + 8, y + 8);            // draw black      g.setColor(MetalLookAndFeel.getBlack());      g.drawLine(x + 8, y, x + 13, y);      g.drawLine(x + 8, y + 1, x + 8, y + 1);      g.drawLine(x + 10, y + 2, x + 9, y + 3);      g.drawLine(x, y + 4, x + 8, y + 4);      g.drawLine(x, y + 5, x, y + 13);            g.drawLine(x + 2, y + 10, x + 6, y + 6);      g.drawLine(x + 8, y + 9, x + 8, y + 11);      g.drawLine(x + 5, y + 12, x + 8, y + 12);            // draw white      g.setColor(MetalLookAndFeel.getWhite());      if (!b.getModel().isPressed())        {          g.drawLine(x + 2, y + 6, x + 5, y + 6);          g.drawLine(x + 2, y + 7, x + 2, y + 9);          g.drawLine(x + 4, y + 11, x + 7, y + 8);        }            g.drawLine(x + 1, y + 14, x + 10, y + 14);      g.drawLine(x + 10, y + 5, x + 10, y + 13);            g.drawLine(x + 9, y + 2, x + 9, y + 2);      g.drawLine(x + 11, y + 4, x + 11, y + 5);      g.drawLine(x + 13, y + 6, x + 14, y + 6);      g.drawLine(x + 14, y + 1, x + 14, y + 5);      g.setColor(savedColor);    }          }  /**   * An icon used in the title frame of a {@link JInternalFrame}.   */  private static class InternalFrameMinimizeIcon implements Icon, Serializable  {      /**     * Creates a new instance.     */    public InternalFrameMinimizeIcon()     {      // Nothing to do here.    }        /**     * Returns the width of the icon, in pixels.     *      * @return The width of the icon.     */    public int getIconWidth()     {      return 16;    }        /**     * Returns the height of the icon, in pixels.     *      * @return The height of the icon.     */    public int getIconHeight()     {      return 16;    }        /**     * Paints the icon at the specified location.     *      * @param c  the component.     * @param g  the graphics device.     * @param x  the x coordinate.     * @param y  the y coordinate.     */    public void paintIcon(Component c, Graphics g, int x, int y)     {      Color savedColor = g.getColor();            AbstractButton b = (AbstractButton) c;            if (b.getModel().isPressed())        g.setColor(MetalLookAndFeel.getBlack());      else        // FIXME: here the color depends on whether or not the internal frame         // is selected         g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());            g.drawLine(x + 12, y + 1, x + 13, y + 1);      g.drawLine(x + 11, y + 2, x + 12, y + 2);      g.drawLine(x + 10, y + 3, x + 11, y + 3);      g.drawLine(x + 8, y + 2, x + 8, y + 3);      g.fillRect(x + 8, y + 4, 3, 3);      g.drawLine(x + 11, y + 6, x + 12, y + 6);            g.drawLine(x + 1, y + 8, x + 6, y + 8);      g.drawLine(x + 1, y + 9, x + 1, y + 12);      g.drawLine(x + 6, y + 9, x + 6, y + 12);      g.drawLine(x + 1, y + 13, x + 6, y + 13);            g.drawLine(x + 5, y + 9, x + 5, y + 9);      g.drawLine(x + 2, y + 12, x + 2, y + 12);            g.setColor(MetalLookAndFeel.getBlack());      g.drawLine(x + 12, y, x + 9, y + 3);      g.drawLine(x + 7, y + 1, x + 8, y + 1);      g.drawLine(x + 7, y + 2, x + 7, y + 6);      g.drawLine(x, y + 7, x + 6, y + 7);      g.drawLine(x, y + 8, x, y + 13);      g.drawLine(x + 3, y + 12, x + 5, y + 12);      g.drawLine(x + 5, y + 10, x + 5, y + 11);      g.drawLine(x + 11, y + 5, x + 12, y + 5);            g.setColor(MetalLookAndFeel.getWhite());      g.drawLine(x + 9, y + 2, x + 9, y + 2);      g.drawLine(x + 11, y + 4, x + 13, y + 2);      g.drawLine(x + 13, y + 6, x + 13, y + 6);      g.drawLine(x + 8, y + 7, x + 13, y + 7);      g.drawLine(x + 7, y + 9, x + 7, y + 13);      g.drawLine(x + 1, y + 14, x + 7, y + 14);      if (b.getModel().isPressed())        {          g.setColor(MetalLookAndFeel.getPrimaryControlShadow());          g.fillRect(x + 2, y + 9, 3, 3);        }      else        {          g.drawLine(x + 2, y + 9, x + 4, y + 9);          g.drawLine(x + 2, y + 10, x + 2, y + 11);        }      g.setColor(savedColor);    }          }  /**   * The icon used to display the thumb control on a horizontally oriented   * {@link JSlider} component.   */  private static class VerticalSliderThumbIcon implements Icon, Serializable  {    /**     * Creates a new instance.     */    public VerticalSliderThumbIcon()     {      // Nothing to do here.    }        /**     * Returns the width of the icon, in pixels.     *      * @return The width of the icon.     */    public int getIconWidth()     {      return 16;    }        /**     * Returns the height of the icon, in pixels.     *      * @return The height of the icon.     */    public int getIconHeight()     {      return 15;    }        /**     * Paints the icon taking into account whether the slider control has the     * focus or not.     *      * @param c  the slider (must be a non-<code>null</code> instance of     *           {@link JSlider}.     * @param g  the graphics device.     * @param x  the x-coordinate.     * @param y  the y-coordinate.     */    public void paintIcon(Component c, Graphics g, int x, int y)     {      boolean enabled = false;      boolean focus = false;      if (c != null)        {          enabled = c.isEnabled();          focus = c.hasFocus();            }            // draw the outline      if (enabled)         g.setColor(MetalLookAndFeel.getBlack());      else        g.setColor(MetalLookAndFeel.getControlDarkShadow());      g.drawLine(x + 1, y, x + 7, y);      g.drawLine(x + 8, y, x + 15, y + 7);      g.drawLine(x + 14, y + 8, x + 8, y + 14);      g.drawLine(x + 8, y + 14, x + 1, y + 14);      g.drawLine(x, y + 13, x, y + 1);            // fill the icon      if (focus)        g.setColor(MetalLookAndFeel.getPrimaryControlShadow());      else        g.setColor(MetalLookAndFeel.getControl());      g.fillRect(x + 2, y + 1, 7, 13);      g.drawLine(x + 9, y + 2, x + 9, y + 12);      g.drawLine(x + 10, y + 3, x + 10, y + 11);      g.drawLine(x + 11, y + 4, x + 11, y + 10);      g.drawLine(x + 12, y + 5, x + 12, y + 9);      g.drawLine(x + 13, y + 6, x + 13, y + 8);      g.drawLine(x + 14, y + 7, x + 14, y + 7);            // if the slider is enabled, draw dots and highlights      if (enabled)        {          if (focus)            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());          else            g.setColor(MetalLookAndFeel.getBlack());          g.drawLine(x + 3, y + 3, x + 3, y + 3);          g.drawLine(x + 3, y + 7, x + 3, y + 7);          g.drawLine(x + 3, y + 11, x + 3, y + 11);          g.drawLine(x + 5, y + 5, x + 5, y + 5);          g.drawLine(x + 5, y + 9, x + 5, y + 9);          g.drawLine(x + 7, y + 3, x + 7, y + 3);          g.drawLine(x + 7, y + 7, x + 7, y + 7);          g.drawLine(x + 7, y + 11, x + 7, y + 11);          // draw highlights          if (focus)            g.setColor(MetalLookAndFeel.getPrimaryControl());          else            g.setColor(MetalLookAndFeel.getWhite());          g.drawLine(x + 1, y + 1, x + 8, y + 1);          g.drawLine(x + 1, y + 2, x + 1, y + 13);          g.drawLine(x + 2, y + 2, x + 2, y + 2);          g.drawLine(x + 2, y + 6, x + 2, y + 6);          g.drawLine(x + 2, y + 10, x + 2, y + 10);          g.drawLine(x + 4, y + 4, x + 4, y + 4);          g.drawLine(x + 4, y + 8, x + 4, y + 8);          g.drawLine(x + 6, y + 2, x + 6, y + 2);          g.drawLine(x + 6, y + 6, x + 6, y + 6);          g.drawLine(x + 6, y + 10, x + 6, y + 10);                }    }          }      /**   * A tree control icon.  This icon can be in one of two states: expanded and   * collapsed.   */  public static class TreeControlIcon implements Icon, Serializable  {        /** ???. */    protected boolean isLight;        /** A flag that controls whether or not the icon is collapsed. */    private boolean collapsed;        /**     * Creates a new icon.     *      * @param isCollapsed  a flag that controls whether the icon is in the     *                     collapsed state or the expanded state.     */    public TreeControlIcon(boolean isCollapsed)     {      collapsed = isCollapsed;    }        /**     * Returns the width of the icon, in pixels.     *      * @return The width of the icon.     */    public int getIconWidth()     {      return 18;    }    /**     * Returns the height of the icon, in pixels.     *      * @return The height of the icon.     */    public int getIconHeight()     {      return 18;    }        /**     * Paints the icon at the location (x, y).     *      * @param c  the component.     * @param g  the graphics device.     * @param x  the x coordinate.     * @param y  the y coordinate.     */    public void paintIcon(Component c, Graphics g, int x, int y)     {      x = x + 5;      y = y + 5;      if (collapsed)       {        // TODO: pick up appropriate UI colors        g.setColor(Color.black);        g.drawLine(x + 2, y, x + 5, y);        g.drawLine(x + 6, y + 1, x + 7, y + 2);        g.fillRect(x + 7, y + 3, 5, 2);        g.drawLine(x + 7, y + 5, x + 6, y + 6);        g.drawLine(x + 1, y + 1, x + 1, y + 1);        g.drawLine(x, y + 2, x, y + 5);        g.drawLine(x + 1, y + 6, x + 1, y + 6);        g.drawLine(x + 2, y + 7, x + 5, y + 7);        g.fillRect(x + 3, y + 3, 2, 2);        g.setColor(new Color(204, 204, 255));        g.drawLine(x + 3, y + 2, x + 4, y + 2);        g.drawLine(x + 2, y + 3, x + 2, y + 4);        g.drawLine(x + 3, y + 5, x + 3, y + 5);        g.drawLine(x + 5, y + 3, x + 5, y + 3);                g.setColor(new Color(153, 153, 204));        g.drawLine(x + 2, y + 2, x + 2, y + 2);        g.drawLine(x + 2, y + 5, x + 2, y + 5);        g.drawLine(x + 2, y + 6, x + 5, y + 6);        g.drawLine(x + 5, y + 2, x + 5, y + 2);        g.drawLine(x + 6, y + 2, x + 6, y + 5);                g.setColor(new Color(102, 102, 153));        g.drawLine(x + 2, y + 1, x + 5, y + 1);        g.drawLine(x + 1, y + 2, x + 1, y + 5);      }      else      {        // TODO: pick up appropriate UI colors        g.setColor(Color.black);        g.drawLine(x + 2, y, x + 5, y);        g.drawLine(x + 6, y + 1, x + 7, y + 2);        g.drawLine(x + 7, y + 2, x + 7, y + 5);        g.fillRect(x + 3, y + 7, 2, 5);        g.drawLine(x + 7, y + 5, x + 6, y + 6);        g.drawLine(x + 1, y + 1, x + 1, y + 1);        g.drawLine(x, y + 2, x, y + 5);        g.drawLine(x + 1, y + 6, x + 1, y + 6);        g.drawLine(x + 2, y + 7, x + 5, y + 7);        g.fillRect(x + 3, y + 3, 2, 2);        g.setColor(new Color(204, 204, 255));        g.drawLine(x + 3, y + 2, x + 4, y + 2);        g.drawLine(x + 2, y + 3, x + 2, y + 4);        g.drawLine(x + 3, y + 5, x + 3, y + 5);        g.drawLine(x + 5, y + 3, x + 5, y + 3);                g.setColor(new Color(153, 153, 204));        g.drawLine(x + 2, y + 2, x + 2, y + 2);        g.drawLine(x + 2, y + 5, x + 2, y + 5);        g.drawLine(x + 2, y + 6, x + 5, y + 6);        g.drawLine(x + 5, y + 2, x + 5, y + 2);        g.drawLine(x + 6, y + 2, x + 6, y + 5);                g.setColor(new Color(102, 102, 153));        g.drawLine(x + 2, y + 1, x + 5, y + 1);        g.drawLine(x + 1, y + 2, x + 1, y + 5);      }    }         /**     * Simply calls {@link #paintIcon(Component, Graphics, int, int)}.     *      * @param c  the component.     * @param g  the graphics device.     * @param x  the x coordinate.

⌨️ 快捷键说明

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