joptionpane

JFrame is not removed from the taskbar

a 夏天 提交于 2019-12-12 01:05:07
问题 This question is related to my previous question Showing JDialog on taskbar does not look good. I have modified my code so that the dialog is displayed correctly but now the problem is that the button does not disappear from the taskbar when the dialog is closed. So the application runs, a dialog is displayed and a button is created in the taskbar for it. When I choose YES or NO, the dialog is closed but the button remains in the taskbar. For this reason, buttons add up in the taskbar each

JOptionPane in JavaFX Making Window 'Not Respond'

半世苍凉 提交于 2019-12-11 22:39:10
问题 I am building a JavaFX app and am using JOptionPane to display dialogs One of the problems I've encountered is that creating a new dialog and not dismissing it within 5 or so seconds will cause the main JavaFX stage go into a 'Not Responding' state Running the joptionpane code in a new thread works, but causes the dialog not to be modal, which is not suitable for the app i'm building This is all running in Windows. Any ways to fix the not responding problem would be greatly appreciated :)

Force JOptionPane to Stay Open

本小妞迷上赌 提交于 2019-12-11 15:04:14
问题 My application is constructed as follows: Main window allows user to select CSV file to be parsed JOptionPane appears after a CSV file is selected and the JOptionPane contains a drop-down menu with various choices; each of which generates a separate window Currently, the JOptionPane closes after a selection is made from the menu and the "OK" button is clicked I am looking for a way to force the JOptionPane to remain open so that the user can select something different if they want. I would

Disposing a Modal dialog using a condition

非 Y 不嫁゛ 提交于 2019-12-11 14:49:55
问题 I have a modal jDialog that i wish to dispose when a particular condition is met after showing the error message in another Dialog using JOptionPane. I have tried to use the dispose() method after the JOptionPane dialog but my modal dialog still opens up. The relevant part of my code is below: import java.awt.Component; import java.sql.*; import java.text.SimpleDateFormat; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; public class ReviewPatients extends javax

JOptionPane display loop

北城以北 提交于 2019-12-11 14:12:57
问题 Im trying to display the results of a search in a JOptionPane window so that when a certain search is found in a text file that it prints out the line in the text file. But it prints out every line in a separate window , is there any way I could print them all in the same window ?? public static void DisplayGrades() throws IOException { String line; String stringToSearch = JOptionPane.showInputDialog(null, "Enter your student ID"); BufferedReader in = new BufferedReader( new FileReader(

Java Block last JFrame from being focused like a JOptionPane

蹲街弑〆低调 提交于 2019-12-11 13:56:03
问题 I got a program. When I clic on a button, it opens a 2nd JFrame. (NB: I do not not want to use a JOptionPane because it is too basic). I would like, just like the JOptionPane, that my first Frame cannot be focusable and if clicked, the 2nd one will blink like the JOP. Basicly: - I want to have the 2nd Jframe to be the focused frame out of the two and the 1st one cannot be clicked until the 2nd is closed. 回答1: You want to: Either use a modal JDialog in place of the second JFrame Or use a

How to return index of Object array used by JOptionPane for use in a switch statement?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 13:15:39
问题 I am experimenting with variations on the dialog box tutorial on Oracle. I felt that the number of options I offered resulted in too many buttons so I converted from OptionDialog to InputDialog and used an Object array. Now, however, my switch statement (in replyMessage) doesn't work because of the change in data type. How do I get the index in the Object array corresponding to the user's selection? Object answer; int ansInt;//the user'a answer stored as an int Object[] options = {"Yes,

Obtaining index from the Joptionpane [duplicate]

梦想的初衷 提交于 2019-12-11 13:10:28
问题 This question already has answers here : How to select an index value from a String Array in a JOptionPane (2 answers) Closed 5 years ago . I want to access the index of the option selected by the user.Eg, in the figure below,if i choose microsoft option then it should give me the index 1.Is this possible? 回答1: Well you get "Microsoft" (well the Object showing Microsoft at least) as the return value from the show call, is that good enough? If you need the index just find the index of that

Java JOptionPane Output

烂漫一生 提交于 2019-12-11 10:28:03
问题 Can anybody tell me what I am doing wrong here. I need to calculate some values from user-input into some JOptionPane-input-dialog-boxes, then outputting the answers. I would greatly appreciate any help I get. Thanks In Advance! Input Number of loans to compare (Could be more than 1) Selling price Down payment You will ask the following for each loan they want to compare Interest rate Number of years Processing You will need to calculate the monthly payment for each scenario listed in part d

How to prevent JOptionPane.showConfirmDialog box from closing

a 夏天 提交于 2019-12-11 08:46:04
问题 I'm showing a ConfirmDialog with some input fields. When save fails (validation fails) I want to show a MessageDialog box but I don't want the ConfirmDialog box to disappear. How do I do this? Below is my actionPerformed method to open the ConfirmDialog (when I click a button with this method as it's event handler) @Override public void actionPerformed(ActionEvent e) { int result = JOptionPane.showConfirmDialog(null, panel, "New transaction", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN