0

I am learning Java. I have been able to use the constructors Font(Font font) and Font(String name, int style, int size) to create an object of Font. However, I am having trouble using this constructor - Font(Map attributes).

Do I have to create a HashMap, insert values using "Object put(Object key, Object value)" method for each of the attributes of Font, or is there an alternative way of using this Font constructor in a simple way and in a single line?

An example would be even more helpful. Thanks!

Enqueue
  • 63
  • 1
  • 10
  • See https://docs.oracle.com/javase/tutorial/2d/text/textattributes.html – c0der Sep 17 '16 at 15:23
  • You have to create HashMap and pass TextAttribute as key-value pairs. Please refer "Blake"'s answer on : http://stackoverflow.com/questions/325840/what-is-the-constant-value-of-the-underline-font-in-java – Chandana Sep 17 '16 at 15:28

0 Answers0