problem about repaint-Collection of common programming errors


  • Lennart Schoch
    java swing actionlistener repaint
    EDIT: Now it works fine, but when i switch to the “game” JPanel, the KeyListener is not working 🙁 Any way to fix this?i’m just programming a java game and there is a problem with the repaint() method: I wanna get from the menu to the game so i remove the menu panel and add the game panel (“Zeichnen” extends JPanel) But every time i try to repaint, eclipse gives me the following error: “The method repaint() is undefined for the type new ActionListener(){}” Can anyone please help me? :(Code:impor

  • mKorbel
    java swing paint repaint jcomponent
    I am new on java. I want to create an abstract factory in java. I have a class point and I want to extend other classes ( circle, rectangle ) from this. Here is my code. It says repaint is undefined..import javax.swing.*; import java.awt.*; import java.awt.Component; import javax.swing.*;public class Circle extends Point {public void Draw() {repaint(); }public void paint(Graphics g) { g.drawOval(this.x, this.y, 10, 10);}…

  • Omar Munoz
    java swing jlabel repaint event-dispatch-thread
    Hi I am trying to create a gui that will update the temperature every time the temperature sensor sends back a signal and update the jlabel value. Right now I am able to update the gui label by pressing the update button, however i want it to update automatically without pressing the “update button”. I have tried a lot of method including repaint(), and revalidate(), and using different type of swing timers but still cannot get it to work. Can someone please help me out here? Thanks I will post

  • Andrew Thompson
    java swing jpanel jlabel repaint
    When I repaint() the panel, where I’m placing my JLabels on, I get errors, but it still works. I tried putting the panel.repaint(); code in a try statement and that didn’t help. Anyone else having problems with repaint() for JPanels?Error message (copied from the comments):Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: No such child: 21 at java.awt.Container.getComponent(Unknown Source) at javax.swing.JComponent.rectangleIsObscured(Unknown Source) at javax.

Originally posted 2013-11-27 05:10:34.