Button for closing a JDialog

import java.awt.event.*; import javax.swing.*; public class YourDialog extends JDialog implements ActionListener { JButton button; public YourDialog() { button = new JButton(“Close”); button.addActionListener(this); add(button); pack(); setVisible(true); } public void actionPerformed(ActionEvent e) { dispose(); } } close only dialolg using dispose() method parent frame not closed. reason that JVM not terminated.

Show JDialog on Windows taskbar

I found the answer to your question because I had the opposite problem. I had a JDialog that was showing in the taskbar and it took me forever to figure out how to prevent it from showing. Turns out if you pass a null parent to the JDialog constructor, your dialog will show in the … Read more

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

Closing a window (with dispose()) and hiding it (with setVisible(false)) are different operations, and produce different events — and closing it from the operating system is yet another different operation that produces yet a different event. All three will produce windowDeactivated to tell you the window’s lost focus, but dispose() will then produce windowClosed, while … Read more

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

I generally do it like this: Dialog dlg = new Dialog(this, …); Value result = dlg.showDialog(); The Dialog.showDialog() function looks like this: ReturnValue showDialog() { setVisible(true); return result; } Since setting visibility to true on a JDialog is a modal operation, the OK button can set an instance variable (result) to the chosen result of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)