How to get event click Ok dialog [closed] - java

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have showdialog
JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green.");
How to get event when I click the Ok button?

The code will be blocked until you click
System.out.println("before click");
JOptionPane.showMessageDialog(null, "Eggs are not supposed to be green.");
System.out.println("after click - do your code here");

Related

Javafx - Changing the color of a buttom [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 months ago.
Improve this question
I am a java beginner and i tried to lock it up and tried diffrent command but none of them worked.
I want to change the Background Color of Button for example from red to green.
The following code will set a buttons color to red:
Button button = new Button("My Button");
button.setStyle("-fx-background-color: #ff0000; ");
If you need any more help with buttons you can refer to the documentation here:
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#setStyle-java.lang.String-

How to re-enable a disabled JTextField? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
So there will be a text field that I disable using the textField.setEnabled(false) method. However later on in the code I want to enable this text field back again. textField.setEnabled(true) does not work at this moment.
How should I address this problem?
Try to create a Jtextfield like instance variables

JDialog gets hidden after casting JFileChooser [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
My program contains of a JDialog with a button which opens a JFileChooser. After Clicking on this Button my main JDialog gets hidden even if it's set to modal. This shouldnt happen.
What to do?
Setting the JDialog as a parent to the JFileChooser should "hold" it in place.

Get text field input and display [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
So I made a frame for user to key in the name and student id in JTextField. I implemented ActionListener to get the text from the text fields. Now I want to retrieve the text to be displayed in a different frame. How do I do that?
Use getText() method to get whatever was typed in a JTextField:
String text = yourtextfield.getText();

How to pop out warning? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
if(btnSubmit.equals("Submit")){
if(checkdata()== true){
InsertData();
url = "/mimy/Dbtable.jsp";
}
else{
out.println("Fill up all the field");
url = "/mimy/Register.jsp";
}
}
The following codes are the options I have tried to ensure that the user fill in all the fields of the form. If the user does not fill in any of the field,a pop up statement should be displayed. But the code above is not working. How can I work this out?
out.println won't pop up anything. Write Javascript code to pop up message.
e.g. alert("fill up all fields "); in javascript
This worries me:
if(btnSubmit.equals("Submit")){
Is your btnSubmit really a String? Somehow I doubt it. Somehow I think that it's a button of some kind.

Categories

Resources