repaint

IE10 JavaScript cannot repaint window while computer is locked?

妖精的绣舞 提交于 2019-12-05 04:29:14
The Problem Occurs on IE10. (IE8 works fine.) I've written some JavaScript code that, after 20 minutes of inactivity, redirects the browser to another URL to indicate the user was logged out. Normally this works fine. However I've noticed a strange scenario.... if the user's Windows computer was locked during this timeout then it appears as though nothing has happened. However, when I look at the browser's URL bar, I can clearly see that the URL has already been updated to the auto-logout page. But the entire content of the browser window is still displaying the old page!!!! For some reason,

repaint() Method in Java

大憨熊 提交于 2019-12-04 08:18:01
I am playing around with the Java graphics class a little bit and I was just wondering--when is it necessary to call the method repaint() ? I tried commenting it out and it didn't seem to affect my output GUI. I've seen it used a lot in Java GUI code that I've read, though. Would anyone mind explaining when to use it and when not to use it? The repaint() refreshes the view (component), so whenever you make any change on the component, you must call it. For instance, if you rotate the graphical component, you must make a call to repaint() in order to see the change on the containing component

Swing JPanel won't repaint

怎甘沉沦 提交于 2019-12-04 04:33:27
I have a simple object which extends JPanel , when the update() method is called on this object it it meant to add some labels to the panel and then repaint. However the labels do not show up after the update method is called, below is the code for update: public void update(){ GridBagConstraints constraints = new GridBagConstraints(); if(cardsHidden){ for(int i = 0; i < 2; i++){ constraints.gridx = i; constraints.gridy = 0; JLabel card = new JLabel(PlayingCards.cardImages[PlayingCards.CARD_BACK_INDEX]); add(card, constraints); } } else{ Card[] holeCards = player.getHoleCards(); for(int i = 0;

how to use jpanel with paint (or repaint)

僤鯓⒐⒋嵵緔 提交于 2019-12-04 04:27:41
问题 I'm a newbie to the paint/graphics and wonder how to add a JPanel to my code in such way that the entire graphics will be on a JPanel and not on the JFrame. In other words, I'm trying to create a GUI that will allow me to do this: on the RIGHT side show the nice movement of the lines on a JPanel on the LEFT side, add a JTextArea (on a JPanel) that will show the coordination of the graphics. This is a simplification of a bigger problem but I guess the code here is easier to understand. Thank

How do I invoke an immediate update to a Java GUI? (conflict with Thread.sleep())

痴心易碎 提交于 2019-12-04 03:23:45
问题 I am making the game Memory, when you pick two cards and if they match you get to keep them, otherwise you turn them back. If you then remember cards you have already chosen, you can venture a better guess on the next two cards. The problem I have involves the repaint() method not immediately repainting. When I flip the second card, no matter the outcome, I want to show both cards flipped right-side up before either discarding them or flipping them back over. I do this by calling sleep() . Of

javax.swing.Timer slowdown in Java7u40

穿精又带淫゛_ 提交于 2019-12-04 01:43:05
问题 Invoke javax.swing.Timer#start() same time, 7u25 is not problem. but 7u40 is big problem. Too laggy invoke ActionListener#actionPerformed. (basically same time invoke u25) Totally different move between u25 and u40. (I use Windows 8) I bug report but still not add bug tracking system. Oracle crushing swing apps? import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TimerProblem extends JComponent { int red = 0; TimerProblem(final long startMs) { setPreferredSize(new

Swing: Can't get JButton to update - repaint() not working

假装没事ソ 提交于 2019-12-04 01:18:47
问题 I'm using Swing for the first time to create a simple GUI. It consists of a JFrame upon which I have placed a single JButton which, when clicked, calls some other code which takes approx. 3 seconds to return. Just before the call to this code, in actionPerformed() , I want to update the text on the button to inform the user that processing is occuring. My problem is that the text on the button does not update until after the 3-second call has returned. I want the updated text to be present

Java graphics repaint problem

寵の児 提交于 2019-12-03 20:23:41
Having trouble with a simple paint pad in java. Issues with getting my clear button to repaint. The array is clearing but not repainting. Can anyone spot my problem or is there any different way of generating a clear button for this code. public class DrawingPanel extends JPanel { private double x1=0; private double x2=0; private double y1=0; private double y2=0; private ArrayList<Shape> myArr = new ArrayList<Shape>(); //private ArrayList<Shape> clearMyArr = new ArrayList<Shape>(); ButtonPanel buttonPress; public void paintComponent(Graphics g) { for (Shape i : myArr) { Graphics2D g2d =

How to change controls simultaneously without repainting each one?

天涯浪子 提交于 2019-12-03 13:37:03
For example I need to disable two buttons in runtime. After I disabled first button it bacame gray, the second - it also became gray. But I do not know how to make the repainting simultaneous! I need something like that: freeze the Form (disable repainting) disable first button disable second button Enable Form repainting How to implement that? Look at the Win32 API WM_SETREDRAW message. For example: SendMessage(Handle, WM_SETREDRAW, False, 0); Button1.Enabled := False; Button2.Enabled := False; SendMessage(Handle, WM_SETREDRAW, True, 0); InvalidateRect(Handle, nil, True); Messages cannot be

In the dev tools timeline, what are the empty green rectangles?

泪湿孤枕 提交于 2019-12-03 04:22:30
问题 In the Chrome dev tools timeline, what is the difference between the filled, green rectangles (which represent paint operations) and the empty, green rectangles (which apparently also represent something about paint operations...)? 回答1: Painting is really two tasks: draw calls and rasterization. Draw calls . This is a list of things you'd like to draw, and its derived from the CSS applied to your elements. Ultimately there is a list of draw calls not dissimilar to the Canvas element's: moveTo