Zum Inhalt springen

Empfohlene Beiträge

Geschrieben

Hallo

ich hab da ein komisches problem :-/ ...

wir mussten in der schule ein programm als klassenarbeit schreiben... nur ist bei mir etwas schief gelaufen, was selbst der lehrer nicht weiß wie man das beheben kann ...

das programm sieht so aus...

bild1.jpg

doch wenn ich auf einen button klicke dann passiert das ...

bild2.jpg

bild3.jpg

den quellcode findet ihr hier programm ... ich hoffe ihr könnt mir helfen :)

ich hab nämlich kein bock, das der mir dafür punkte abzieht, obwohl der den fehler selber nicht weiß...

mfg White-Eagle

Geschrieben

Tach,

Java Probleme haben in diesem Forum fast alle... ;)

Api der benutzen Methoden lesen...

void SpardoseZeichnen.paintComponent(Graphics g)

Calls the UI delegate's paint method, if the UI delegate is non-null. We pass the delegate a copy of

the Graphics object to protect the rest of the paint code from irrevocable changes (for example,

Graphics.translate).

If you override this in a subclass you should not make permanent changes to the passed in

Graphics. For example, you should not alter the clip Rectangle or modify the transform. If you

need to do these operations you may find it easier to create a new Graphics from the passed in

Graphics and manipulate it. Further, if you do not invoker super's implementation you must honor

the opaque property, that is if this component is opaque, you must completely fill in the

background in a non-opaque color. If you do not honor the opaque property you will likely see

visual artifacts.

Parameters:

g the Graphics object to protect

See Also:

.paint

ComponentUI

mögliche Lösung:


public SpardoseZeichnen(Spardose spardose)

  {

    this.spardose=spardose;

    this.setOpaque(false);

  }

Gruß Jaraz

Geschrieben

Hallo

der Lehrer hat mir nun den Fehler gezeigt, den ich gemacht hatte,...

es muss nämlich so heißen ...

super.paintComponent(g);
ich hatte jedoch
super.paintComponents(g);

da stehen... also ist das "s" zuviel...

für diesen Rechtschreibfehler hab ich 3 punkte abgezogenbekommen...

naja...

mfg White-Eagle

Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren

Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde Dich hier an.

Jetzt anmelden

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...