Font italic and bold?

How can i customize a Font to display it italic and bold?regards
[78 byte] By [Oleka] at [2007-11-27 5:24:45]
# 1
new Font("Dialog", Font.BOLD | Font.ITALIC, 12);
bsampieria at 2007-7-12 14:44:19 > top of Java-index,Desktop,Core GUI APIs...
# 2
i have tryed this ... and Font.Italic & Font.Bold but it won't work.
Oleka at 2007-7-12 14:44:19 > top of Java-index,Desktop,Core GUI APIs...
# 3

> i have tryed this ... and Font.Italic & Font.Bold but it won't work.

If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.

camickra at 2007-7-12 14:44:19 > top of Java-index,Desktop,Core GUI APIs...
# 4
it would be Font.ITALIC | Font.BOLD, not &, for sure. Are you applying the font object you create to anything (component.setFont(), graphics.setFont())? Just creating a font doesn't do anything, you know...
bsampieria at 2007-7-12 14:44:19 > top of Java-index,Desktop,Core GUI APIs...
# 5
@bsampieri : ;-) sure i call setFont() ... but can you explain why the | operator is to use and not the & operator?
Oleka at 2007-7-12 14:44:19 > top of Java-index,Desktop,Core GUI APIs...
# 6
because:1 & 2 == 0(00000001 & 00000010 == 00000000)1 | 2 == 3(00000001 & 00000010 == 00000011)
bsampieria at 2007-7-12 14:44:19 > top of Java-index,Desktop,Core GUI APIs...
# 7
you can use + (plus) instead of | (bitwise or) if you find it easier to understand
jsalonena at 2007-7-12 14:44:19 > top of Java-index,Desktop,Core GUI APIs...
# 8
ok now it is logic.
Oleka at 2007-7-12 14:44:19 > top of Java-index,Desktop,Core GUI APIs...