JDialog over Desktop area - java

I am trying to use a JDialog at the right of the screen, everything is almost perfect, but, if someone press the button on ther right end of the TaskBar, click on "Show Desktop area" my JDialog disappears I have to use ALT + TAB to get it back in in front. I can't set it AlwaysOnTop because I use other 3rd party programs that are fullscreen.
I tried:
jdigCentral.setAutoRequestFocus(true);
jdigCentral.setAlwaysOnTop(true);
and others, but without success
How can I have my JDialog to stay over just the Desktop Area?

Is jdigCentral your dialog box? If so then try this:
jdigCentral.setModal(true);
That will keep the dialog box on top of the parent JFrame. But I'm confused about the use of the word Desktop Area. Do you mean you want to keep the dialog box on top of the parent frame, or do you want it to always show on top of all other programs running on your desktop?

Related

Java Eclipse Application Window

When I go into the design panel of an Application Window class and I want to put a button, or rather anything I can't put it where I want it. It let's me to choice 1 of the 5 sides(top,right,left,center) and the button is as large as the whole panel.
What can I do?

Prevent JavaFX Window from Stealing Focus

I'm trying to make an overlay on the screen using JavaFX and an issue I'm having is that whenever my overlay pops up, it steals focus from whichever program I'm currently in. The issue with this is that my overlay allows the user to simulate keyboard key presses using the robot class (like an on-screen keyboard) and without keeping the focus in the original window, the typed characters have nowhere to go. I've tried setting the modality to none, but that's also the default option and it doesn't seem to be doing anything. Would putting my JavaFX scene in a JFrame work or is there some better way to do it only in JavaFX?
Try this
when focused -> compute what you want to
then call Stage.toBack(); //the currently focused window prior to yours will gain focus back

Java Swing: JOptionPane appears by itself without parent window when restored?

I have a JOptionPane which appears on top of it's parent JFrame window, but when the application is minimized and restored, only the JOptionPane will show and not the parent JFrame.
How to fix this bug?
JOptionPane is a modal dialog box.
It means first you need to handle/close this dialog box then you will be able to access your main window.
So when you minimize everything and then restore it, it firstly shows the JOptionPane when you will close it or what it is supposed to do ONLY then you will get the main window.
It's not a bug. It is just how modal things work.
You will not be able to even Minimize the main window from icon when JOptionPane is up. You can minimize everything like with Window + D key or Window + M key in Windows PCs.

How do I make dynamic windows in Swing?

I have a general question. I would like to have a window containing some buttons, radio buttons, text fields and so on. So, user can do something (write text, select options and press buttons). As the result of the user activity window should change it structure/appearance some element should disappear and some appear.
How do I program such "updates"? Should I close an old window and open a new one or I can modify content of window without closing it?
After adding your components or such, calling revalidate() on your container will do the updates

How do I get "Goodbye Window" to show up in Java?

I have a Java network application and this is what I want to do:
After user logs out, his interface window closes.
Now, I want for another window to show up that will say something like: "Thank you for using our application".
This final window should be borderless and without any available option, more like a plain picture (jpeg? why not?). By clicking on it, user will be sure to close this final window.
I googled and couldn't fin anything on this matter, it's hard to phrase the question.
I hope someone helps me...
https://docs.oracle.com/javase/1.5.0/docs/api/javax/swing/JWindow.html
A JWindow is a borderless, undecorated JFrame (no titlebar or buttons).
This should be what you need.
This should help:
http://java.sun.com/docs/books/tutorial/uiswing/events/windowlistener.html
You're interested in the windowClosing and windowClosed events
You have various possibilities, depending on when you want this dialog to display :
if you want it to display juste before the app closes, use addShutdownHook
if you want it to display when the last window closes, use addWindowListener
You can then use a JWindow with your image inside, and use addMouseListener to wait for the user to click on it.

Categories

Resources