13 private static boolean lookAndFeelSet;
15 public static void setAntialiased(Graphics g,
boolean antialiased) {
16 Graphics2D g2d = (Graphics2D)g;
18 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
20 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
23 public static void setAntialiasedText(Graphics g,
boolean antialiasedText) {
24 Graphics2D g2d = (Graphics2D)g;
26 g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
28 g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
31 public static int getStringWidth(String s, FontMetrics fontMetrics, Graphics g) {
32 java.awt.geom.Rectangle2D r = fontMetrics.getStringBounds(s, g);
33 return (
int)r.getWidth();
36 public static void setBilinearInterpolation(Graphics g,
boolean bilinearInterpolation) {
37 Graphics2D g2d = (Graphics2D)g;
39 g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
41 g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
50 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
52 String s = System.getProperty(
"java.version");
53 int dot_ver = Integer.parseInt(s.substring(s.lastIndexOf(
'.')+1, s.length()));
55 UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
57 UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.motif.MotifLookAndFeel");
61 lookAndFeelSet =
true;