JWindow shows up as an empty rectangle

Hi everyone.
I have a class which is a subclass of JDialog. When the user clicks the OK button on the dialog, I want to display a "please wait" message while I am doing some processing.
I tried displaying this window by using a JWindow class. The problem is that the window appears as an empty white background rectangle and is not showing the message.
Here is the code I am using in my OK event handler:
javax.swing.JWindow jwin = new javax.swing.JWindow();
jwin.getContentPane().setLayout(new java.awt.BorderLayout());
jwin.getContentPane().setBackground(java.awt.Color.blue);     
javax.swing.JLabel JLabel1 = new javax.swing.JLabel( );
JLabel1.setForeground(java.awt.Color.red);
JLabel1.setText( "Please Wait..." );
jwin.getContentPane().add(JLabel1,java.awt.BorderLayout.CENTER);          
jwin.setVisible(true);
//jwin.setLocationRelativeTo(this);
jwin.setSize(70,25);
jwin.show();
Any ideas?

The thing is that if I use InvokeLater then JVM invokes the thread only after I finish my processing - I see the JWindow after I finish all my processing. On the other hand, if I use InvokeAndWait I get this exception:
java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread

Similar Messages

  • Photos in pdf opened using Adobe Reader 9 show as empty rectangles.

    Photos in pdf show as empty rectangles. What do I need to do to view the photos? I use Adobe Reader 9.

    Page Display Preferences/Page Content and Information already showed/s "show large images".  The pdf with photos comes from a website (http:) so there is no "edit" to select, but right clicking on the page gives the "page display preferences".

  • JWindow shows just an empty square

    Below i will give two classes. They works fine except one thing - when i push button, JWindow appears, but it is empty. Why? If I put a code from work() method to main() everything works perfect. Can someone help and explain what to do?
    This class works fine
    package bin;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.BorderLayout;
    import java.awt.Frame;
    import java.awt.Toolkit;
    import javax.swing.ImageIcon;
    import javax.swing.JWindow;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class Indikatorius implements Runnable{
         private static final long serialVersionUID = 1L;
         private ImageIcon ii = new ImageIcon("Menas/Indikatorius.gif");
         private JLabel l = new JLabel("TEST");
         private Container contentPane;
         private Frame f;
         private JWindow window;
        public Indikatorius(Frame owner) {
             f = owner;
        private void centruok(){
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              window.setLocation((dim.width-window.getWidth())/2, (dim.height-30-window.getHeight())/2 );
        private void sukurk(){
             window = new JWindow(f);
             contentPane = window.getContentPane();
             contentPane.setLayout(new BorderLayout());
             contentPane.add(l, BorderLayout.CENTER);
             window.setAlwaysOnTop(true);
             window.pack();
             centruok();
             window.setVisible(true);
        public void kill(){
             window.dispose();
        public void run(){
             sukurk();
        public static void main(String[] args) throws InterruptedException{
             Indikatorius i = new Indikatorius(null);
             Thread t = new Thread(i);
             t.start();
             t.join();
             t.sleep(5000);
             i.kill();
    }This - not.
    package bin;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame implements ActionListener{
         * Creates a new instance of <code>Test</code>.
        private JButton b = new JButton("push me");
        public Test() {
             setSize(400,600);
             getContentPane().setLayout(new BorderLayout());
             getContentPane().add(b, BorderLayout.CENTER);
             b.addActionListener(this);
             centruok();
             setVisible(true);
        private void centruok(){
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              setLocation((dim.width-getWidth())/2, (dim.height-30-getHeight())/2 );
        private synchronized void work() throws InterruptedException{
             Indikatorius i = new Indikatorius(this);
             Thread t = new Thread(i);
             t.start();
             t.join();
             t.sleep(5000);
             for (int j = 0; j < 1000; j++)
                  System.out.println("Numeris: "+j);
             i.kill();
             Thread.sleep(2000);
             setVisible(false);
             dispose();
        public void actionPerformed(ActionEvent e) {
             try{
                  work();
             catch(InterruptedException ie){
         * @param args the command line arguments
        public static void main(String[] args){
            // TODO code application logic here
            new Test();
    }

    If someone want a working waiting window - feel free to use
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.BorderLayout;
    import java.awt.Toolkit;
    import javax.swing.ImageIcon;
    import javax.swing.JWindow;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.border.BevelBorder;
    import javax.swing.BorderFactory;
    public class Indikatorius extends JWindow implements Runnable{
         private static final long serialVersionUID = 1L;
         private ImageIcon ii = new ImageIcon("Menas/Indikatorius.gif");
         private JLabel l = new JLabel(ii);
         private Container contentPane;
        public Indikatorius(JFrame owner) {
             super(owner);
             setSize(200, 200);
             contentPane = getContentPane();         
             ((JPanel)contentPane).setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
             contentPane.add(l, BorderLayout.CENTER);
             setAlwaysOnTop(true);
             centruok();         
             //setVisible(true);
        private void centruok(){
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              setLocation((dim.width-getWidth())/2, (dim.height-30-getHeight())/2 );
        public void run(){
             setVisible(true);
    }AND
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame implements ActionListener{
      private JButton b = new JButton("push me");
        public Test() {
             setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
             setSize(400,600);
             getContentPane().setLayout(new BorderLayout());
             getContentPane().add(b, BorderLayout.CENTER);
             b.addActionListener(this);
             centruok();
             setVisible(true);
        private void centruok(){
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              setLocation((dim.width-getWidth())/2, (dim.height-30-getHeight())/2 );
        public void actionPerformed(ActionEvent e){
             final Indikatorius ind = new Indikatorius(this);
             Thread appThread = new Thread(){
                  public void run(){
                       try{
                            //SwingUtilities.invokeAndWait(ind);
                            SwingUtilities.invokeLater(ind);
                            for (int j = 0; j < 100; j++)
                                 System.out.println("Numeris: "+j);
                       catch (Exception e){
                            e.printStackTrace();
                       //System.out.println("Finished on " + Thread.currentThread());
                       for (int j = 0; j < 1000; j++)
                            System.out.println("Numeris: "+j);
                       ind.dispose();
            appThread.start();
         * @param args the command line arguments
        public static void main(String[] args){
            // TODO code application logic here
            new Test();
    }

  • When browsing a new library that I created, the browser shows dotted lines around grey rectangles, no images. When I double click on a rectangle the image appears. How do I get images to appear in the browser rectangles?

    When browsing a new library that I created and exported onto an external hard drive, the browser shows dotted lines around grey rectangles, no images. When I double click on a rectangle, the image appears, but all the other rectangles remain empty - no image. How do I get images to appear in the browser rectangles? I am viewing this on a second computer (an older intel duo iMac), not the one I created the library on (a MacBook Pro). Both computers have Aperture 3.2.4 installed. When I return the external to the MacBook, all images appear in browser rectangles. What's happening on the iMac?

    You may have a problem with the permissions on your external volume. Probably you are not the owner of your library on the second mac.
    If you have not already done so, set the "Ignore Ownership on this Volume" flag on your external volume. To do this, select the volume in the Finder and use the Finder command "File > Get Info" (or ⌘I).
    In the "Get Info" panel disclose the "Sharing & Permissions" brick, open the padlock, and enable the "Ignore Ownership on this Volume" flag. You will have to authentificate as administrator to do this.
    Then run the "Aperture Library First Aid Tools" on this library and repair the permissions. To launch the "First Aid Tools" hold down the ⌥⌘-key combination while you double click your Aperture Library. Select "Repair Permissions" and run the repair; then repeat with "Repair Database". Do this on the omputer where you created the library and where you can see the thumbnails.
    Then check, if you now are able to read the library properly on your iMac.
    Regards
    Léonie

  • My IMac is frozen with the screen white apple logo appears and spinning wheel. Long empty rectangle is under the spinning wheel?

    My IMac is frozen with the screen white ,apple logo appears and a spinning wheel under it. A long empty rectangle empty appears under the wheel and is empty.

    Your iMac is trying to go into safe.  This usually happens when it has detected an issue with the OS or file system. 
    Follow the steps outlined in http://support.apple.com/kb/TS2570

  • Numbers will not display 3D charts on my new computer. I am running system 10.6.8. A 2D chart turns into a selected empty rectangle when I change it to a 3D chart. What do I do?

    Numbers will not display 3D charts on my new computer. I am running system 10.6.8. A 2D chart turns into a selected empty rectangle when I change it to a 3D chart. What do I do? I am running iWork 9.1.

    Hello
    Numbers 2.1 under 10.7.2 on my iMac described below.
    There is at least a thread describing what you get:
    https://discussions.apple.com/message/15526080
    It claims that it strike when the app is using the NVIDIA video card available in some macBook pro.
    Yvan KOENIG (VALLAURIS, France) samedi 7 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2

  • Why won't my trash empty or show that it is empty?

    HI!
    I deleted a lot of files from my external drive then Trash deleted some of them but not all. I'm trying to Empty Securely Trash but it says: "The operation can’t be completed because you don’t have permission to access some of the items."
    I tried to press the option key and then Empty Securely Trash but it didn't work.
    When I log into my administration account and insert the external drive then it shows that Trash is empty but when I use my usual users account and insert the external drive then it shows that there are items in the trash but it won't let me Empty the Trash.
    Otherwise both my admistration account trash and usual users account trash are both empty, Its only when I use my usual users account and insert external drive then it shows items in the Trash and won't let me Empty it.
    So now I don't know if there are actually items in the Trash that I can't delete or the Trash is actually empty but for some reason it show that it is not and won't let me Empty it.
    Tried restarting computer multiple times but still nothing.
    Help!

    Unfortunately don't have any other macs around here.
    When I did Disk Utility then only Verify Disk and Repair Disk buttons are active. Verify Disk Permissions and Repair Disk Permissions buttons are not active at all. Don't know why is that. I assumed that they werent supposed to be active  with external harddrives as my other external harddrive which seems to be ok, when I mount it, then last 2 buttons I metioned also are not active. But if you say to use Repair Disk Permissions then something must be wrong with both of my external harddrives?
    Anyway the external drive which Im concerned with right now  (the trash won't empty), when I did Verify Disk and Repair Disk then got this:
    Verifying volume “MY PASSPORT”
    ** /dev/disk1s1
    ** Phase 1 - Preparing FAT
    ** Phase 2 - Checking Directories
    ** Phase 3 - Checking for Orphan Clusters
    10158 files, 132201376 KiB free (4131293 clusters)
    Verify and Repair volume “MY PASSPORT”
    Error: Could not unmount disk
    Verifying volume “MY PASSPORT”
    ** /dev/disk1s1
    ** Phase 1 - Preparing FAT
    ** Phase 2 - Checking Directories
    ** Phase 3 - Checking for Orphan Clusters
    10156 files, 132201472 KiB free (4131296 clusters)
    Verify and Repair volume “MY PASSPORT”
    Error: Could not unmount disk

  • Show row/column with empty dimension values.

    I have 2 columns where 1 column is dimension and 1 column is measure.  I need to hide the row when the dimension is empty.
    What I did is at the block I UN-TICK  "Show row/column with empty dimension values".  But it didnt works.
    Thanks.

    click on the block and add a filter with condition dimension isnotnull. this will eliminate the dimension rows with empty values.
    Thanks,
    karthik

  • Sum is showing up as an empty cell in Hyperion Financial Reporting

    Hi guys,
    I am using Financial Reporting 9.3.
    I have a cell which represents sum of three cells [d]= [a]+[c]+[e],
    [a] is an empty cell, though [c], [e] have values, [d] is showing up as an empty cell.
    Any ideas to fix this???
    Edited by: user8716722 on Aug 12, 2009 9:25 AM
    Edited by: user8716722 on Aug 12, 2009 9:27 AM
    Edited by: user8716722 on Aug 12, 2009 9:27 AM

    hi,
    Did you define the values for the No data as "0" and tried running the report?
    Thanks!

  • My bookmarks are all still there, but 'Show all bookmarks' is empty and so is 'Bookmark this page Folder Choose'.

    I have installed FF 4.0 on home and office PCs (both Windows XP). Bookmarks are synced between them using FF Sync 1.7. Until a couple of days ago, no problem. But now something weird has happened to the bookmarks on my home PC.
    All the bookmarks are there - I can select them normally from the BM toolbar and the BM menu, and they are found by the address bar.
    However, I can no longer organise my bookmarks. When I choose 'Show all bookmarks' the All Bookmarks folder appears completely empty. When I add a new bookmark, the Choose folder dialog shows a small, apparently random selection of my bookmark folders, and the Choose drop-down doesn't show any folders at all.
    I have tried restoring bookmarks from several days ago and also from the office machine. In both cases restore worked fine, but it still only populates the Bookmark menu and not the Show all/Organise folder.

    This looks like a duplicate of https://support.mozilla.com/en-US/questions/835014#answer-201724
    Backup of bookmarks, deletion of places.sqlite, and restoration of bookmarks solved it for me.

  • Show Photo Settings VS Emptying Trash?

    Am very confused about implications of emptying the trash in iMovie (6hd) ...
    I've done a movie which is really just photos with effects, motion, music.
    It SEEMS, as if it's no longer possible to display a preview of a motion photo (Ken Burns effect) once the trash has been emptied.
    I'd Like to be able to delete the experiments, and truly removed clips - but keep the clips truly in the movie - so that they remain editable. (with a preview)
    ANY ideas? My trash is growing enormous.
    Alix
    ASIDE & WARNING:
    Also, I noticed quite a bit of degradation on 'motion' photo's that had multiple edits(This was not evident till DVD was played). And found the only way to restore quality was to replace the old "clip" with orig photo with same effect recreated. -- has any one else noticed this? IS it related to emptying trash - which seems to store original photo?
    PMacQuad, PMac Quicksilver, PBook G4 Titanium, iMacDV SE   Mac OS X (10.4.4)   10.38 ->10.45

    It SEEMS, as if it's no longer possible to display a
    preview of a motion photo (Ken Burns effect) once the
    trash has been emptied.
    Good catch. Yes, there's a bug in iMovie 6 (not in iMovie 5) that discards the source image if the Ken Burns checkbox is ON when the image was imported. If you empty the iMovie trash, you can't later update the rendered clip.
    http://discussions.apple.com/thread.jspa?messageID=2139814&#2139814
    I'd Like to be able to delete the experiments, and
    truly removed clips - but keep the clips truly in the
    movie - so that they remain editable. (with a
    preview)
    If by experiments you mean images that you've imported but no longer want to keep then Yes, you can delete them like any other clip and empty the iMovie trash.
    iMovie 5 and iMovie 6 use non-destructive editing of clips. That means you can always restore a clip to its original length. If you import a 5-minute clip and split it into three parts, each of the three clips can be restored to the length of the original clip. If you screw up, recovery is just a few mouseclicks away.
    In iMovie 4, if Clips 1, 2 and 3 share the same source file, trashing Clip 2 will remove its frames from the source file, shortening the file. You will recover that disk space when you empty the iMovie trash.
    That's not how it works in iMovie 5/6. When you empty the trash the source file is NEVER shortened, for Clips 1 and 3 must be restorable to the full length of the original clip. If other clips use that source file, no disk space is recovered because no frames are removed from the source file.
    Disk space is only recovered when you discard the LAST clip of a source file. Then iMovie HD discards the entire file.
    When it does that, note that iMovie 5/6 moves the file to the Mac Trash (in the Finder). So you must empty the Mac Trash too to recover the disk space.
    BTW, you can pretty much ignore the Trash numbers reported by iMovie HD. It's reporting the size of the source file, which may or may not actually be discarded.
    There are pros and cons to non-destructive editing, of course. The biggest disadvantage is that we recover less disk space. The advantage is we can always restore a clip -- even when Copying and Pasting clips between projects.
    There's also improved reliability. When emptying the Trash in iMovie 5/6, we no longer see the project corruption we sometimes saw in iMovie 2/3/4.
    Fortunately, large FireWire drives are cheap and getting cheaper. (You may need one, by the way, for your drive is very full. Best advice I hear is to leave at least 10% empty or Mac OS X itself can get into trouble.)
    If that's not an option, one solution is to export the iMovie HD project back to the camera, then re-import it to a new project. The new project won't contain the discarded stuff.
    ASIDE & WARNING:
    Also, I noticed quite a bit of degradation on
    'motion' photo's that had multiple edits(This was not
    evident till DVD was played). And found the only way
    to restore quality was to replace the old "clip" with
    orig photo with same effect recreated. -- has any
    one else noticed this? IS it related to emptying
    trash - which seems to store original
    photo?
    See bug above.
    Also be aware of an iMovie 4/5/6 bug that adds jaggies to photos that were NOT rendered by the Ken Burns Effect when importing the image. If iMovie asks permission to render the stills later, it adds jaggies to the video it renders. That will show up on the DVD.
    http://discussions.apple.com/thread.jspa?messageID=2105598&#2105598
    Karl

  • 75% of my messages when selected show proper header, but empty main body?

    most of the messages arriving in my inbox, look normal in the message list area, but when selected, the correct header shows, but nothing follows - i.e. the body of the message is empty. i import from gmail and hotmail - both are affected. odd;y. as i said, this is only for 3/4 the messages. an apparent 1/4 are fine. thoughts?

    fixed itself?

  • Out of the blue some of my event folders now fail to show the thumbnails, just empty frames? whats up with that?

    for some reason, some of my event folders are blank on the events page and the event folders no longer show the thumbnails, just hash-mark empty frames. This is just a few events all of a sudden out of many events. Any idea whats going on and how to fix it? Thanks

    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Include the option to rebuild the thumbnails. It can take 3 or 4 goes for this to work

  • Video(s) on wb page show up as a blck rectangle

    Whenever (85% of the time) a video is supposed to show on the web page, all I get is a blank rectangle. I have to copy the URL and go to the IE browser where the video plays as intended.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    *http://kb.mozillazine.org/Resetting_preferences
    *https://support.mozilla.com/kb/Resetting+preferences

  • Why won't the text show on top of a rectangle?

    When I use the rectangle frame tool to make a box and then put a text box on top it doesn't let the text show.
    This first picture is of my text box off the side, and then the yellow box I'm trying to put the text on top of, the second picture is what it shows me when I try to do that. It will show the text anywhere as long as it's not on top of a box and I can't figure out why or how to change it.
    Thank you in advance for your help!

    Select your rectangle and turn off the Text Wrap
    or
    Select your text box and set it to Ignore Text Wrap
    or
    in your preferences, set Text Wrap Affects Only Items Beneath. (not sure of the wording, but that's the jist.)

Maybe you are looking for

  • MacBook Pro 2.3 os 10.6.8 control-C and Control-v don't work

    On MacBook Pro 2.3 OS 10.6.8, control-c and control-v don't work in any app Please help

  • Can we return a value in two field based on a value select in LOV?

    Hello expert. i have a lov attached to a non-bind text field. when i select a value from non bind field lov, a record group of another LOV attached to a database item field generated. both text field are in same block. LOV record group query of non-b

  • Create a object in form of circle, line, triangle or other shapes

    i am trying to make a program that creates simple objects, its just a hobby. the problem is i am trying to make an object that is only a line(for now). i mean i want to have an object that can be in a shape of anything in any angle. i like to be able

  • Look  it........

    I want to create a tree structure by the node of a xml..with the help of xslt.. how i will generate the node tree stucture display in a html??? anyone pls help me

  • Renaming Images from Text File

    Hello, I am trying to rename images in a folder to match the names within in a text file. The names in the text file are all unique, so using a rename batch like example-1.jpg, example-2.jpg, etc. won't work. I have matched the structure between both