• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i use java.awt.Color class?

 
sravana reddibathini
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
can i use java.awt.Color or java.awt.Font classes in my assignment?.
are thses considered AWT components?.
Thanks
Sravana
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well yes they are part of the awt package, so they are awt. But do you see any classes in the Swing package to do Color or Font. I don't think so.
If you look at the setFont method of JTextField you will see that it accepts Font class from the AWT package. This is because they didn't need to reinvent this class. Also you will notice that most of the LayoutManagers come from AWT.
So while you want to use Swing in all classes, some AWT classes don't have Swing counterparts.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic