473,775 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Repainting from within an ActionListener doesn't work

I have a "wizard" type program with a series of panels that are placed in a
JPanel. When the "Next >" button is pressed, I put in a new panel (in
other words, the ActionListener for "Next >" selects the proper panel from
a CardLayout). Some of these panels, when selected, perform actions
immediately. When that happens, the panel is not displayed until the
action is complete.

I've tried invalidating the layout and repainting, but it seems like once an
ActionListener is called, the display is frozen until the ActionListener is
done. Is that right? Is there a way to "wake up" the display from within
the ActionListener so it can be updated while the ActionListener is
performing its tasks?

Thanks!

Hal
Jul 17 '05 #1
2 2383
Hal Vaughan <ha*@thresholdd igital.com> wrote in message news:<coUkb.597 274$Oz4.592240@ rwcrnsc54>...
I have a "wizard" type program with a series of panels that are placed in a
JPanel. When the "Next >" button is pressed, I put in a new panel (in
other words, the ActionListener for "Next >" selects the proper panel from
a CardLayout). Some of these panels, when selected, perform actions
immediately. When that happens, the panel is not displayed until the
action is complete.

I've tried invalidating the layout and repainting, but it seems like once an
ActionListener is called, the display is frozen until the ActionListener is
done. Is that right? Is there a way to "wake up" the display from within
the ActionListener so it can be updated while the ActionListener is
performing its tasks?

Thanks!

Hal


This is a recurring question on any Java forum.

Read the JDK javadoc for SwingUtilities# invokeLater() method and
linked documentations from there.
Jul 17 '05 #2
hiwa wrote:
Hal Vaughan <ha*@thresholdd igital.com> wrote in message
news:<coUkb.597 274$Oz4.592240@ rwcrnsc54>...
I have a "wizard" type program with a series of panels that are placed in
a
JPanel. When the "Next >" button is pressed, I put in a new panel (in
other words, the ActionListener for "Next >" selects the proper panel
from
a CardLayout). Some of these panels, when selected, perform actions
immediately. When that happens, the panel is not displayed until the
action is complete.

I've tried invalidating the layout and repainting, but it seems like once
an ActionListener is called, the display is frozen until the
ActionListener is
done. Is that right? Is there a way to "wake up" the display from
within the ActionListener so it can be updated while the ActionListener
is performing its tasks?

Thanks!

Hal


This is a recurring question on any Java forum.

Read the JDK javadoc for SwingUtilities# invokeLater() method and
linked documentations from there.


Thanks!

I tried several different ideas. I hadn't thought of creating another
thread (I'm still getting used to the idea of threads -- I'm not a
professional programmer and there's a lot of obvious things I seem to miss
since I'm basically self-taught). That was a big help!

Hal
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3483
by: Michael | last post by:
Hello Currently I'm migrating an applet from Java 1.1 to 1.3. Targetplattform: Microsoft Internet Explorer 5.x with Sun's Java VM 1.3.1 Problem: The attached applet works fine with the Microsoft VM. But when I use Suns' VM the applet hangs after opening the dialog. And you have to
1
5980
by: Patrick Vanhoof | last post by:
Hi, I have a small program to test the ActionListener, but it gives errors. Here's part of the code: class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { ....
0
1806
by: linux newbie | last post by:
is there any java expert could tell me what the problem below and explain the code to me, your explanation is greatly appreciated :) static Class class$java$awt$event$ActionListener; static Class _mthclass$(String x$0) { try
0
1304
by: Mike Richardson | last post by:
Hello, I am using VB.net. Is there a way to stop the screen from repainting. I would perfer to stop screen repainting for the entire application. Example when a form is loading. Stop repainting. Execute code. restore repainting. In VB 6 I called
1
2198
by: Phil Sandler | last post by:
I am having a strange problem with IE 6 and an image swap. I have a page with a dropdown list. The script changes an image on screen based on the value selected in the list. Simple enough, right? But when I change the value of the list by clicking with the mouse, the screen repaints. It doesn't refresh from the server, it just sort of "flashes". 1. If I change the list with the wheel on my mouse, the screen doesn't
5
1431
by: Jesse Aufiero | last post by:
Hello all, I have many buttons on a form and at the bottom of the form is a grid that behaves as though it is 'retractable' - at various times during the life of the app, the grid becomes taller and conceals the many buttons below it. That transition is fine. The problem is that when the grid retracts back down to the bottom portion of the form, to reveal the many buttons underneath it, the repainting is slow and ugly.
2
2136
by: vunet.us | last post by:
Please, explain an interesting phenomenon, if you can. I have an array of references to an HTML element: <div id='container'> <div id='someId1'></div> <div id='someId2'></div> </div> ..... myArray = document.getElementById("someId1"); myArray = document.getElementById("someId2");
1
3914
by: Phil Latio | last post by:
Quite a while back I used Java Swing (for Uni project) which allowed the developer to a create form and on the "Submit" button I recall adding something called an ActionListener. I was thinking of trying to do the something similar in PHP but a bit puzzled on how I would achieve it. My thoughts are to have a class for a Textbox, class for a SubmitButton and a class called ActionListener which is invoked (is that the correct term??) when...
7
5948
by: azoapes | last post by:
Hello, I'm trying to prevent a listView from repainting when I change group assignments for the items. Let's assume I have two groups with 100 items in each and moves 100 items from group A to group B, then the listView will repaint itself a lot, slowing down the operation and flickering (can be solved by listView.Visible = false; but it doesn't speed it up, i.e. the listView still repaints itself). There are the listView.BeginUpdate() and...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10268
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10107
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10048
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9916
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4017
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2853
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.