File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Extends issue with Rectangle class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Extends issue with Rectangle class" Watch "Extends issue with Rectangle class" New topic

Extends issue with Rectangle class

Jay Orsaw
Ranch Hand

Joined: Jun 14, 2011
Posts: 356

This was taken from another post I had, but wanted to make a new thread about it here. I have a class called "Face" that Extends Rectangle.

I now have to call my Face class into another class called Draw

"Okay so I had to originally had now I need but the first Face has to have .float whereas Rectangle2D didn't, is there a reason for that?

I just realized that if I do Face.Float that it only implements the methods of the Rectangle2D.Float... Booo that's no fun... . I realized that the only thing I need to fix from Face.Float to Face is my constructor, but it's sad the Face.float didn't work as I expected..."

Basically if I change to my rectangles will not Draw.

this is the only line of code that got effected by changing Face.float to Face, but I fixed the errors in that my Face constructor called ints, but now it's all floats like it should be.

I originally had this but figured it might be becasuse of the Fill/Draw

This doesn't work either though...

I debugged to see if maybe my face[] values weren't being stored but they are... I'm really confused why my rectangles aren't drawing .

So I want to say that if I use it will work, but I will lose all of the methods in my Face class(which is pointless to extend Rectangle if I cannot use the Face class I could just do

Any help would be appreciated, thanks,



Direct also works, why isn't it liking my face class!!!


Had to setRect ..... 2 things that make no sense. 1 if it extends the Rectangle class shouldn't it be a Rectangle itself(Since Rectangle extends Rectangle2D which Extends Rectangular Shape) and 2 I tried to draw the Rect in my paint class using the info from the Face class but that didn't work... Wuuut .....
I agree. Here's the link:
subject: Extends issue with Rectangle class
It's not a secret anymore!