windowlistener Questions
4
Solved
I have a simple GUI:
public class MyGUI extends JFrame{
public MyGUI(){
run();
}
void run(){
setSize(100, 100);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// maybe ...
Patin asked 30/4, 2013 at 8:58
6
Solved
I have a JDialog as the main window in my application (originally it was a JFrame but it showed in the taskbar which I didn't want).
Currently I am doing:
setDefaultCloseOperation(JDialog.DISPOS...
Decalcify asked 25/8, 2011 at 13:36
6
Solved
I want to call a method confirmExit() when the red close button of the title bar of a JFrame is clicked.
How can I capture that event?
I'd also like to prevent the window from closing if the user...
Convoke asked 1/2, 2012 at 9:27
3
Solved
How do I invoke extra operations when the user closes a JFrame window? I have to stop existing threads.
As I understand it, setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); causes the frame to be c...
Delaunay asked 3/6, 2012 at 20:22
7
Solved
I seem to have the reverse problem to most people. I have the following pretty standard code to see if the user wants to do some saves before closing the window:
frame.setDefaultCloseOperation(Wi...
Polarize asked 30/9, 2011 at 16:52
3
I implemented a sample class for a Virtual KeyBoard and ran this VirtualKeyboardTest.The keyboard appears but the main problem is that it is not closing properly when the x button is clicked.How ca...
Serriform asked 5/10, 2012 at 11:6
1
Solved
As a succession to this post I'm running into an infinite loop that causes my computer to crash. Or, well, not quite: it seems to cause the Java window (JFrame) to keep getting focus/getting iconif...
Dubois asked 6/1, 2016 at 11:36
4
I have a Java Desktop application and I would like when the user selects Exit to get a pop-up window that asks him if he wants to proceed with closing the application or not. I know how to make the...
Annular asked 12/12, 2011 at 1:47
4
Solved
void terminate() {}
protected JFrame frame = new JFrame();
How can I get frame to run the terminate function when I press the close button?
Edit: I tried to run this, but for some reason it does...
Kirbykirch asked 4/5, 2013 at 8:28
3
Solved
Is there a way to an event listener to a JFrame object to detect when the user clicks the window maximize or minimize buttons?
Am using the JFrame object as follows:
JFrame frame = new JFrame("Fr...
Chaechaeronea asked 22/6, 2012 at 1:3
3
Solved
I was wondering if there is a way, by clicking on the "X", to let the program perform some code before closing the JFrame. The setDefaultCloseOperation() method takes only an integer.
setDefaultCl...
Venturesome asked 6/5, 2012 at 4:39
1
Solved
mainFrame.addWindowListener(new WindowListener() {
@Override
public void windowClosing(WindowEvent e) {
if (JOptionPane.showConfirmDialog(mainFrame, "Are you sure you want to quit?", "Confirm ...
Davide asked 3/11, 2012 at 8:43
3
Solved
I am making a word processor application in order to practise Java and I would like it so that when the user attempts to close the appliction, a JFrame will come up asking to save changes.
I was ...
Goldeye asked 31/8, 2012 at 7:46
3
Solved
I have a Java GUI application from which another java GUI application is invoked using reflection and loading. It works fine the only problem faced is, on closing the JFrame of invoked application ...
Supercilious asked 2/7, 2012 at 20:28
1
Solved
I'm trying to separate function from state in my GUI application by the use of Action objects. I've been successful in using these to create menu items and buttons that have the same functionality....
Bringhurst asked 8/5, 2012 at 1:37
2
Solved
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 Wind...
Dryad asked 19/4, 2012 at 21:26
2
Solved
On one of my programs, I want a Dialog to appear when the user attempts to exit the application. The user must then choose to save some state of the program, not to save or to cancel the exit opera...
Foss asked 12/2, 2012 at 14:37
2
I want to capture window close(red X right top position) event. I want to display a specified window upon that window based on the event.
Flipper asked 8/1, 2012 at 20:40
1
Solved
I have a class that extends JDialog that have a window listener:
class MyClass extends JDialog {
public MyClass() {
setDefaultCloseOperation( JDialog.DO_NOTHING_ON_CLOSE );
addWindowListener( ...
Precisian asked 30/12, 2011 at 16:13
2
Solved
I'm trying to listen for events on a single Frame via WindowStateListener.
import java.awt.Frame;
import java.awt.Label;
import java.awt.event.WindowStateListener;
import java.awt.event.WindowEve...
Distinctly asked 1/11, 2011 at 5:15
2
Solved
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 = ADLog2Ap...
Dear asked 4/10, 2011 at 19:5
4
Solved
What is a good way to dispose of a JFrame with code like this? I want to handle the Window exit and window close.
I know we shouldn't use System.exit();
public class JavaCellularAutomataSquare {...
Ionian asked 16/8, 2011 at 15:18
2
Solved
I am sorry if this is a n00b question, but I have spent way too long for this once I create the Window listener, window event, and everything else, how do I specify what method to invoke? Here is m...
Swan asked 16/8, 2011 at 3:41
5
How do you close a java application from the code?
Vibraphone asked 2/8, 2011 at 23:38
4
Solved
I want to make my Java Application to call my own custom made function when the "close" cross button is pressed. as far as i see there may be no way since setDefaultCloseOperation has no overloads ...
Landfall asked 21/5, 2011 at 19:46
1 Next >
© 2022 - 2024 — McMap. All rights reserved.