• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Extends issue with Rectangle class

 
Ranch Hand
Posts: 356
Android Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,

~JO


EDIT:



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



EDIT:



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 .....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic