-
Bug
-
Resolution: Fixed
-
P4
-
2.0, 1.2.0, 1.3.0
-
b33
-
generic, x86
-
generic, windows_95
Name: krT82822 Date: 12/04/99
original user summary:
Map map = getFont().getAttributes();
map.put(TextAttribute.SIZE, new Float(19.0));
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
Font newFont = new Font(map);
setFont(newFont);
This code is from the mouseEntered method of a class that extends JLabel. The
effect of applying this new Font() is that the size is reflected, however, the
underline is NOT.
----------------------------
12/4/99 eval1127@eng -- filed against 1.2.x, but behavior the same under kestrel RA (1.3.0 build "I").
import java.awt.*;
import java.awt.font.*;
import java.util.*;
import javax.swing.*;
class MyLabel extends JLabel {
public MyLabel(String text) {
super(text);
Map map = (new Font("Arial", Font.PLAIN, 48)).getAttributes();
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_TWO_PIXEL);
Font newFont = new Font(map);
setFont(newFont);
setForeground(Color.blue);
}
}
public class Blah extends JFrame {
public Blah() {
super("califragilistic...");
MyLabel lbl = new MyLabel("how does this look");
setContentPane(lbl);
pack();
}
public static void main(String[] args) {
Blah f = new Blah();
f.setLocation(300,300);
f.setVisible(true);
}
}
(Review ID: 98544)
======================================================================
- duplicates
-
JDK-6184609 java.awt.Font.getFont(Map) is silent about null Map
-
- Closed
-
-
JDK-4191618 Setting Font.WIDTH text attribute has no affect.
-
- Closed
-
- relates to
-
JDK-6197072 JCK: Font(Map)/getFont(Map): unexpected exception for attributes of no proper type
-
- Closed
-
-
JDK-6185120 Font(Map)/getFont(Map) do not allow null values of TextAttributes
-
- Closed
-