-
Bug
-
Resolution: Fixed
-
P5
-
1.2.2
-
b81
-
x86
-
windows_nt
Name: skT45625 Date: 05/01/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
Here is an example from "Java 2D Graphics" (p.138) by Jonathan Knudsen. The
underline is at the baseline location, which is too close to the characters.
import java.awt.*;
import java.awt.font.TextAttribute;
import java.text.*;
public class IteratorUnderStrike {
public static void main(String[] args) {
JFrame f = new JFrame("IteratorUnderStrike v1.0") {
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
String s = "\"Click here,\" she said purred.";
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
Font plainFont = new Font("Times New Roman", Font.PLAIN, 24);
AttributedString as = new AttributedString(s);
as.addAttribute(TextAttribute.FONT, plainFont);
as.addAttribute(TextAttribute.UNDERLINE,
TextAttribute.UNDERLINE_ON, 1, 11);
as.addAttribute(TextAttribute.STRIKETHROUGH,
TextAttribute.STRIKETHROUGH_ON, 18, 22);
g2.drawString(as.getIterator(), 24, 70);
}
};
f.setVisible(true);
}
}
(Review ID: 103216)
======================================================================
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
Here is an example from "Java 2D Graphics" (p.138) by Jonathan Knudsen. The
underline is at the baseline location, which is too close to the characters.
import java.awt.*;
import java.awt.font.TextAttribute;
import java.text.*;
public class IteratorUnderStrike {
public static void main(String[] args) {
JFrame f = new JFrame("IteratorUnderStrike v1.0") {
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
String s = "\"Click here,\" she said purred.";
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
Font plainFont = new Font("Times New Roman", Font.PLAIN, 24);
AttributedString as = new AttributedString(s);
as.addAttribute(TextAttribute.FONT, plainFont);
as.addAttribute(TextAttribute.UNDERLINE,
TextAttribute.UNDERLINE_ON, 1, 11);
as.addAttribute(TextAttribute.STRIKETHROUGH,
TextAttribute.STRIKETHROUGH_ON, 18, 22);
g2.drawString(as.getIterator(), 24, 70);
}
};
f.setVisible(true);
}
}
(Review ID: 103216)
======================================================================