Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

is Canvas an obsolete class?  RSS feed

 
Ranch Hand
Posts: 4702
9
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
back in 2000 when i was first getting into java i wrote an applet that used a canvas to display various images depending on the users choice. now we do that on a JPanel instead. however i notice that several years later i was still importing java.awt and java.awt.event(im not going to take the time to find out why)

so my question really is how much do we still use awt?
and how much of it is obsolete?
 
Sheriff
Posts: 24089
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The actual GUI components are all obsolete and have been for years. They lingered on for a while because people were writing applets which they expected might be run by pre-Java-2 JVMs, but when Microsoft finally stopped their JVM shenanigans in 2004 that was the end of their usefulness.

The underlying plumbing classes, like events and so on, are still used because they weren't affected by the re-architecting process that resulted in Swing.

 
Sheriff
Posts: 21610
101
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swing is built on top of AWT. As Paul said, only stop using the component and window classes, and you should be fine.

There's one big exception to this rule - java.awt.TrayIcon in combination with java.awt.PopupMenu, java.awt.Menu and java.awt.MenuItem. When you need to have an icon in the system tray, those are your only option (apart from a third party library).
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!