jdialog

Optimal location for a modal JDialog to avoid stuck

大城市里の小女人 提交于 2020-02-14 17:10:10
问题 My Swing application has to show a modal dialog to the user. Sorry for not posting SSCCE. topContainer might be JFrame or JApplet . private class NewGameDialog extends JDialog { public NewGameDialog () { super(SwingUtilities.windowForComponent(topContainer), "NEW GAME", ModalityType.APPLICATION_MODAL); //add components here getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); //TODO: setSize(new Dimension(250, 200)); setLocation(650, 300); } } I start the dialog like

Optimal location for a modal JDialog to avoid stuck

白昼怎懂夜的黑 提交于 2020-02-14 17:09:13
问题 My Swing application has to show a modal dialog to the user. Sorry for not posting SSCCE. topContainer might be JFrame or JApplet . private class NewGameDialog extends JDialog { public NewGameDialog () { super(SwingUtilities.windowForComponent(topContainer), "NEW GAME", ModalityType.APPLICATION_MODAL); //add components here getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); //TODO: setSize(new Dimension(250, 200)); setLocation(650, 300); } } I start the dialog like

Modeless JDialog not showing contents

故事扮演 提交于 2020-01-14 14:45:11
问题 (Java SE 6) I'm trying to create a pop-up dialog that displays a "please wait" message while my program does some time-intensive work. To do this, I've chosen to use a modeless JDialog, so that the program continues to run and does work while the JDialog is visible (if you use a modal one, the program will halt until the dialog is closed by the user). The problem is that when you use a modeless dialog in this fashion the JDialog with a title appears, but the contents don't (I'm guessing they

How to make repaint for JDialog in Swing?

≡放荡痞女 提交于 2020-01-11 12:03:20
问题 How to make repaint for JDialog in Swing? If I click on convert button in JDialog I need to change GUI design of JDialog but it's not happening? Is their any solution? _convertAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { String para = new String(); _task.setBookTypeId(13); initComponents(); // validate(); // repaint(); setVisible(true); } }; I'm setting booking type id is 13 . if(_task.getBookTypeId()== 1){ String colnames[] = {"Leg","Departure", "Date","Time",

Safely open and close modal JDialog (using SwingWorker)

吃可爱长大的小学妹 提交于 2020-01-10 05:04:02
问题 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 dialog has defaultCloseOperation set to DO_NOTHING, so it can only be closed with a proper call - I use setVisible(false) . MySwingWorkerTask myTask = new MySwingWorkerTask(); myTask.execute(); myModalDialog.setVisible(true); The SwingWorker does some

Safely open and close modal JDialog (using SwingWorker)

旧时模样 提交于 2020-01-10 05:03:05
问题 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 dialog has defaultCloseOperation set to DO_NOTHING, so it can only be closed with a proper call - I use setVisible(false) . MySwingWorkerTask myTask = new MySwingWorkerTask(); myTask.execute(); myModalDialog.setVisible(true); The SwingWorker does some

How to make a Frame-like component modal to JInternalFrame and block only that JInernalFrame

扶醉桌前 提交于 2020-01-07 03:03:53
问题 To make it short - my application's main JFrame has 2 JInternalFrames. In one of them, I want to have a JButton which will open a JDialog (/JOptionPane/JInternalFram). I want to set the JDialog modal to that JInternalFrame - I want to block that JInternalFrame and leave the other one accessible. I couldn't achieve this using JDialog as it only accepts Frame, Window and Dialog as owners (and it's not possible to cast from JInternalFrame to Frame). I tried using JOptionPane which accepts

Continue code execution after new JFrame is created and then closed

家住魔仙堡 提交于 2020-01-05 09:05:27
问题 So this is probably a silly question but I just cant figure it out. Basically I have my MainWindow, when I press a button a new window should appear named PartSelectionWindow that contains a JTable (the JTable is filled out with a custom table model). Then I select a row and press ok to go back to the MainWindow and work with the info selected. Here's the problem: If I use a JFrame for the PartSelectionWindow, after the window is closed the code execution does not continue in the MainWindow

setDefaultCloseOperation not working in Swing

☆樱花仙子☆ 提交于 2020-01-04 13:31:29
问题 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 not dispose it, I am also setting the following: setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); But still when I click on the red x mark, the window closes. Any ideas? 回答1: Adding Window listener to the JDialog gave me the power to handle

setDefaultCloseOperation not working in Swing

守給你的承諾、 提交于 2020-01-04 13:31:27
问题 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 not dispose it, I am also setting the following: setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); But still when I click on the red x mark, the window closes. Any ideas? 回答1: Adding Window listener to the JDialog gave me the power to handle