seems like such a silly question...
but I have the code listed below, but for some reason my JLabel is not
showing up in the JDialog... I dont know what the problem is... do
you?
JDialog jdgOpening = new JDialog(this, "Opening File......");
JLabel lblOpen = new JLabel("Please wait, opening file...");
jdgOpening.getContentPane().setLayout(new FlowLayout());
jdgOpening.getContentPane().add(lblOpen);
jdgOpening.setPreferredSize(new Dimension(200,80));
jdgOpening.setSize(new Dimension(200,80));
jdgOpening.setResizable(false);
jdgOpening.setVisible(true);
tiewknvc9 schrieb:
> seems like such a silly question...
>
[quoted text clipped - 10 lines]
> jdgOpening.setResizable(false);
> jdgOpening.setVisible(true);
what do you do after setting this dialog visible? If you don't work in a
second thread the gui freezes until you finished opening the file. So
when the label get's displayed the file is finished opening and the
label is imediately disappeering from screen with your dialog...
lg
Nomike aka Michael Postmann
tiewknvc9 - 26 Jul 2006 15:57 GMT
Ah yes...
Ok so here's what I did to avoid making a second thread for something
this little.
After adding my jlabel to the jdialog object, I called
lblOpen.paintImmediately(0,0,200,80);
this made the screen refresh. I would have considered something more
complex, but it is typically only visible for a 2 or 3 seconds.
Thanks for the help!
> tiewknvc9 schrieb:
> > seems like such a silly question...
[quoted text clipped - 19 lines]
> lg
> Nomike aka Michael Postmann
tiewknvc9 - 26 Jul 2006 15:57 GMT
Ah yes...
Ok so here's what I did to avoid making a second thread for something
this little.
After adding my jlabel to the jdialog object, I called
lblOpen.paintImmediately(0,0,200,80);
this made the screen refresh. I would have considered something more
complex, but it is typically only visible for a 2 or 3 seconds.
Thanks for the help!
> tiewknvc9 schrieb:
> > seems like such a silly question...
[quoted text clipped - 19 lines]
> lg
> Nomike aka Michael Postmann
> seems like such a silly question...
>
[quoted text clipped - 10 lines]
> jdgOpening.setResizable(false);
> jdgOpening.setVisible(true);
It cannot be compiled, because setPreferredSize
isn't method of JDialog, but JComponent.
Without that line it works fine.
tiewknvc9 - 26 Jul 2006 15:59 GMT
fyi - it is valid in jdk 1.5
> > seems like such a silly question...
> >
[quoted text clipped - 14 lines]
> isn't method of JDialog, but JComponent.
> Without that line it works fine.
Andrew Thompson - 26 Jul 2006 19:16 GMT
> fyi - it is valid in jdk 1.5
Please refrain from top-posting - it is most confusing.
It might have been useful to post a compilable source, and
to mention that your snippets were compiled within a 1.5
SDK.
A quick scan of the code fragments you have posted,
with constant calls to setPreferredSize() and setSize(),
together with needing to set the preferred size of the
JDialog itself, and compounded by the need to call
paintImmediately() at all, indicates your GUI is in serious
trouble - and will probably not survive a different ..
- Platform
- PLAF
- Java Release
- End user settings or screen size/resolution.
If you post compilable code, we can begin to fix the problems.
Andrew T.