• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
shyam shridhar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic