开发者

Minimizing the application in windows problem

开发者 https://www.devze.com 2023-03-31 07:23 出处:网络
I\'ve wrote a simple application to store some text in a derby DB. I have 2 button each one creating a new inputDialog. My problem is that when I run the program on my Ubuntu PC all is well. When I ru

I've wrote a simple application to store some text in a derby DB. I have 2 button each one creating a new inputDialog. My problem is that when I run the program on my Ubuntu PC all is well. When I run it on a windo开发者_如何学Cws 7 PC when the input dialog is displayed the whole thing is minimized and hidden from the user. So each time I want some input from the user he has to restore the application. And the other problem is that the program doesn't appear in the alt-tab menu too. Here is the code that I use to display the dialog:

String s = (String) JOptionPane.showInputDialog(this, "Моля въведете име:");

All help will be greatly appreciated.


I tried the following code - directly from main() via eclipse running on Windows 7 64-bit. The JFrame remains on display, even if I try otherwise.

JFrame f = new JFrame();
f.setSize(750, 500);
f.show();

JOptionPane.showInputDialog(f, "hello", "there");
System.out.println("hi");

Try this, and if you get the same result then at least we know it's a windows issue that we're dealing with rather than a Java issue.

EDIT:

After looking through your code, I found the offending line. Also as a side note, you should generally call setVisible() after you have done configuring your window. This is especially true with my code, as it would throw an exception if you try to call setUndecorated() after you have displayed the window.

Your Code:

this.setVisible(true);           //This should be called after you finish configuration
device.setFullScreenWindow(this); //This is the problem!!!

Instead you should use:

this.setExtendedState(JFrame.MAXIMIZED_BOTH);
this.setVisible(true);

If you want to have your window fullscreen then use:

this.setUndecorated(true);
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
this.setVisible(true);
0

精彩评论

暂无评论...
验证码 换一张
取 消