underline text in java without using html tags
807598Feb 19 2006 — edited Feb 19 2006can you plz tell me that how to underline text in java without using html tags,
sample code i tried but it is not working, Plz help
JFrame f = new JFrame("Underline Frame");
JLabel b = new JLabel("The font that doesnt get underlined");
Map m = b.getFont().getAttributes(); //Note I dont need to define which
System.out.println(m);
m.put( TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
m.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
m.put(TextAttribute.SIZE, new Float(20));
b.setFont(b.getFont().deriveFont(m));
System.out.println(b.getFont().getAttributes());
f.getContentPane().add(b);
f.pack();
f.setVisible(true);