tags:

views:

28

answers:

1
   font = new Font("San Serif", Font.PLAIN, 24)
  val keys = UIManager.getDefaults().keys()
  while (keys.hasMoreElements()) {
   val key = keys.nextElement()
   val value = UIManager get key
   if (value.isInstanceOf[FontUIResource])
    UIManager.put(key, font)
  }

I used the code above to change all the default fonts in Scala Swing components. I tried with Label, TitledBorder, TextField, PasswordField and Button so far. However, Label and Button are staying the same while others are using the new font. Any solution?

A: 

Maybe you should override LookAndFeel instead? It is not easy though.

Paweł Dyda
I did override the LookAndFeel. But I still need a bigger font size for most of the component.
JohanSJA
Pawel, thanks anyway. It does seems to be a problem with the LookAndFeel. I changed the LookAndFeel to Metal from GTK and now the code is working just fine.
JohanSJA