Most voted "joptionpane" questions
Joptionpane is a standard and simple dialog window class of swing, which can ask users for a value or inform them of something.
Learn more…20 questions
Sort by count of
-
8
votes2
answers749
viewsHow to put icon on Joptionpane buttons?
How do I place an icon in the "Continue" and "Cancel" buttons that appear in the JOptionPane? The case is represented below: public void metodo(){ JPanel panel = new JPanel(); JLabel label = new…
-
4
votes2
answers351
viewsJoptionpane in the foreground
I have an app that uses one JOptionPane to show an error message, however I would like the JOptionPane always appeared in the foreground. JOptionPane.showMessageDialog(null, "Usuário ou senha…
-
3
votes1
answer197
viewsWhy isn’t this method adding up?
I’m trying to put two numbers together by Swing and JOptionPane, but is appearing error below. Someone to help me solve this ? Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:…
-
2
votes1
answer448
viewsInitial focus on the Joptionpane OK button
I got the following JOptionPane: As you can see the focus is on the Cancel maestro option I need this focus to be on OK, but I have no idea how to do that. My code: JPanel panel = new JPanel();…
-
2
votes1
answer540
viewsHow to exchange the Joptionpane background with an image?
You can use that "ImageIcon" as background of a JOptionPane? Follow the code I tried: public static void main(String args []){ UIManager UI = new UIManager(); ImageIcon icon = new…
-
2
votes0
answers25
viewsJAVA - How to remove the default action from enter in a Joptionpane?
I have a Joptionpane with the "OK" and "Cancel" options. When navigating with Tab between them, even if Cancel is selected, by pressing Enter it pulls the default option, in case OK, and confirms…
-
1
votes1
answer423
viewsHow can I persist data using Arraylist?
I need my Arraylist data structure to be visible in more than one method of my Products class. This is how I’m working: package estoque; import java.awt.Component; import javax.swing.JOptionPane;…
-
1
votes1
answer91
viewsError with Arraylist data display
While recovering data from an arraylist by means of the "for" command, it displays the following message: Note: I could not identify where the error is. What do you think is wrong? package…
-
1
votes1
answer27
viewsDoubt how to display the result using Joptionpane
I’m looking for a program to find part of a string in an array. I just wanted to do it and show it in a window. The way I did it worked, but when I search for "notebook", it generates a window with…
-
0
votes2
answers399
viewsPick up quantity of entries inside the Joptionpane
Hello, I’m having difficulty picking up the number of entries that is made by the user to then use them. Code: public static void main(String[] args) { // TODO code application logic here int n, s =…
-
0
votes1
answer120
viewsWhile error in joption pane: loop
I’m having a serious problem with while in the following algorithm: You have a data set containing the height and gender (male, female) of 50 people. Make an algorithm that calculates and writes: 1…
-
0
votes1
answer323
viewsHow to take a char type die by Joptionpane?
char cadastrar; cadastrar = JOptionPane.showInputDialog("cadastrar: A-aluno P-professor M-medico");
-
0
votes1
answer179
viewshow to change the width of Joptionpane.showInputDialog?
Would you like to know how to increase the width of the inputDialog inbox? I am using the code below to open the dialog box to edit an information called "title", is working, but the title can be a…
joptionpaneasked 5 years, 5 months ago Rodrigo Gambarra 3 -
0
votes1
answer72
viewsReturn/save problem in a JAVA list
Good night, I have a Master Class: import static javax.swing.JOptionPane.*; import java.util.ArrayList; import java.util.List; import static java.lang.Integer.parseInt; public class Principal {…
-
0
votes1
answer167
viewsHow to get out of Joptionpane without closing the Main window?
I’m trying to create a program in Java Agenda, but when I leave the JOptionPane configuring the Agenda Owner name, called from the main window, the entire application is closed. String nome = "";…
-
0
votes1
answer80
viewsJoptionpane calling the screen Main
Good evening, I believe this doubt is simple but I can not solve, I have a method that displays a message instructing the user in the filling of a Captcha, until then ok, the "problem" is that when…
-
0
votes1
answer45
viewsDynamic joptionpane in Java: combobox
Is it possible to make Joptionpane dynamic ? I’m having difficulty registering new entries in the countrys array[]. I’m using Java 1.8 sdk Code import javax.swing.JOptionPane; import…
-
-1
votes2
answers47
viewsAlert only appear 1x inside a for
I have a question: I have a method that goes through a list of clients and in it checks if it is the type countSolidaria =3 , every time the method goes through this list he gives an Alert showing…
-
-1
votes1
answer65
viewsHow to make the program continue where I left off after an exception happens in my Ry
In this excerpt I got the expected result, which was not close the program after the error message if the user enters with wrong data. However, even if I’m in the 10th, it resets to the first. So…
-
-2
votes1
answer458
viewsJava field with numbers only
I’m doing a medical record for a hospital system test and I’d like to know how to validate the field CRM. It is a variable double, I want the field of Joptionpane accepted only numbers in CRM, I’ve…