Questions tagged [jdialog]

The main Java Swing class for creating a dialog window.

The main Java Swing class for creating a dialog window.
A Dialog window is an independent subwindow meant to carry temporary notice apart from the main Swing Application Window. Most Dialogs present an error message or warning to a user, but Dialogs can present images, directory trees, or just about anything compatible with the main Swing Application that manages them.

1021 questions
5
votes
1 answer

How to properly destroy a JDialog?

I'm currently working on an application for work that has a main JFrame that always exists. I currently have a child JDialog that shows up on a button press. This frame has a JMenu with an item to "log out of the display." I've been tasked to ensure…
lordoku
  • 908
  • 8
  • 22
5
votes
2 answers

Can I keep a JDialog from closing on escape/enter press?

I created a dialog to take user keystrokes to change key bindings for menu items. I'd like enter and escape to be keys the user can bind, but they both close the dialog. How can those presses be intercepted? Edit: dialog is created with JOptionPane…
sam
  • 97
  • 9
5
votes
2 answers

Retrieve input entered in a JDialog

I extended JDialog to create a custom dialog where the user must fill some fields : How should I retrieve the data entered ? I came up with a solution that works. It mimics JOptionPane but the way I do it looks ugly to me because of the static…
Jules Olléon
  • 6,733
  • 6
  • 37
  • 47
5
votes
2 answers

How is this Swing code working?

I see the following code in a Java/Swing GUI project: MyDialog dlg = new MyDialog(parent, isFizz); MyDialogResults results = dlg.getResults(); eventBus.fireEvent(new MyDialogEvent(results)); In the code above, MyDialog extends JDialog. So clearly,…
user1768830
5
votes
3 answers

Java, how can I popup a dialog box as only an image?

I'm trying to find a way to replace all the contents of a JDialog to simply an image. It's for the about page of a project I'm working on and I want when the user clicks on the About section, an image to popup in the style of a JDialog(and to…
martin
  • 1,007
  • 2
  • 16
  • 32
5
votes
1 answer

swing focus issue, lost focus, focusgain not invoked

I have a complex and heavy swing client application which contains many modal compponents, jdialogs, internal frames etc. on some cases, a problem occurs and it is impossible to focus on swing textfields anymore. You may click on some jbuttons,…
benchpresser
  • 2,171
  • 2
  • 23
  • 41
5
votes
1 answer

Safely open and close modal JDialog (using SwingWorker)

I needed a way to get some data from a database and prevent the user from modifying existing data for that moment. I created a SwingWorker to make the db update and a modal JDialog to show user what is going on (with a JProgressBar). The modal…
user1713059
  • 1,425
  • 2
  • 17
  • 34
5
votes
3 answers

JDialog - Refresh dynamically added nodes in JTree

I have a problem with JTree nodes visibility I use for my JDialog. When I want to add new node to the model the Jtree is not refreshed. Strange is the nodes are updating just as they should if I set setRootVisible(true). Here is the code. Thanks in…
bioMind
  • 171
  • 1
  • 2
  • 9
5
votes
1 answer

How to wait for a JFrame to close before continuing?

My program consists of 3 main 'sections'. Main function, Login form and App form. The main function should do something like: Open Login form, wait for it to close, then open App form. I can't get the waiting part to work, or rather, I don't know…
argoneus
  • 1,097
  • 2
  • 13
  • 24
5
votes
4 answers

How to add components to JDialog

d1=new JDialog(); d1.setSize(200, 100); t1=new JTextField(); t1.setBounds(10,10,40,20); d1.add(t1); I want to add components in JDialog such as TextField, Button...
uday gowda
  • 609
  • 3
  • 10
  • 16
5
votes
2 answers

How to get parent for JDialog from JPanel

In my Swing app. I have a JFrame with few JPanels. One of it I use for placing another panels. And one of these - another panel - calls a JDialog. Constructor of dialog accepts Frame, String and Boolean as parameters. My problem is how to get parent…
user1420504
  • 55
  • 1
  • 1
  • 4
5
votes
1 answer

Setting JDialog opacity by Timer

I am using the following code to fade-in a JDialog with a javax.swing.Timer: float i = 0.0F; final Timer timer = new Timer(50, null); timer.addActionListener(new ActionListener() { @Override public void…
Asif
  • 4,980
  • 8
  • 38
  • 53
5
votes
2 answers

`WindowListener` acting up, perpetual firing

I have an application with an abstract class that extends JDialog. The class as an abstract void onClose(), and, in the class's constructor, the following code is added: addWindowListener(new WindowAdapter() { @Override public void…
wchargin
  • 15,589
  • 12
  • 71
  • 110
4
votes
2 answers

setDefaultCloseOperation not working in Swing

I need to stop the default operation of window being closed when red x mark is clicked on the swing window. I am using the JDialog and adding WindowsListener to it to capture the WindowClosing event, there I decide whether to dispose JDialog or to…
Gaurav
  • 1,570
  • 4
  • 20
  • 25
4
votes
1 answer

No WindowEvent on closing a JDialog

I display a JDialog in a JFrame. This JDialog does nothing on dispose. I would like to catch the closing event and display a Popup but nothing happens. I cannot find the bug. Could you tell me where the problem is? Thanks a lot! import…
Maxbester
  • 2,435
  • 7
  • 42
  • 70