DigitalUrView's paint metode
- public void paint(Graphics g) {
- super.paint(g);
- Graphics2D g2 = (Graphics2D) g;
-
- GregorianCalendar cal = model.getTime();
- int time = cal.get(Calendar.HOUR_OF_DAY);
- int minut = cal.get(Calendar.MINUTE);
-
- g2.setFont(new Font(Font.SERIF, Font.BOLD, 32));
- g2.drawString(time + ":" + minut, 0, 0);
- }
UrView's paint metode:
- public void paint(Graphics g) {
- super.paint(g);
- }
"Applications should not invoke paint directly, but should instead use the repaint method to schedule the component for redrawing."
bliver man ikke nødt til at kalde super.paint når man arver fra JPanel, og overskriver paint metoden?
Indlæg senest redigeret d. 05.09.2008 22:08 af Bruger #13669