Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • 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: 17309
11
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
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!