Results 1 to 8 of 8
- 09-27-2012, 09:32 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 11
- Rep Power
- 0
Dialogs extending JDialog - entwine them with the root pane
Hi there.
Sorry for the confusing title, it is difficult to describe in just a few words.
The issue is this: I coded some JDialogs and when I switch windows (e.g. to another program and back) the rootPane is no longer visible, only the dialog. Is there a way to keep displayed both at all times?
Thanks in advance
Mirek
- 09-27-2012, 10:35 AM #2
Re: Dialogs extending JDialog - entwine them with the root pane
Impossible to guess with so little information. Could be a case of a wrong approach to custom painting, or failure to respect Swing's single threaded rule, or using a defective JRE like GNU/GCJ (non-)Java, or just about anything.
To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-27-2012, 11:56 AM #3
Member
- Join Date
- Nov 2011
- Posts
- 11
- Rep Power
- 0
Re: Dialogs extending JDialog - entwine them with the root pane
OK, here is simplified version of one of the dialogs in question:
on the main form I call:Java Code:import java.awt.Dimension; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.WindowConstants; public class TestDialog extends JDialog { JButton btnOk = new JButton("Show choices"); Dimension dim; public TestDialog(){ super(); setModal(true); setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS)); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); } public void getChosenTerritory(){ displayChoices(); dispose(); } /** * Builds UI and fills the task text * and Capital choices */ private void displayChoices(){ getContentPane().add(btnOk); pack(); final int RESERVE = 50; int width = RESERVE; int height = getPreferredSize().height; dim = new Dimension(width, height); setMinimumSize(dim); setBounds(MainRiskForm.centerBounds(dim)); setVisible(true); } }
Is it alright this way?Java Code:TestDialog dial = new TestDialog(); dial.getChosenTerritory();
- 09-27-2012, 12:48 PM #4
Re: Dialogs extending JDialog - entwine them with the root pane
I gave you a link to the SSCCE web page in the expectation that you would go through it and not post uncompilable, non-executable snippets. It appears I was wasting my time.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
-
Re: Dialogs extending JDialog - entwine them with the root pane
Your code doesn't explain the misbehavior your describing. I agree with Darryl in that the best way for us to be able to help you is if you can post a *minimal* program that compiles and runs and demonstrates your problem. If we can't reproduce your behavior, it's much less likely that we'll be able to help you. On the other hand, we don't want to be drowning in code, most of it unrelated to the problem. This whittling down the program to expose the misbehavior will take quite a bit of work on your part, but it won't be work wasted, and in fact in all likelihood following through with this exercise will likely lead you to discovering the problem and its solution without our help.
- 09-27-2012, 02:26 PM #6
Member
- Join Date
- Nov 2011
- Posts
- 11
- Rep Power
- 0
Re: Dialogs extending JDialog - entwine them with the root pane
Sorry, here is the complete SSCCE project:
https://dl.dropbox.com/u/108807093/SSCCE.7z
- 09-27-2012, 02:34 PM #7
Member
- Join Date
- Nov 2011
- Posts
- 11
- Rep Power
- 0
Re: Dialogs extending JDialog - entwine them with the root pane
So, I believe I made a sufficiently simple program. Expected behaviour is this:
when I click the button and the dialog shows itself, I run Firefox for example, and when I switch back to the program I would like to see the mainform too.
But all I get is the modal dialog.
Can you see what is wrong? Can I fix it or do I need to use different approach than modal JDialog?
- 09-27-2012, 02:49 PM #8
Member
- Join Date
- Nov 2011
- Posts
- 11
- Rep Power
- 0
Similar Threads
-
Using Dialogs to display text
By tipz in forum AWT / SwingReplies: 3Last Post: 05-10-2011, 11:10 AM -
Custom graphics on dialogs, etc.
By trader5050 in forum New To JavaReplies: 1Last Post: 11-24-2010, 07:29 AM -
Communicating between Dialogs and Frames
By frejon26 in forum Threads and SynchronizationReplies: 1Last Post: 05-23-2010, 05:49 AM -
How do I get all dialogs?
By zenteo in forum AWT / SwingReplies: 6Last Post: 03-08-2010, 10:01 PM -
Passing data between dialogs
By Wintery in forum New To JavaReplies: 7Last Post: 01-02-2009, 05:35 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks