We would like to use some of our existing Java AWT graphics code on the Android platform. As far as I can tell, Android does not include any of the AWT classes -- no Graphics2D
, Path2D
, FontMetrics
, etc.
What is the best approach to port our drawing code to Android? Ideally, we would like to modify our code base to target both Android and generic Java.
Java AWT (Abstract Window Toolkit) is an API to develop Graphical User Interface (GUI) or windows-based applications in Java. Java AWT components are platform-dependent i.e. components are displayed according to the view of operating system.
The Graphics class is the abstract super class for all graphics contexts which allow an application to draw onto components that can be realized on various devices, or onto off-screen images as well. A Graphics object encapsulates all state information required for the basic rendering operations that Java supports.
There are several ways to create graphics in Java; the simplest way is to use java. awt. Canvas and java. awt.
appengine-awt is a pure java implementation of the java.awt and javax.imageio packages for use in the Google AppEngine environment.
https://github.com/witwall/appengine-awt
SwingWT is a 100% pure Java library which aims to be a free implementation of Swing and AWT. Unlike Swing, it drives native peer widgets for your platform from SWT.
https://github.com/witwall/SwingWT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With