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.

1000 questions
47
votes
6 answers

How can I return a value from a JDialog box to the parent JFrame?

I have created a modal JDialog box with a custom drawing on it and a JButton. When I click the JButton, the JDialog box should close and a value should be returned. I have created a function in the parent JFrame called setModalPiece, which receives…
Rolan
  • 2,452
  • 5
  • 32
  • 41
46
votes
6 answers

Java - How to create a custom dialog box?

I have a button on a JFrame that when clicked I want a dialog box to popup with multiple text areas for user input. I have been looking all around to try to figure out how to do this but I keep on getting more confused. Can anyone help?
Corrie
34
votes
5 answers

How do I close a JDialog and have the Window Event Listeners be notified?

Is there a way to close a JDialog through code such that the Window event listeners will still be notified? I've tried just setting visible to false and disposing, but neither seem to do it.
Jeff Storey
  • 53,386
  • 69
  • 224
  • 390
30
votes
4 answers

Show JDialog on Windows taskbar

I'm trying to display a JDialog in Windows. How do I show a JDialog (like JFrame) on my Windows taskbar?
or123456
  • 1,563
  • 7
  • 22
  • 44
29
votes
4 answers

What is the difference between a JFrame and a JDialog?

What is the difference between a JFrame and a JDialog? Why can't we use setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); for a JDialog?
Mahdi_Nine
  • 11,985
  • 25
  • 78
  • 112
28
votes
5 answers

Button for closing a JDialog

I want to add a button (JButton) at the bottom of a JDialog which should close the JDialog when pressed. The problem is I don't know what to write in the ActionListener of that button. I don't want the button to exit the program, just close the…
SoboLAN
  • 283
  • 1
  • 3
  • 4
25
votes
3 answers

Dynamically Add Components to a JDialog

I am having trouble adding JComponents to a JDialog when the user clicks a button on the JDialog. Basically I want it to look like this: Then, when the user clicks "Add New Field" I want it to look like this: I cannot seem to get the dialog to add…
NeilMonday
  • 2,520
  • 2
  • 23
  • 29
23
votes
4 answers

JDialog setVisible(false) vs dispose()

Does it make sense to use setVisible(false) on a dialog and reuse it later or is safer to call dispose() every time and to make a new JDialog. What about memory leaks with setVisible(false)? EDIT: My Question isn't so much about quitting the…
keuleJ
  • 3,060
  • 3
  • 26
  • 47
21
votes
2 answers

Java listener on dialog close

I have a Java app that displays a list from a database. Inside the class is the following code to open a new dialog for data entry: @Action public void addNewEntry() { JFrame mainFrame = ADLog2App.getApplication().getMainFrame(); …
Woodsy
  • 2,708
  • 2
  • 22
  • 44
19
votes
5 answers

Remove Top-Level Container on Runtime

Unfortunately, it looks like this recently closed question was not well understood. Here is the typical output: run: Trying to Remove JDialog Remove Cycle Done :-) Checking if still exists any of TopLayoutContainers JFrame JDialog …
mKorbel
  • 108,320
  • 17
  • 126
  • 296
19
votes
2 answers

How can Swing dialogs even work?

If you open a dialog in Swing, for example a JFileChooser, it goes somewhat like this pseudocode: swing event thread { create dialog add listener to dialog close event { returnValue = somethingFromDialog } show dialog (wait until it is…
Bart van Heukelom
  • 40,403
  • 57
  • 174
  • 291
19
votes
4 answers

Why does setting JDialog or JFrame setVisible(true) toggle my IME setting?

I found that when I show a JDialog or a new JFrame in my Java swing application will toggle my Chinese Input Method from half-byte mode to full-byte mode in Windows 7. Why does calling the dialog or frame setVisible(true) method toggle my IME…
user2492632
  • 211
  • 1
  • 5
18
votes
4 answers

How do I remove the maximize and minimize buttons from a JFrame?

I need to remove the maximize and minimize buttons from a JFrame. Please suggest how to do this.
silverkid
  • 8,377
  • 20
  • 64
  • 90
16
votes
2 answers

How do I make my SwingWorker example work properly?

I've made my own SwingWorker example to get familiar with how it works. What I'm wanting to do is the following: When the button is clicked I want a progress bar appear until the task is done I want to simply remove the progress bar and add a…
WilliamShatner
  • 926
  • 2
  • 12
  • 25
15
votes
2 answers

When creating a dialog with jquery, how do I hide the dialog div?

I am creating a dialog like in this page: http://jqueryui.com/demos/dialog/#modal-confirmation (click view source) on the bottom is the div that gets placed in the dialog. The dialog works perfect when called by the javascript but the dialog is…
stormist
  • 4,969
  • 11
  • 41
  • 61
1
2 3
66 67