Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Swing Graphics Problem

Empfohlene Antworten

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

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

Hallo

habe ich ausprobiert... aber es hat nix geholfen... das problem ist immernoch da...

mfg White-Eagle

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

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.