This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Child Window(JDialog) hide when using with fixed screen resolution    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Child Window(JDialog) hide when using with fixed screen resolution    " Watch "Child Window(JDialog) hide when using with fixed screen resolution    " New topic
Author

Child Window(JDialog) hide when using with fixed screen resolution

shyam shridhar
Ranch Hand

Joined: Sep 15, 2006
Posts: 31
Hello,

I am making my project resolution specific.
It means my project always running in 1024*768 screen resolution whatever is system resolution that does't matter.


But I am facing a critical problem when i running my project and on click any button a new pop up window(JDialog) open when i move slightly move JDialog than JDialog is make invisible after moving mouse over and over JDialog some part of JDialog is visible to me.

I am try setOpaque and many differnet option but my problem is not solve.

check the following code if found any solution then please response me it's urgent :

GraphicsDevice graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

GraphicsConfiguration graphConfig = graphicsDevice.getDefaultConfiguration();

DisplayMode displayMode = new DisplayMode(1024, 768, 32,DisplayMode.REFRESH_RATE_UNKNOWN);

JFrame mainframe = new JFrame("",graphConfig);

graphicsDevice.setFullScreenWindow(mainframe);


Thank you very much in advance.

if(graphicsDevice.isDisplayChangeSupported()){
graphicsDevice.setDisplayMode(displayMode);
}
mainFrame.setVisible(true);
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
for something like this you are far better off posting a sample program
that demonstrates the behavior.

something we can copy/paste/compile/run and see for ourselves
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

If you are using full screen exclusive mode you can't open any windows/dialogs/etc. From the JavaDocs for GraphicsDevice.setFullScreenMode() -

If isFullScreenSupported returns true, full screen mode is considered to be exclusive, which implies:

* Windows cannot overlap the full-screen window. All other application windows will always appear beneath the full-screen window in the Z-order.


You'll need to "fake" a dialog and paint it in the same frame, but on top of existing components. Painting to the Glass Pane would probably simulate a dialog well.
[ September 15, 2006: Message edited by: Nathan Pruett ]

-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
shyam shridhar
Ranch Hand

Joined: Sep 15, 2006
Posts: 31
Hi Nathan,

Thanks for reply.
I actually forget that i submit problem on this forum also.
Now I try to do which you told.Till then you check this Sample Code

sample code:

package window;

import java.awt.Color;
import java.awt.DisplayMode;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;

import javax.swing.JDialog;
import javax.swing.JFrame;

public class Light1 {
JFrame m = null;
JDialog di = null;

public Light1() {

GraphicsDevice graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
GraphicsConfiguration graphConfig = graphicsDevice.getDefaultConfiguration();

DisplayMode origDisplayMode = graphicsDevice.getDisplayMode();

DisplayMode displayMode = new DisplayMode(1024, 768, 32,origDisplayMode.getRefreshRate());

m = new JFrame("",graphConfig);

m.setBackground(Color.red);
graphicsDevice.setFullScreenWindow(m);

if(graphicsDevice.isDisplayChangeSupported()){
graphicsDevice.setDisplayMode(displayMode);
}
di = new JDialog(m,"");
di.setSize(400,400);
di.setVisible(true);
m.setVisible(true);
}

public static void main(String ar[]) {
Light1 l= new Light1();
}

}
shyam shridhar
Ranch Hand

Joined: Sep 15, 2006
Posts: 31
Nathan Pruett
>You'll need to "fake" a dialog and paint it in the same frame, but on top >of existing components. Painting to the Glass Pane would probably >simulate a dialog well.

I can't understand meaning of above line. I try to do with GlassPane but i am failed to achived my goal.

a early and good response will be very help full for me.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I modified the above code you posted to give an idea of how I was thinking of using the glasspane to fake a dialog...

It's not great code, but should give you an idea of what to do...

You can press space to display the dialog, press the button on the dialog to close it, and press ESC to exit the app.


[ September 21, 2006: Message edited by: Nathan Pruett ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Child Window(JDialog) hide when using with fixed screen resolution