This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 59753
Collapse All | Expand All

(-)core/swing/plaf/src/org/netbeans/swing/plaf/aqua/DropShadowBorder.java (-19 / +3 lines)
Lines 37-42 Link Here
37
import java.util.Map;
37
import java.util.Map;
38
import javax.swing.UIManager;
38
import javax.swing.UIManager;
39
import javax.swing.border.Border;
39
import javax.swing.border.Border;
40
import org.netbeans.swing.plaf.util.UIUtils;
40
41
41
/** A translucent drop shadow border class with settable colors and size.
42
/** A translucent drop shadow border class with settable colors and size.
42
 * Generally it's a goood idea to use a transparent color as the second
43
 * Generally it's a goood idea to use a transparent color as the second
Lines 92-98 Link Here
92
    
93
    
93
    private static final int GAP = ARC / 2;
94
    private static final int GAP = ARC / 2;
94
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
95
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
95
        setupAntialiasing (g);
96
        UIUtils.configureRenderingHints (g);
96
        
97
        
97
        Graphics2D g2d = (Graphics2D) g;
98
        Graphics2D g2d = (Graphics2D) g;
98
        Composite comp = g2d.getComposite();
99
        Composite comp = g2d.getComposite();
Lines 162-183 Link Here
162
            g2d.setComposite(comp);
163
            g2d.setComposite(comp);
163
            g2d.setPaint(paint);
164
            g2d.setPaint(paint);
164
        }
165
        }
165
    }
166
    }   
166
    
167
168
    private static Map hintsMap = null;
169
    private static Map getHints() {
170
        if (hintsMap == null) {
171
            hintsMap = new HashMap();
172
            hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING,
173
                         RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
174
            hintsMap.put(RenderingHints.KEY_ANTIALIASING,
175
                         RenderingHints.VALUE_ANTIALIAS_ON);
176
        }
177
        return hintsMap;
178
    }
179
180
    public static final void setupAntialiasing(Graphics g) {
181
        ((Graphics2D) g).addRenderingHints(getHints());
182
    }    
183
}
167
}
(-)core/swing/plaf/src/org/netbeans/swing/plaf/util/UIUtils.java (-1 / +5 lines)
Lines 61-66 Link Here
61
61
62
     public static final Map getHints() {
62
     public static final Map getHints() {
63
        //XXX should do this in update() in the UI instead
63
        //XXX should do this in update() in the UI instead
64
        //Note for this method we do NOT want only text antialiasing - we 
65
        //want antialiased curves.
64
        if (hintsMap == null) {
66
        if (hintsMap == null) {
65
            hintsMap = new HashMap();
67
            hintsMap = new HashMap();
66
            hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
68
            hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Lines 71-77 Link Here
71
    
73
    
72
    public static final void configureRenderingHints (Graphics g) {
74
    public static final void configureRenderingHints (Graphics g) {
73
        if (noAntialias) return;
75
        if (noAntialias) return;
74
        ((Graphics2D)g).addRenderingHints(getHints());
76
        Graphics2D g2d = (Graphics2D) g;
77
        
78
        g2d.addRenderingHints(getHints());
75
    }
79
    }
76
80
77
    public static Image loadImage (String s) {
81
    public static Image loadImage (String s) {
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/AbstractViewTabDisplayerUI.java (-1 / +1 lines)
Lines 130-136 Link Here
130
130
131
    public void paint(Graphics g, JComponent c) {
131
    public void paint(Graphics g, JComponent c) {
132
        if (ColorUtil.shouldAntialias()) {
132
        if (ColorUtil.shouldAntialias()) {
133
            ColorUtil.setupAntialiasing(g);
133
            ColorUtil.setupAntialiasing(g, false);
134
        }        
134
        }        
135
        TabData tabData;
135
        TabData tabData;
136
        int x, y, width, height;
136
        int x, y, width, height;
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/AquaViewTabDisplayerUI.java (-1 / +1 lines)
Lines 82-88 Link Here
82
    }
82
    }
83
83
84
    public void paint(Graphics g, JComponent c) {
84
    public void paint(Graphics g, JComponent c) {
85
        ColorUtil.setupAntialiasing(g);
85
        ColorUtil.setupAntialiasing(g, false);
86
        super.paint(g, c);
86
        super.paint(g, c);
87
        paintBottomBorder(g, c);
87
        paintBottomBorder(g, c);
88
    }
88
    }
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicTabDisplayerUI.java (-1 / +1 lines)
Lines 331-337 Link Here
331
        assert c == displayer;
331
        assert c == displayer;
332
        
332
        
333
        if (isAntialiased()) {
333
        if (isAntialiased()) {
334
            ColorUtil.setupAntialiasing(g);
334
            ColorUtil.setupAntialiasing(g, false);
335
        }
335
        }
336
        
336
        
337
        boolean showClose = displayer.isShowCloseButton();
337
        boolean showClose = displayer.isShowCloseButton();
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/ChicletWrapper.java (-1 / +1 lines)
Lines 127-133 Link Here
127
        chiclet.setState (state);
127
        chiclet.setState (state);
128
        Graphics g = img.getGraphics();
128
        Graphics g = img.getGraphics();
129
        g.translate (-bounds.x, -bounds.y);
129
        g.translate (-bounds.x, -bounds.y);
130
        ColorUtil.setupAntialiasing(g);
130
        ColorUtil.setupAntialiasing(g, true);
131
        chiclet.draw((Graphics2D)g);
131
        chiclet.draw((Graphics2D)g);
132
        g.translate (bounds.x, bounds.y);
132
        g.translate (bounds.x, bounds.y);
133
        return img;
133
        return img;
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/ColorUtil.java (-9 / +16 lines)
Lines 29-35 Link Here
29
 */
29
 */
30
final class ColorUtil {
30
final class ColorUtil {
31
    private static Map gpCache = null;
31
    private static Map gpCache = null;
32
    private static HashMap hintsMap = null;
32
    private static Map hintsMap = null;
33
    private static final boolean noGpCache = Boolean.getBoolean(
33
    private static final boolean noGpCache = Boolean.getBoolean(
34
            "netbeans.winsys.nogpcache");  //NOI18N
34
            "netbeans.winsys.nogpcache");  //NOI18N
35
    private static final boolean noAntialias = 
35
    private static final boolean noAntialias = 
Lines 159-178 Link Here
159
        return result;
159
        return result;
160
    }
160
    }
161
161
162
    private static Map getHints() {
162
    static final Map getHints() {
163
        //XXX We REALLY need to put this in a graphics utils lib
163
        if (hintsMap == null) {
164
        if (hintsMap == null) {
164
            hintsMap = new HashMap();
165
            //Thanks to Phil Race for making this possible
165
            hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING,
166
            hintsMap = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
166
                         RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
167
            if (hintsMap == null) {
167
            hintsMap.put(RenderingHints.KEY_ANTIALIASING,
168
                hintsMap = new HashMap();
168
                         RenderingHints.VALUE_ANTIALIAS_ON);
169
                hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
170
            }
169
        }
171
        }
170
        return hintsMap;
172
        return hintsMap;
171
    }
173
    }
172
174
173
    public static final void setupAntialiasing(Graphics g) {
175
    public static final void setupAntialiasing(Graphics g, boolean lines) {
174
        if (noAntialias) return;
176
        if (noAntialias) return;
175
        ((Graphics2D) g).addRenderingHints(getHints());
177
        Graphics2D g2d = (Graphics2D) g;
178
        g2d.addRenderingHints(getHints());
179
        if (lines) {
180
            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
181
                         RenderingHints.VALUE_ANTIALIAS_ON);
182
        }
176
    }
183
    }
177
    
184
    
178
    private static final boolean antialias = Boolean.getBoolean(
185
    private static final boolean antialias = Boolean.getBoolean(
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/GtkSlidingButtonUI.java (-1 / +1 lines)
Lines 81-87 Link Here
81
    
81
    
82
    public void paint(Graphics g, JComponent c) {
82
    public void paint(Graphics g, JComponent c) {
83
        if (ColorUtil.shouldAntialias()) {
83
        if (ColorUtil.shouldAntialias()) {
84
            ColorUtil.setupAntialiasing(g);
84
            ColorUtil.setupAntialiasing(g, false);
85
        }
85
        }
86
        
86
        
87
        AbstractButton button = (AbstractButton)c;
87
        AbstractButton button = (AbstractButton)c;
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/MetalSlidingButtonUI.java (-1 / +1 lines)
Lines 81-87 Link Here
81
    
81
    
82
    public void paint(Graphics g, JComponent c) {
82
    public void paint(Graphics g, JComponent c) {
83
        if (ColorUtil.shouldAntialias()) {
83
        if (ColorUtil.shouldAntialias()) {
84
            ColorUtil.setupAntialiasing(g);
84
            ColorUtil.setupAntialiasing(g, false);
85
        }
85
        }
86
        AbstractButton button = (AbstractButton)c;
86
        AbstractButton button = (AbstractButton)c;
87
        hiddenToggle.setBorderPainted(true);
87
        hiddenToggle.setBorderPainted(true);
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/WinClassicViewTabDisplayerUI.java (-1 / +1 lines)
Lines 94-100 Link Here
94
     */
94
     */
95
    public void paint(Graphics g, JComponent c) {
95
    public void paint(Graphics g, JComponent c) {
96
        if (ColorUtil.shouldAntialias()) {
96
        if (ColorUtil.shouldAntialias()) {
97
            ColorUtil.setupAntialiasing(g);
97
            ColorUtil.setupAntialiasing(g, false);
98
        }
98
        }
99
        Color col = c.getBackground();
99
        Color col = c.getBackground();
100
        if (col != null) {
100
        if (col != null) {
(-)core/swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/WinXPSlidingButtonUI.java (-1 / +1 lines)
Lines 91-97 Link Here
91
    
91
    
92
    public void paint(Graphics g, JComponent c) {
92
    public void paint(Graphics g, JComponent c) {
93
        if (ColorUtil.shouldAntialias()) {
93
        if (ColorUtil.shouldAntialias()) {
94
            ColorUtil.setupAntialiasing(g);
94
            ColorUtil.setupAntialiasing(g, false);
95
        }
95
        }
96
        AbstractButton button = (AbstractButton)c;
96
        AbstractButton button = (AbstractButton)c;
97
        hiddenToggle.setBorderPainted(button.isBorderPainted());
97
        hiddenToggle.setBorderPainted(button.isBorderPainted());
(-)editor/libsrc/org/netbeans/editor/EditorUI.java (-1 / +30 lines)
Lines 517-523 Link Here
517
                }
517
                }
518
518
519
                if (settingName == null || SettingsNames.RENDERING_HINTS.equals(settingName)) {
519
                if (settingName == null || SettingsNames.RENDERING_HINTS.equals(settingName)) {
520
                    Object value = Settings.getValue(kitClass, SettingsNames.RENDERING_HINTS);
520
                    //JDK 1.6 post b47 delivers subpixel antialiasing settings this way
521
                    Object value = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
522
523
                    //is this ever really not a Map?
524
                    Object userSetHints = Settings.getValue(kitClass, SettingsNames.RENDERING_HINTS);
525
                    
526
                    if (value == null) {
527
                        if (userSetHints instanceof Map) {
528
                            value = userSetHints;
529
                        }
530
                    } else {
531
                        if (userSetHints instanceof Map) {
532
                            Map uhints = (Map) userSetHints;
533
                            Map pdefaults = (Map) value;
534
                            //In the event of a disagreement, that means the checkbox state
535
                            //wins
536
                            if (uhints.get(RenderingHints.KEY_TEXT_ANTIALIASING) != RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT) {
537
                                //We don't need to know JDK 1.6 values to do a negative test:
538
                                boolean defaultAntialiased = pdefaults.get(RenderingHints.KEY_TEXT_ANTIALIASING) != null &&
539
                                        pdefaults.get(RenderingHints.KEY_TEXT_ANTIALIASING) != RenderingHints.VALUE_ANTIALIAS_OFF;
540
                                boolean settingAntialiased = uhints.get(RenderingHints.KEY_TEXT_ANTIALIASING) != null &&
541
                                        uhints.get(RenderingHints.KEY_TEXT_ANTIALIASING) != RenderingHints.VALUE_ANTIALIAS_OFF;
542
                                //In the event of a disagreement, the saved settings win
543
                                if (defaultAntialiased != settingAntialiased) {
544
                                    value = uhints;
545
                                }
546
                            }
547
                        }
548
                    }
549
521
                    renderingHints = (value instanceof Map) ? (Map)value : null;
550
                    renderingHints = (value instanceof Map) ? (Map)value : null;
522
                }
551
                }
523
                
552
                
(-)editor/libsrc/org/netbeans/editor/FoldingToolTip.java (-2 / +8 lines)
Lines 17-23 Link Here
17
import java.awt.Dimension;
17
import java.awt.Dimension;
18
import java.awt.Graphics;
18
import java.awt.Graphics;
19
import java.awt.Rectangle;
19
import java.awt.Rectangle;
20
import java.awt.Shape;
20
import java.awt.Toolkit;
21
import java.util.Map;
21
import java.util.Map;
22
import javax.swing.JPanel;
22
import javax.swing.JPanel;
23
import javax.swing.border.LineBorder;
23
import javax.swing.border.LineBorder;
Lines 72-78 Link Here
72
    private void updateRenderingHints(Graphics g){
72
    private void updateRenderingHints(Graphics g){
73
        JTextComponent comp = editorUI.getComponent();
73
        JTextComponent comp = editorUI.getComponent();
74
        if (comp == null) return;
74
        if (comp == null) return;
75
        Object value = Settings.getValue(Utilities.getKitClass(comp), SettingsNames.RENDERING_HINTS);
75
        Object value = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
76
        //Don't bother seeing if the hints are explicitly turned off (if they
77
        //even can be) as in EditorUI - it's a tooltip, desktop default is
78
        //fine
79
        if (value == null) {
80
            value = Settings.getValue(Utilities.getKitClass(comp), SettingsNames.RENDERING_HINTS);
81
        }
76
        Map renderingHints = (value instanceof Map) ? (java.util.Map)value : null;
82
        Map renderingHints = (value instanceof Map) ? (java.util.Map)value : null;
77
83
78
        // Possibly apply the rendering hints
84
        // Possibly apply the rendering hints
(-)editor/libsrc/org/netbeans/editor/GlyphGutter.java (-1 / +9 lines)
Lines 167-173 Link Here
167
    private void updateRenderingHints(){
167
    private void updateRenderingHints(){
168
        JTextComponent comp = editorUI.getComponent();
168
        JTextComponent comp = editorUI.getComponent();
169
        if (comp == null) return;
169
        if (comp == null) return;
170
        Object value = Settings.getValue(Utilities.getKitClass(comp), SettingsNames.RENDERING_HINTS);
170
        Object value = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty(
171
                "awt.font.desktophints")); //NOI18N
172
        //Don't bother seeing if the hints are explicitly turned off (if they
173
        //even can be) as in EditorUI - it's a tooltip, desktop default is
174
        //fine
175
        if (value == null) {
176
            value = Settings.getValue(Utilities.getKitClass(comp), 
177
                    SettingsNames.RENDERING_HINTS);
178
        }        
171
        renderingHints = (value instanceof Map) ? (java.util.Map)value : null;
179
        renderingHints = (value instanceof Map) ? (java.util.Map)value : null;
172
    }
180
    }
173
    
181
    
(-)editor/src/org/netbeans/modules/editor/options/BaseOptions.java (-8 / +9 lines)
Lines 180-194 Link Here
180
    private static final boolean debugFormat
180
    private static final boolean debugFormat
181
    = Boolean.getBoolean("netbeans.debug.editor.format"); // NOI18N
181
    = Boolean.getBoolean("netbeans.debug.editor.format"); // NOI18N
182
    
182
    
183
    private static final Map textAntialiasingHintsMap = new HashMap();
183
    private static final Map textAntialiasingHintsMap;
184
    static {
184
    static {
185
        // Commented due to issue 59273
185
        Map defaultHints = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty(
186
        // textAntialiasingHintsMap.put(RenderingHints.KEY_ANTIALIASING,
186
                "awt.font.desktophints")); //NOI18N        
187
        //     RenderingHints.VALUE_ANTIALIAS_ON);
187
        textAntialiasingHintsMap = defaultHints == null ? (Map) new HashMap() : 
188
        textAntialiasingHintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING,
188
            defaultHints;
189
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
189
        if (defaultHints == null) {
190
        // textAntialiasingHintsMap.put(RenderingHints.KEY_FRACTIONALMETRICS,
190
            textAntialiasingHintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING,
191
        //     RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
191
                RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
192
        }
192
    }
193
    }
193
194
194
    
195
    
(-)objectbrowser/navigator/src/org/netbeans/modules/navigator/strings/WeightedStringPainterImpl.java (-8 / +7 lines)
Lines 61-72 Link Here
61
            //Fudge the spacing for bold fonts - chars are wider
61
            //Fudge the spacing for bold fonts - chars are wider
62
            maxChars = Math.max ( 2, maxChars - ( maxChars / 3 ) );
62
            maxChars = Math.max ( 2, maxChars - ( maxChars / 3 ) );
63
        }
63
        }
64
        // antialiase if swing.aatext is enabled
64
        // antialias if swing.aatext is enabled
65
        Object oldAAValue = null;
65
        Object oldAAValue = null;
66
        if (Boolean.getBoolean("swing.aatext")) {
66
        
67
            Graphics2D g2 = (Graphics2D)g;
67
        Map rhints = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
68
        Graphics2D g2 = (Graphics2D)g;
69
        if (rhints == null && Boolean.getBoolean("swing.aatext")) {
68
            oldAAValue = g2.getRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING);
70
            oldAAValue = g2.getRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING);
69
            g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
71
            g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
72
        } else if (rhints != null) {
73
            g2.addRenderingHints(rhints);
70
        }
74
        }
71
        
75
        
72
        char[] seg = first ( ws );
76
        char[] seg = first ( ws );
Lines 94-104 Link Here
94
            x += dist;
98
            x += dist;
95
            seg = next ( ws );
99
            seg = next ( ws );
96
        }
100
        }
97
        // restore previous aa setting
98
        if (oldAAValue != null) {
99
            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, oldAAValue);
100
        }
101
102
    }
101
    }
103
102
104
    private void setupGraphics (Graphics g, int type, Font defFont, Color defFg, boolean useColors) {
103
    private void setupGraphics (Graphics g, int type, Font defFont, Color defFg, boolean useColors) {
(-)openide/awt/src/org/openide/awt/HtmlLabelUI.java (-3 / +7 lines)
Lines 160-170 Link Here
160
    }
160
    }
161
161
162
    static final Map getHints() {
162
    static final Map getHints() {
163
        //XXX We REALLY need to put this in a graphics utils lib
163
        if (hintsMap == null) {
164
        if (hintsMap == null) {
164
            hintsMap = new HashMap();
165
            //Thanks to Phil Race for making this possible
165
            hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
166
            hintsMap = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
167
            if (hintsMap == null) {
168
                hintsMap = new HashMap();
169
                hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
170
            }
166
        }
171
        }
167
168
        return hintsMap;
172
        return hintsMap;
169
    }
173
    }
170
174
(-)openide/loaders/src/org/openide/awt/Toolbar.java (-5 / +9 lines)
Lines 1073-1084 Link Here
1073
        }
1073
        }
1074
    }    
1074
    }    
1075
1075
1076
    private static java.util.HashMap hintsMap = null;
1076
    private static java.util.Map hintsMap = null;
1077
    static final java.util.Map getHints() {
1077
    static final Map getHints() {
1078
        //XXX We REALLY need to put this in a graphics utils lib
1078
        if (hintsMap == null) {
1079
        if (hintsMap == null) {
1079
            hintsMap = new java.util.HashMap();
1080
            //Thanks to Phil Race for making this possible
1080
            hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
1081
            hintsMap = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
1081
            hintsMap.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
1082
            if (hintsMap == null) {
1083
                hintsMap = new HashMap();
1084
                hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
1085
            }
1082
        }
1086
        }
1083
        return hintsMap;
1087
        return hintsMap;
1084
    }
1088
    }

Return to bug 59753