📄 metaliconfactory.java
字号:
g.setColor(MetalLookAndFeel.getBlack()); g.drawLine(x + 2, y, x + 6, y); g.drawLine(x + 7, y + 1, x + 7, y + 1); g.drawLine(x + 8, y + 2, x + 8, y + 6); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 2, y + 8, x + 6, y + 8); g.drawLine(x + 1, y + 7, x + 1, y + 7); g.drawLine(x, y + 2, x, y + 6); g.drawLine(x + 1, y + 1, x + 1, y + 1); if (item.isSelected()) { g.drawLine(x + 3, y + 2, x + 5, y + 2); g.fillRect(x + 2, y + 3, 5, 3); g.drawLine(x + 3, y + 6, x + 5, y + 6); } // highlight g.setColor(MetalLookAndFeel.getControlHighlight()); g.drawLine(x + 3, y + 1, x + 6, y + 1); g.drawLine(x + 8, y + 1, x + 8, y + 1); g.drawLine(x + 9, y + 2, x + 9, y + 7); g.drawLine(x + 8, y + 8, x + 8, y + 8); g.drawLine(x + 2, y + 9, x + 7, y + 9); g.drawLine(x + 1, y + 8, x + 1, y + 8); g.drawLine(x + 1, y + 3, x + 1, y + 6); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.setColor(savedColor); } } /** * The icon used to display the thumb control on a horizontally oriented * {@link JSlider} component. */ private static class HorizontalSliderThumbIcon implements Icon, Serializable { /** * Creates a new instance. */ public HorizontalSliderThumbIcon() { // Nothing to do here. } /** * Returns the width of the icon, in pixels. * * @return The width of the icon. */ public int getIconWidth() { return 15; } /** * Returns the height of the icon, in pixels. * * @return The height of the icon. */ public int getIconHeight() { return 16; } /** * Paints the icon, taking into account whether or not the component has * the focus. * * @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) { 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 + 13, y); g.drawLine(x + 14, y + 1, x + 14, y + 7); g.drawLine(x + 14, y + 8, x + 7, y + 15); g.drawLine(x + 6, y + 14, x, y + 8); g.drawLine(x, y + 7, x, y + 1); // fill the icon if (focus) g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); else g.setColor(MetalLookAndFeel.getControl()); g.fillRect(x + 1, y + 2, 13, 7); g.drawLine(x + 2, y + 9, x + 12, y + 9); g.drawLine(x + 3, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 11, x + 10, y + 11); g.drawLine(x + 5, y + 12, x + 9, y + 12); g.drawLine(x + 6, y + 13, x + 8, y + 13); g.drawLine(x + 7, y + 14, x + 7, y + 14); // if the slider is enabled, draw dots and highlights if (c.isEnabled()) { if (focus) g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow()); else g.setColor(MetalLookAndFeel.getBlack()); g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 7, y + 3, x + 7, y + 3); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.drawLine(x + 5, y + 5, x + 5, y + 5); g.drawLine(x + 9, y + 5, x + 9, y + 5); g.drawLine(x + 3, y + 7, x + 3, y + 7); g.drawLine(x + 7, y + 7, x + 7, y + 7); g.drawLine(x + 11, y + 7, x + 11, y + 7); // draw highlights if (focus) g.setColor(MetalLookAndFeel.getPrimaryControl()); else g.setColor(MetalLookAndFeel.getWhite()); g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 6, y + 2, x + 6, y + 2); g.drawLine(x + 10, y + 2, x + 10, y + 2); g.drawLine(x + 4, y + 4, x + 4, y + 4); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 2, y + 6, x + 2, y + 6); g.drawLine(x + 6, y + 6, x + 6, y + 6); g.drawLine(x + 10, y + 6, x + 10, y + 6); } } } /** * An icon used for the 'close' button in the title frame of a * {@link JInternalFrame}. */ private static class InternalFrameCloseIcon implements Icon, Serializable { /** The icon size in pixels. */ private int size; /** * Creates a new icon. * * @param size the icon size (width and height) in pixels. */ public InternalFrameCloseIcon(int size) { this.size = size; } /** * Returns the width of the icon, in pixels. * * @return The width of the icon. */ public int getIconWidth() { return size; } /** * Returns the height of the icon, in pixels. * * @return The height of the icon. */ public int getIconHeight() { return size; } /** * Paints the icon. * * @param c the component (an {@link JInternalFrame} is expected). * @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()) // FIXME: also need to take into account whether the internal frame is // selected g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); else g.setColor(MetalLookAndFeel.getPrimaryControl()); g.fillRect(x + 2, y + 2, 10, 10); // draw the outline box and the cross if (b.getModel().isPressed()) g.setColor(MetalLookAndFeel.getBlack()); else { // FIXME: also need to take into account whether the internal frame is // selected boolean selected = true; if (selected) g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow()); else g.setColor(MetalLookAndFeel.getControlDarkShadow()); } g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 2, x + 1, y + 12); g.drawLine(x + 1, y + 13, x + 13, y + 13); g.drawLine(x + 13, y + 2, x + 13, y + 12); g.drawLine(x + 2, y + 12, x + 2, y + 12); g.drawLine(x + 12, y + 2, x + 12, y + 2); g.fillRect(x + 4, y + 4, 2, 2); g.fillRect(x + 5, y + 5, 4, 4); g.drawLine(x + 9, y + 4, x + 10, y + 4); g.drawLine(x + 9, y + 4, x + 9, y + 5); g.drawLine(x + 4, y + 9, x + 4, y + 10); g.drawLine(x + 4, y + 9, x + 5, y + 9); g.drawLine(x + 9, y + 8, x + 9, y + 10); g.drawLine(x + 8, y + 9, x + 10, y + 9); g.setColor(MetalLookAndFeel.getBlack()); g.drawLine(x, y, x + 13, y); g.drawLine(x, y + 1, x, y + 13); g.drawLine(x + 3, y + 4, x + 4, y + 3); g.drawLine(x + 3, y + 9, x + 5, y + 7); g.drawLine(x + 7, y + 5, x + 9, y + 3); g.drawLine(x + 12, y + 3, x + 12, y + 11); g.drawLine(x + 3, y + 12, x + 12, y + 12); g.setColor(MetalLookAndFeel.getWhite()); g.drawLine(x + 1, y + 14, x + 14, y + 14); g.drawLine(x + 14, y + 1, x + 14, y + 14); if (!b.getModel().isPressed()) { g.drawLine(x + 5, y + 10, x + 5, y + 10); g.drawLine(x + 6, y + 9, x + 7, y + 9); g.drawLine(x + 10, y + 5, x + 10, y + 5); g.drawLine(x + 9, y + 6, x + 9, y + 7); g.drawLine(x + 10, y + 10, x + 11, y + 10); g.drawLine(x + 10, y + 11, x + 10, y + 11); } g.setColor(savedColor); } } /** * The icon displayed at the top-left corner of a {@link JInternalFrame}. */ private static class InternalFrameDefaultMenuIcon implements Icon, Serializable { /** * Creates a new instance. */ public InternalFrameDefaultMenuIcon() { // 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) { g.setColor(new Color(102, 102, 153)); g.fillRect(x + 1, y, 14, 2); g.fillRect(x, y + 1, 2, 14); g.fillRect(x + 1, y + 14, 14, 2); g.fillRect(x + 14, y + 1, 2, 14); g.drawLine(x + 2, y + 5, x + 14, y + 5); g.setColor(new Color(204, 204, 255)); g.fillRect(x + 2, y + 2, 12, 3); g.setColor(new Color(102, 102, 153)); g.drawLine(x + 3, y + 3, x + 3, y + 3); g.drawLine(x + 6, y + 3, x + 6, y + 3); g.drawLine(x + 9, y + 3, x + 9, y + 3); g.drawLine(x + 12, y + 3, x + 12, y + 3); g.setColor(Color.white); g.fillRect(x + 2, y + 6, 12, 8); g.drawLine(x + 2, y + 2, x + 2, y + 2); g.drawLine(x + 5, y + 2, x + 5, y + 2); g.drawLine(x + 8, y + 2, x + 8, y + 2); g.drawLine(x + 11, y + 2, x + 11, y + 2); } } /** * An icon used in the title frame of a {@link JInternalFrame}. When you * maximise an internal frame, this icon will replace the 'maximise' icon to * provide a 'restore' option. */ private static class InternalFrameAltMaximizeIcon implements Icon, Serializable { /** The icon size in pixels. */ private int size; /** * Creates a new icon. * * @param size the icon size in pixels. */ public InternalFrameAltMaximizeIcon(int size) { this.size = size; } /** * Returns the width of the icon, in pixels. * * @return The width of the icon. */ public int getIconWidth() { return size; } /** * Returns the height of the icon, in pixels. * * @return The height of the icon. */ public int getIconHeight() { return size; } /** * 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 small box 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 + 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 + 5, x + 5, y + 5); g.drawLine(x + 1, y + 6, x + 1, y + 12); g.drawLine(x + 9, y + 9, x + 9, y + 12); g.drawLine(x + 1, y + 13, x + 9, y + 13); 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 + 11, y + 5, x + 12, y + 5); g.drawLine(x, y + 4, x + 5, y + 4); g.drawLine(x, y + 5, x, y + 13); g.drawLine(x + 3, y + 12, x + 8, y + 12); g.drawLine(x + 8, y + 8, x + 8, y + 11); g.drawLine(x + 9, y + 8, x + 9, y + 8); 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 + 6, y + 5, x + 6, y + 5); g.drawLine(x + 10, y + 8, x + 10, y + 13); g.drawLine(x + 1, y + 14, x + 10, y + 14); if (!b.getModel().isPressed()) { g.drawLine(x + 2, y + 6, x + 6, y + 6); g.drawLine(x + 2, y + 6, x + 2, y + 11); } g.setColor(savedColor); } } /** * An icon used for the 'maximize' button in the title frame of a * {@link JInternalFrame}. */ private static class InternalFrameMaximizeIcon implements Icon, Serializable {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -