📄 metaliconfactory.java
字号:
* @param y the y coordinate. */ public void paintMe(Component c, Graphics g, int x, int y) { paintIcon(c, g, x, y); } } /** * A tree folder icon. */ public static class TreeFolderIcon extends FolderIcon16 { /** * Creates a new instance. */ public TreeFolderIcon() { // Nothing to do here. } /** * Returns the additional height for this icon, in this case <code>2</code> * pixels. * * @return <code>2</code>. */ public int getAdditionalHeight() { return 2; } /** * Returns the shift (???). * * @return The shift. */ public int getShift() { return -1; } } /** * A tree leaf icon. */ public static class TreeLeafIcon extends FileIcon16 { /** * Creates a new instance. */ public TreeLeafIcon() { // Nothing to do here. } /** * Returns the additional height for this icon, in this case <code>4</code> * pixels. * * @return <code>4</code>. */ public int getAdditionalHeight() { return 4; } /** * Returns the shift (???). * * @return The shift. */ public int getShift() { return 2; } } /** * An icon representing a hard disk. * * @see MetalIconFactory#getTreeHardDriveIcon() */ private static class TreeHardDriveIcon implements Icon, Serializable { /** * Creates a new icon instance. */ public TreeHardDriveIcon() { // Nothing to do here. } /** * Returns the width of the icon, in pixels. * * @return <code>16</code>. */ public int getIconWidth() { return 16; } /** * Returns the height of the icon, in pixels. * * @return <code>16</code>. */ public int getIconHeight() { return 16; } /** * Paints the icon at the specified location, using colors from the * current theme. * * @param c the component (ignored). * @param g the graphics device. * @param x the x-coordinate for the top-left of the icon. * @param y the y-coordinate for the top-left of the icon. */ public void paintIcon(Component c, Graphics g, int x, int y) { Color saved = g.getColor(); g.setColor(MetalLookAndFeel.getBlack()); g.drawLine(x + 1, y + 4, x + 1, y + 5); g.drawLine(x + 14, y + 4, x + 14, y + 5); g.drawLine(x + 1, y + 7, x + 1, y + 8); g.drawLine(x + 14, y + 7, x + 14, y + 8); g.drawLine(x + 1, y + 10, x + 1, y + 11); g.drawLine(x + 14, y + 10, x + 14, y + 11); g.drawLine(x + 2, y + 3, x + 3, y + 3); g.drawLine(x + 12, y + 3, x + 13, y + 3); g.drawLine(x + 2, y + 6, x + 3, y + 6); g.drawLine(x + 12, y + 6, x + 13, y + 6); g.drawLine(x + 2, y + 9, x + 3, y + 9); g.drawLine(x + 12, y + 9, x + 13, y + 9); g.drawLine(x + 2, y + 12, x + 3, y + 12); g.drawLine(x + 12, y + 12, x + 13, y + 12); g.drawLine(x + 4, y + 2, x + 11, y + 2); g.drawLine(x + 4, y + 7, x + 11, y + 7); g.drawLine(x + 4, y + 10, x + 11, y + 10); g.drawLine(x + 4, y + 13, x + 11, y + 13); g.setColor(MetalLookAndFeel.getWhite()); g.fillRect(x + 4, y + 3, 2, 2); g.drawLine(x + 6, y + 4, x + 6, y + 4); g.drawLine(x + 7, y + 3, x + 9, y + 3); g.drawLine(x + 8, y + 4, x + 8, y + 4); g.drawLine(x + 11, y + 3, x + 11, y + 3); g.fillRect(x + 2, y + 4, 2, 2); g.fillRect(x + 2, y + 7, 2, 2); g.fillRect(x + 2, y + 10, 2, 2); g.drawLine(x + 4, y + 6, x + 4, y + 6); g.drawLine(x + 4, y + 9, x + 4, y + 9); g.drawLine(x + 4, y + 12, x + 4, y + 12); g.setColor(MetalLookAndFeel.getControlShadow()); g.drawLine(x + 13, y + 4, x + 13, y + 4); g.drawLine(x + 12, y + 5, x + 13, y + 5); g.drawLine(x + 13, y + 7, x + 13, y + 7); g.drawLine(x + 12, y + 8, x + 13, y + 8); g.drawLine(x + 13, y + 10, x + 13, y + 10); g.drawLine(x + 12, y + 11, x + 13, y + 11); g.drawLine(x + 10, y + 5, x + 10, y + 5); g.drawLine(x + 7, y + 6, x + 7, y + 6); g.drawLine(x + 9, y + 6, x + 9, y + 6); g.drawLine(x + 11, y + 6, x + 11, y + 6); g.drawLine(x + 10, y + 8, x + 10, y + 8); g.drawLine(x + 7, y + 9, x + 7, y + 9); g.drawLine(x + 9, y + 9, x + 9, y + 9); g.drawLine(x + 11, y + 9, x + 11, y + 9); g.drawLine(x + 10, y + 11, x + 10, y + 11); g.drawLine(x + 7, y + 12, x + 7, y + 12); g.drawLine(x + 9, y + 12, x + 9, y + 12); g.drawLine(x + 11, y + 12, x + 11, y + 12); g.setColor(saved); } } /** * An icon representing a floppy disk. * * @see MetalIconFactory#getTreeFloppyDriveIcon() */ private static class TreeFloppyDriveIcon implements Icon, Serializable { /** * Creates a new icon instance. */ public TreeFloppyDriveIcon() { // Nothing to do here. } /** * Returns the width of the icon, in pixels. * * @return <code>16</code>. */ public int getIconWidth() { return 16; } /** * Returns the height of the icon, in pixels. * * @return <code>16</code>. */ public int getIconHeight() { return 16; } /** * Paints the icon at the specified location, using colors from the * current theme. * * @param c the component (ignored). * @param g the graphics device. * @param x the x-coordinate for the top-left of the icon. * @param y the y-coordinate for the top-left of the icon. */ public void paintIcon(Component c, Graphics g, int x, int y) { Color saved = g.getColor(); g.setColor(MetalLookAndFeel.getBlack()); g.drawLine(x + 1, y + 1, x + 13, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + 14); g.drawLine(x + 1, y + 14, x + 14, y + 14); g.drawLine(x + 14, y + 2, x + 14, y + 14); g.setColor(MetalLookAndFeel.getPrimaryControl()); g.fillRect(x + 2, y + 2, 12, 12); g.setColor(MetalLookAndFeel.getControlShadow()); g.fillRect(x + 5, y + 2, 6, 5); g.drawLine(x + 4, y + 8, x + 11, y + 8); g.drawLine(x + 3, y + 9, x + 3, y + 13); g.drawLine(x + 12, y + 9, x + 12, y + 13); g.setColor(MetalLookAndFeel.getWhite()); g.fillRect(x + 8, y + 3, 2, 3); g.fillRect(x + 4, y + 9, 8, 5); g.setColor(MetalLookAndFeel.getPrimaryControlShadow()); g.drawLine(x + 5, y + 10, x + 9, y + 10); g.drawLine(x + 5, y + 12, x + 8, y + 12); g.setColor(saved); } } /** * An icon representing a computer. * * @see MetalIconFactory#getTreeComputerIcon() */ private static class TreeComputerIcon implements Icon, Serializable { /** * Creates a new icon instance. */ public TreeComputerIcon() { // Nothing to do here. } /** * Returns the width of the icon, in pixels. * * @return <code>16</code>. */ public int getIconWidth() { return 16; } /** * Returns the height of the icon, in pixels. * * @return <code>16</code>. */ public int getIconHeight() { return 16; } /** * Paints the icon at the specified location, using colors from the * current theme. * * @param c the component (ignored). * @param g the graphics device. * @param x the x-coordinate for the top-left of the icon. * @param y the y-coordinate for the top-left of the icon. */ public void paintIcon(Component c, Graphics g, int x, int y) { Color saved = g.getColor(); g.setColor(MetalLookAndFeel.getBlack()); g.drawLine(x + 3, y + 1, x + 12, y + 1); g.drawLine(x + 2, y + 2, x + 2, y + 8); g.drawLine(x + 13, y + 2, x + 13, y + 8); g.drawLine(x + 3, y + 9, x + 3, y + 9); g.drawLine(x + 12, y + 9, x + 12, y + 9); g.drawRect(x + 1, y + 10, 13, 4); g.drawLine(x + 5, y + 3, x + 10, y + 3); g.drawLine(x + 5, y + 8, x + 10, y + 8); g.drawLine(x + 4, y + 4, x + 4, y + 7); g.drawLine(x + 11, y + 4, x + 11, y + 7); g.setColor(MetalLookAndFeel.getPrimaryControl()); g.fillRect(x + 5, y + 4, 6, 4); g.setColor(MetalLookAndFeel.getControlShadow()); g.drawLine(x + 6, y + 12, x + 8, y + 12); g.drawLine(x + 10, y + 12, x + 12, y + 12); g.setColor(saved); } } /** The icon returned by {@link #getCheckBoxIcon()}. */ private static Icon checkBoxIcon; /** The icon returned by {@link #getCheckBoxMenuItemIcon()}. */ private static Icon checkBoxMenuItemIcon; /** The icon returned by {@link #getFileChooserDetailViewIcon()}. */ private static Icon fileChooserDetailViewIcon; /** The icon returned by {@link #getFileChooserHomeFolderIcon()}. */ private static Icon fileChooserHomeFolderIcon; /** The icon returned by {@link #getFileChooserListViewIcon()}. */ private static Icon fileChooserListViewIcon; /** The icon returned by {@link #getFileChooserNewFolderIcon()}. */ private static Icon fileChooserNewFolderIcon; /** The icon returned by {@link #getFileChooserUpFolderIcon()}. */ private static Icon fileChooserUpFolderIcon; /** The cached RadioButtonIcon instance. */ private static RadioButtonIcon radioButtonIcon; /** The icon returned by {@link #getRadioButtonMenuItemIcon()}. */ private static Icon radioButtonMenuItemIcon; /** The icon returned by {@link #getInternalFrameDefaultMenuIcon()}. */ private static Icon internalFrameDefaultMenuIcon; /** The icon returned by {@link #getTreeComputerIcon()}. */ private static Icon treeComputerIcon; /** The icon instance returned by {@link #getTreeFloppyDriveIcon()}. */ private static Icon treeFloppyDriveIcon; /** The icon instance returned by {@link #getTreeHardDriveIcon()}. */ private static Icon treeHardDriveIcon; /** * Creates a new instance. All the methods are static, so creating an * instance isn't necessary. */ public MetalIconFactory() { // Nothing to do here. } /** * Returns an icon for use when rendering the {@link JCheckBox} component. * * @return A check box icon. * * @since 1.3 */ public static Icon getCheckBoxIcon() { if (checkBoxIcon == null) checkBoxIcon = new MetalCheckBoxIcon(); return checkBoxIcon; } /** * Returns an icon for use when rendering the {@link JCheckBoxMenuItem} * component. * * @return An icon. */ public static Icon getCheckBoxMenuItemIcon() { if (checkBoxMenuItemIcon == null) checkBoxMenuItemIcon = new CheckBoxMenuItemIcon(); return checkBoxMenuItemIcon; } /** * Returns an icon for use by the {@link JFileChooser} component. * * @return An icon. */ public static Icon getFileChooserDetailViewIcon() { if (fileChooserDetailViewIcon == null) fileChooserDetailViewIcon = new FileChooserDetailViewIcon(); return fileChooserDetailViewIcon; } /** * Returns an icon for use by the {@link JFileChooser} component. * * @return An icon. */ public static Icon getFileChooserHomeFolderIcon() { if (fileChooserHomeFolderIcon == null) fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon(); return fileChooserHomeFolderIcon; } /** * Returns an icon for use by the {@link JFileChooser} component. * * @return An icon. */ public static Icon getFileChooserListViewIcon() { if (fileChooserListViewIcon == null) fileChooserListViewIcon = new FileChooserListViewIcon(); return fileChooserListViewIcon; } /** * Returns an icon for use by the {@link JFileChooser} component. * * @return An icon. */ publi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -