Tuesday 15 February 2011

java - I'm tryng to draw shapes in a JPanel extending a JComponent and then putting the component inside the panel but it won't work -


The title just tells me my situation in advance, to get more details, I've got JFRAM (500, 500) and I need the right half of it so that things get drowned in. I'm clearly doing something wrong! This is the code I used:

  Component of public class, JakkMonant (public zero color) (Graphics G) {Graphics2D g2 = (Graphics2D); G2.setRenderingHint (Rendering Hicks. KEY_ANTIALASING, Rendering Hints. VALUE_ANTIALIAS_ON); Size Row = New Rectangle 2D Float (50, 50, 50, 50); Size cerchio = New Ellipse2D.Double (100, 100, 50, 50); G2.setPaint (Color.BLUE); G2.draw (linya); G2.draw (cerchio); }  

}

  public class PannelloDx JPanel {PannelloDx () {this.setBackground (Color.CYAN) is extensible; This.setSize (Esercitazione_Berni1703.finestra.getWidth () / 2, Escartiazione 1703.finestra.getHeight ()); This.setLocation (Esercitazione_Berni1703.finestra.getWidth () / 2, 0); This.add (new component ()); }  

}

} Now, the output cyan shows the panel in the right half in Jeffram because it is considered .. it will not show anything !! Perhaps this is a stupid and obvious mistake for you and more experienced people. I'm learning for now ..

No comments:

Post a Comment