.. | .. |
---|
60 | 60 | return new cCheckBox(icon, border); |
---|
61 | 61 | } |
---|
62 | 62 | |
---|
63 | | - private ImageIcon GetIcon(String name) |
---|
| 63 | + ImageIcon GetIcon(String name) |
---|
64 | 64 | { |
---|
65 | 65 | try |
---|
66 | 66 | { |
---|
67 | 67 | BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
68 | 68 | |
---|
69 | | -// if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
70 | | -// { |
---|
71 | | -// BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
72 | | -// Graphics2D g = resized.createGraphics(); |
---|
73 | | -// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
74 | | -// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
75 | | -// g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
76 | | -// g.dispose(); |
---|
77 | | -// |
---|
78 | | -// image = resized; |
---|
79 | | -// } |
---|
| 69 | + if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 70 | + { |
---|
| 71 | + BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 72 | + Graphics2D g = resized.createGraphics(); |
---|
| 73 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 74 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 75 | + g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 76 | + g.dispose(); |
---|
| 77 | + |
---|
| 78 | + image = resized; |
---|
| 79 | + } |
---|
80 | 80 | |
---|
81 | 81 | javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
82 | 82 | return icon; |
---|