This is how I create rounded rectangles and if I create rounded rectangles in this fashion, the code cannot be reused.
But if I could create a Class Rounded Rectangle that extends Shape Class of Java, I can use it anywhere and anytime.
Java AWT's GEOM class and Graphics2D class are not supported in my Virtual Machine environment, So the only way to create Rounded Rectangle is to use drawRoundRect function of Graphics class. But doing this way has so many disadvantages.
If I create 4 shapes, and if I want to add key listener to 4 shapes and on click of a shape a new screen should open, since I dont have Geom Class support, I cant store rounded rectangle shapes in an arraylist and access it. I have to every time detect the pixels space between 2 rounded rectangles to detect the Click event.
So I am looking for a possible code example of Rounded Rectangle created by extending Shapes class.
Java.awt.geom package has support for Rounded Rectangle. But my problem is that, the environment in which I write my code has only selected packages of AWT. GEOM package in AWT is not available in the environment I work on.
posted 3 years ago
My, you must be using an old implementation. The java.awt.geom package was introduced about 1997. There is no such thing as the GEOM class. The only Shape class is a JavaFX class; there is a Shape interface.
Somebody was talking about old implementations a few weeks ago. They couldn't use 2D graphics. Was it you?