repaint

repaint() in Java doesn't “re-paint” immediately?

帅比萌擦擦* 提交于 2019-11-30 22:20:19
I have a code like that: // In MyPanel.java public void paintComponent(Graphics g) { super.paintComponent(g); // Draw something mypanel_count++; } // In Test.java public void testLargeData() { while (notDone) { panel.repaint(); // do huge work test_count++; System.out.println("Test_count: " + test_count + ", MyPanel_count: " + mypanel_count); } } // Output !!! Test_count: 752, MyPanel_count: 23 Test_count: 753, MyPanel_count: 23 Test_count: 754, MyPanel_count: 23 Test_count: 755, MyPanel_count: 24 But when I change panel.repaint() to panel.paintComponent(panel.getGraphics()) , the out is right

In C#, how do you send a refresh/repaint message to a WPF grid or canvas?

吃可爱长大的小学妹 提交于 2019-11-30 21:35:13
How do you send a refresh message to a WPF grid or canvas? In other words, I have noticed while in debug mode, I can write code that sends a line to the display and then, if that line is not right, I can adjust it -- but the previous line is still there. Now, the code I am writing sends information to the display based on what the user clicks. So this must mean that the display is not refreshed each time a new set of lines and boxes and text goes to the grid or canvas in WPF. Using C# code, how do you send a refresh/repaint message to a WPF grid or canvas? DevDemon Refresh update WPF Controls

Does AWT/Swing cancel painting operations if the monitor is off?

三世轮回 提交于 2019-11-30 18:45:36
I am experiencing a problem with Swing that only occurs when the computer monitor is powered off, but my Swing application continues to run in the background. It seems that whenever the monitor is off, Swing/AWT cancels all painting operations, leading to a number of display issues in the GUI that are visible as soon as the monitor turns back on. For example, when I turn off the monitor using a custom JNI function and subsequently open a simple message dialog, the message dialog is blank when the monitor turns back on: But it paints correctly after the next repaint: Is this the expected

Points drawn in the onload event of the SVG element are NOT being displayed when rendered

元气小坏坏 提交于 2019-11-30 17:59:11
问题 I'm working on drawing an SVG grid using Javascript. I've managed to get the axis drawn, as well as my quadrant labels. However I've run into an issue adding my dynamic points. I'm trying to draw the points in the onload event of the SVG element. When using Firebug I have been able to confirm that the circle elements representing my points ARE added to the SVG DOM with the correct attributes set for location, brush stroke, etc. Unfortunately the actual image as rendered by my browser (Firefox

update() or repaint() fails to trigger paintEvent()

十年热恋 提交于 2019-11-30 11:25:47
I have a QScrollArea fathering my awesome scrolling widget. I like to do updates on the contents on various occasions. For this I did an override of paintEvent(QPaintEvent *) . Then everytime I want it to be done I call update() on the widget. Problem: paintEvent() is never called by this! What I tried in troubleshooting so far: Use repaint() instead of update() . Should call it instantanously. Unfortunately does not. Test for isVisible() and updatesEnabled Test wether my override is correct. Resizing the window calls my function. Only my manual update(), repaint() calls fail. Implement a

In C#, how do you send a refresh/repaint message to a WPF grid or canvas?

蓝咒 提交于 2019-11-30 05:48:15
问题 How do you send a refresh message to a WPF grid or canvas? In other words, I have noticed while in debug mode, I can write code that sends a line to the display and then, if that line is not right, I can adjust it -- but the previous line is still there. Now, the code I am writing sends information to the display based on what the user clicks. So this must mean that the display is not refreshed each time a new set of lines and boxes and text goes to the grid or canvas in WPF. Using C# code,

Does AWT/Swing cancel painting operations if the monitor is off?

情到浓时终转凉″ 提交于 2019-11-30 03:01:39
问题 I am experiencing a problem with Swing that only occurs when the computer monitor is powered off, but my Swing application continues to run in the background. It seems that whenever the monitor is off, Swing/AWT cancels all painting operations, leading to a number of display issues in the GUI that are visible as soon as the monitor turns back on. For example, when I turn off the monitor using a custom JNI function and subsequently open a simple message dialog, the message dialog is blank when

Can't repaint my JFrame/JPanel

痴心易碎 提交于 2019-11-29 17:29:10
I have created a program that just moves a ball across a screen. I used to have it all in one class, but decided that it looked too messy so I split it up into three different classes: Main... initializes everything, Game... which paints everything and is a JPanel, and AL which is a KeyListener (which is also where the problem is). The problem is that I can't get the program to repaint from my AL class no matter what I try to pass into it. Can anyone help with this? Here are my three classes: import java.awt.Color; import javax.swing.JFrame; public class Main { static Game game; static JFrame

update() or repaint() fails to trigger paintEvent()

非 Y 不嫁゛ 提交于 2019-11-29 17:01:04
问题 I have a QScrollArea fathering my awesome scrolling widget. I like to do updates on the contents on various occasions. For this I did an override of paintEvent(QPaintEvent *) . Then everytime I want it to be done I call update() on the widget. Problem: paintEvent() is never called by this! What I tried in troubleshooting so far: Use repaint() instead of update() . Should call it instantanously. Unfortunately does not. Test for isVisible() and updatesEnabled Test wether my override is correct.

Java - repainting JPanel gives an error

夙愿已清 提交于 2019-11-29 16:15:26
I'm a beginner in Java, and I'm trying to create an application that draws a rectangle where ever the cursor is located. I've already done everything, but I can't get the mouseMoved(MouseEvent) method to repaint the JPanel . Without the repaint, the rectangle is only drawn once and that's it. With the repaint, it compiles fine, but when I run it, every time the mouse is moved, I get this big " Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException " error. So, can anyone please help me out on this? import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax