Repaint « Event « Java Swing Q&A





1. Repainting a graphic paintComponent using an ActionListener    stackoverflow.com

I am struggling a bit with how to repaint a circle graphic to a different color on a button click. Further, I also have to do the same with a ...

2. Java paint() and repaint()    stackoverflow.com

I'm writing a Java game for a school project. So far I have created (and painted) a gameplan like this:

public class gameplan{
    public static void createAndShowGUI(int players,int fields) ...

3. Java Swing: repaint component during long event    stackoverflow.com

I am working with Java Swing to render my GUI for an application. I have an ActionListener set up on a JButton to fire off a series of tests. ...

4. Repaint() in ActionPerformed.    coderanch.com

HI Bon, Your problem stems from the fact that you are running a sequential program. In order to change that you need to make use of threads. In Java it is pretty easy to do that. In your program, I would make Direc class implement Runnable. Change the draw method into the run method. It would look like this. public class ...

6. calling repaint in an ActionListener    coderanch.com

Hi, I feel like I should know why this is happening, but... I am trying to show a simple animation when the user clicks a button. So I have a loop in the ActionPerformed method which calls repaint and then sleeps. But what happens is that only the last repaint actually happens. The other calls to repaint never seem to occur ...

7. Using repaint() inside actionPerformed(Event e ){}    coderanch.com

Hi, guys! I'm trying to move a circle from one side of the screen to another... It works if I put the code inside my main class. But, if I have a button on the screen and push it, when the actionPerformed method get called it doesn't refresh the screen. Why does it works outside the actionPerformed and doesn't inside?? Thank's!! ...

8. Do certain events make calls to repaint redundant?    coderanch.com

> changes the size of a shape on the JPanel We have no idea what you code is like to implement that change, so its hard to guess. If you are doing custom painting to draw the shape in the Graphics method, then you should need to invoke repaint on the panel to reflect the change. If you are changing a ...

9. Do certain events make calls to repaint redundant? (Part 2)    coderanch.com

Hi again.. I do have an example now of where the circle shape grows in size when the height value is changed due to a scroll bar adjustment but I have no call to the repaint() method in the panel. Why then, when normally I expect to have to call repaint() to update the screen, does this work in my code ...





10. Repaint not working inside actionperformed!! need help please .    coderanch.com

Here is the code of my program, I don't know what is the problem. I would really appreciate the help. thank you :-) import java.io.*; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public class GUI extends JFrame implements WindowListener { //Para el Contenedor static GUI win; static JTabbedPane tabPane; static GPS gps; //Auxiliares static String[] coordsText; public GUI(){ super("GUI"); tabPane ...

11. repaint happens only on mouseclick    coderanch.com

I need to draw a graph in my app. I have created a separate class for it which extends jPanel. class optgr extends JPanel { when launching the app I create an instance of this class: private optgr optgrafiks = new optgr(); here's the constructor of that class if it matters any: public optgr() { try { jbInit(); } catch (Exception ...

12. repaint in mouselisteners with GradientPaint    java-forums.org

Is it possible to make a class (a custom shape) and add mouselisteners inside it even if we don't have a main method in that class? I want to use objects from that class in another class, and when I click on an object I want it to change its Gradient. I've tried a hundred ways using pain, repaint and mouselisteners. ...