Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Porting AWT graphics code to Android

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.

like image 509
Tony the Pony Avatar asked Apr 25 '11 21:04

Tony the Pony


People also ask

Is Java AWT an API?

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.

What is Java AWT graphics?

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.

Can Java make graphics?

There are several ways to create graphics in Java; the simplest way is to use java. awt. Canvas and java. awt.


1 Answers

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

like image 176
bth_ Avatar answered Sep 28 '22 10:09

bth_