🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2061

GUI problem

#2061
From: Andrew "Bass" Shcheglov
Date: Sun, 03 Jun 2001 22:40
54 lines
2856 bytes
Hi everyone!

The problem is as follows.
There're two classes:

public class MyFrame extends JFrame
{
    public MyFrame()
    {
        ...
    }
    public void someFunction()
    {
        MyDialog dlg = new MyDialog(this);
        dlg.setModal(true);
        dlg.show();
    }
}

public class MyDialog extends JDialog
{
    public MyDialog(Frame parent)
    {
        super(parent);
        ...
        someOtherFinction();
    }

    /**
     * This function doesn't return for a long time, as it performs
some complex math operations.
     */
    public void someOtherFunction()
    {
        ...
    }
}

The first class represents my application's main frame. The second one
is a dialog which may be called as a child of the main frame. But this
dialog is being constructed for quite a long time (due to
someOtherFunction() working -- see code above) -- about 30 seconds on
my CPU. As a result, parent window is not being repainted. I need to
explicitly repaint the main frame (parent window) from within
someOtherFunction() (it contains a cycle). But standard methods such
as revalidate() and repaint() do not help. Note: when the parent needs
repainted, the child is not constructed yet.

Who knows, how I can fix this problem without dealing with threads?

Any suggestions will be appreciated.
Thanks in advance.

        Andrew.
Technical Details
Message-ID: <9feega$11u2$1@news.radio-msu.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!Radio-MSU.net!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,63855ae8d254f894,start
X-Google-Attributes: gid111d45,public
X-Google-Thread: 10fd6d,63855ae8d254f894,start
X-Google-Attributes: gid10fd6d,public
X-Google-Thread: 1089d0,63855ae8d254f894,start
X-Google-Attributes: gid1089d0,public
X-Google-Thread: 10a146,63855ae8d254f894,start
X-Google-Attributes: gid10a146,public
X-Google-Thread: f74b3,63855ae8d254f894,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-03 15:44:02 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!Radio-MSU.net!not-for-mail
From: "Andrew \"Bass\" Shcheglov" <bass@2ka.mipt.ru>
Newsgroups: borland.public.jbuilder.java.api,borland.public.jbuilder.java.language,borland.public.jbuilder.java.swing,comp.lang.java.gui,comp.lang.java.programmer
Subject: GUI problem
Date: Mon, 4 Jun 2001 02:40:10 +0400
Organization: MIPT
Lines: 55
Message-ID: <9feega$11u2$1@news.radio-msu.net>
NNTP-Posting-Host: bass.2ka.mipt.ru
Mime-Version: 1.0
Content-Type: text/plain;
 charset="koi8-r"
Content-Transfer-Encoding: 7bit
X-Trace: news.radio-msu.net 991608139 34754 194.85.82.46 (3 Jun 2001 22:42:18 GMT)
X-Complaints-To: usenet@radio-msu.net
NNTP-Posting-Date: 3 Jun 2001 22:42:18 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400