• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to change Button Text & Button Actions in Input Dialog Box  RSS feed

 
Damien O Sullivan
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'd like to change the text on the two buttons which I have in my Dialog Box, how should I do this?

Also, when I click the X Button in the top right of the Dialog Box, nothing happens, and the program only stops when I end it in jGrasp. How do I make this button close the program when clicked on?

Thanks in advance for any help you can give me.

 
Paul Clapham
Sheriff
Posts: 22375
42
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a link to Oracle's tutorial How to Make Dialogs -- you'll find your answer in there.

(By the way you'll find that tutorial if you use java dialog tutorial as your search keywords. That's almost a universal rule: use "java X tutorial" if you want to find a tutorial about X in Java.)
 
Ashwin Rao
Ranch Hand
Posts: 89
C++ Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just a beginner and here's what i know(idk if it'll help you but I'm gonna try):
you can change the text on a button by using the button_name.setText("Your text here");
To stop your program when you close the window use this:
frame_name.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!