Hello, I was hoping someone can help me, im looking for a way to extend a basic shape class in particular the roundedrectangle2d class and be able to draw it in the same way we could handle an object with a simple call to g.draw(object instance); However im having problems with it not being drawn to the canvas, i only see a gray rectangle for the code below : import java.awt.BasicStroke; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JComponent; public class objectView extends JComponent { private static final long serialVersionUID = 1L; public objectView() { } …

Member Avatar
Member Avatar
+0 forum 2

Hi, I've been playing about with native classes and looking to extend them - well just the DateTime class actually. I was hpong that there would be a way to avoid using a constructor, but I can't seem to figure out how to store a 'startup' timestamp, `u` without it. I'm assuming this property is essential for the `reset()` method. Everything seems to work OK, as long as I supply a valid TimeZone. class diaDate extends DateTime{ private $u; public function __construct($time='now', $timezone='Europe/London') { parent::__construct($time, new DateTimeZone($timezone)); $this->u = $this->format('U'); } public function __toString() { return $this->format('Y-m-d H:i:s'); } public …

Member Avatar
Member Avatar
+1 forum 6

The End.