JOptionPane button renaming

Hi guys!
Had loadsa help with my last post, and I really appreciate it! But I call upon you once again!
Finishing touches, and I wanna remname the buttons in a JOptionPane message box.
I want a message to pop up and state the message "Welcome! Click 'next' to continue"
and for it to have two buttons, saying NEXT and QUIT. Have been rolling around the APIs, but can't see a thing that'll help me. Got some nice tips like renaming the title of the window a.s.o., but no button renaming options!
Really appreciate the help... !
:)

     JOptionPane op = new JOptionPane();
     String s = "Welcome! Click 'next' to continue";
     Object[]    bt = {"NEXT","QUIT"};
     op.showOptionDialog(null,s, "",op.YES_NO_OPTION,
                    op.QUESTION_MESSAGE, null, bt,bt[0]);      Noah

Similar Messages

  • Flash Game Button Rename

    I need to rename the replay button as Submit button in the flash game. I am new to flash and doesn't know how to do this? I am using Flash CS5 trial version and Actionscript 3. All game components and interfaces are displayed in the library list as Movie Clip. One movie clip named MC_replay has total score display and replay button. I want to rename this button. I selected and double-clicked this movie clip, it appeared on the main screen. I right clicked the button and found no edit options. If I double click, dots are appearing on the text. How to solve this problem. Can any one help me?

    What do you mean ?
    Do you want to change the text to Submit ? User will see "Submit" instead of "Replay"
    or
    Do you want to change the instance name (for AS coding) ?
    I guess you want to change just the text.
    Double-click , find the text , select it , delete it and add a Text object.
    Better you upload your fla file and I 'll check it.

  • JOptionPane buttons in English and in another language?

    How do I change the language of the buttons in JOptionPane.showInputDialog?
    When I use the Traditional Chinese Windows, I see Chinese characters in the buttons.
    Can I have buttons in English even if I use the Traditional Chinese Windows? How? What web pages should I consult?
    Locale locale = Locale.getDefault();
        locale = new Locale("en", "US");
        Locale.setDefault(locale);does not help me to get the correct human language I prefer, e.g. on the confirm button.
    Edited by: tse2009 on Sep 12, 2009 6:22 AM

    Finally, I searched the web and got some ideas from:
    [http://jackywu1978.javaeye.com/blog/forum/97|http://jackywu1978.javaeye.com/blog/forum/97]
    Then, I can get the preferred language on the buttons on JOptionPane.
    import sun.awt.AppContext;
    public class getTheRightLanguagePreferred{
    Locale locale = Locale.getDefault();
        locale = new Locale("en", "US");
        Locale.setDefault(locale);
    AppContext.getAppContext().put("JComponent.defaultLocale", locale);
    }If you think that it is useful, please comment.

  • JOptionPane buttons(OK/Cancel) in German Language??

    hi,
    I need to do translation of my Swing Screens.
    I implemented it using ResouceBundle.Now the messages are coming in the JOptionPane are coming from the property file.
    But the buttons-->OK & CANCEL are still in english.I need to translate this also.How to do this.??Any pointers on this.??
    thnx
    Neel

    hi,
    sorry guys..I got the solution from Java Doc itself
    This is the solution
    Object[] options = { "OK", "CANCEL" };
    JOptionPane.showOptionDialog(null, "Click OK to continue", "Warning",
    JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
    null, options, options[0]);Thnx
    Neel

  • Mnemonics in JOptionPane buttons??

    ive looked wround the api but i find no method that allows to add mnemonics to the default buttons that u can get when having a JOptionPane dialog box popup.
    does anyone knowhow to add mnemonics to these buttons?
    normally u would say button.setMnemonic(KeyEvent.VK_X)... but these buttons dont have a variable associated with them.
    help please!

    Hi... it may seem that I'm stating the obvious, but the JOptionPane classes are designed as a quick and dirty convenience method. There exist options to create your own buttons and pass them to the JOptionPane dialog constructor(s), which you should do to solve your problem. :-/
    Merry Christmas

  • How to Handle Events for JOptionPane buttons?

    Hi All,
    I need a help...
    I am trying to develop a simple SWING application that consists of multiple elements (mainly text fields) and a Submit button. On pressing Submit button, it should validate all the fields and then do something else. But if some fields are left blank, then it should give a pop-up message and on clicking the OK button on the pop-up message, the focus should go to that text field which is left null.
    The problem is I am not able to understand how to Capture this OK button click-event of the pop-up message. I mean how to do something when the OK/Cancle button of the pop-up window is clicked.
    Please Help me.
    Thanks in Advance,
    Ujjal

    As already pointed out, JOptionPane has some static methods which show a dialog, and return an int, or a string. The whole point of this class is to remove the need for any event handling by the developer, that is, you simply call the showDialog method or whatever, and it returns a value telling you, for example, which button was pressed - no need for action listeners at all. The result of the showDialog method (or whichever you use) tells you which button was pressed. Check the javadocs for JOptionPane for details of several constants that indicate which button was pressed
    The class exists to make simple dialogs trivial to generate - you're overcomplicating things!

  • JOptionPane button keyevents

    how do i enable the buttons to respsond to key presses?
    here's my Yes_No dialog to the user when he wants to quit the prog. buttons respond on clicking but there's no key event associated. How can i associate key presses with the buttons?
    final JOptionPane optionPane = new
         JOptionPane("Are you sure you want to quit?",
            JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);
         final JDialog dialog = new JDialog(this, "Exit", true);
         dialog.setContentPane(optionPane);
         dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
         optionPane.addPropertyChangeListener(new PropertyChangeListener() {
         public void propertyChange(PropertyChangeEvent e)
              String prop = e.getPropertyName();
              if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY) || prop.equals(JOptionPane.INPUT_VALUE_PROPERTY)))
                         dialog.setVisible(false);
         dialog.pack();
         dialog.setLocationRelativeTo(null);
         dialog.setVisible(true);
         int result = ((Integer)optionPane.getValue()).intValue();
         if (result == JOptionPane.YES_OPTION)
              System.exit(0);
         else
              System.out.println("User decided not to quit.");

    hi,
    JOptionPane seems to have a keylistener, you could use that to detect key events, extend the JOptionPane class, making your own JOptionPane and use the listener to detect the key you want and handle the event.

  • Why are my radio buttons not renaming in pages spawned from a hidden template?

    Hi Everyone,
    I am new to PDF forms, and have never before tried to use JavaScripts. However, I have been able to learn a lot and I have followed many threads and have almost accomplished what I want, but have hit a block. I don't understand the JavaScript well enough to locate my problem. Your help is greatly appreciated.
    SYSTEM SPECS: Adobe Acrobat X Pro  Mac OS 10.8.5
    WHAT I WANT: To create a multi-page (100 pages) form for grading student assignments. Each page must have the same fields, but as each page belongs to a new student, it needs to have different values in the fields on different pages. Each page has 4 questions to score, with 4 score possibilities for each question (0, 1, 2, 3 points), and so only one score should be able to be selected per question.
    WHAT I HAVE DONE, following the directions on this thread (Re: Multiple pages form) ):
    1) Created a form with a field for student name and 4 sets of radio buttons (Labeled Questions 1-4, with score choices 0-3).
    2) Placed a button at the bottom of the page that will spawn a new page and rename fields.
    3) Defined this page as a template.
    4) Spawned a page.
    5) Made the template "hidden."
    THE PROBLEM: Steps 1-4 above work perfectly--as long as the template (named "Form") is visible, when I click the button, a new page generates and the student name field renames the fields on Page 2 to "P2.Form.Student ID #" and the radio buttons rename to "P2.Form.Question 1" etc. Each time I press the button, it renames everything appropriately.
    However, if I hide the template, then when I click the button on page 1, the fields on Page 2 are renamed to "P1.Form.StudentID ##1." AND THE RADIO BUTTONS DO NOT RENAME. They get the name "P1.Form.Question 1" etc. So the student name field did rename in a way that allows me to enter a new name on each page, but it isn't actually reflecting that I am on page 2, and as for the radio buttons, at that point, I cannot enter different scores on different pages because they are all part of the same radio button grouping.
    If I use check boxes, they rename similarly to the student ID field, but I don't want to use check boxes because I want to return one possible score value for each question for tabulating the data. I don't want to leave the template visible because when I distribute this form to other graders, they may enter values into the template page without realizing it, and then when the spawn forms they will have wrong data already entered.
    Here is the script that I have set as the button's Mouse Up script:
    // Specify the name of the template
    var template_name = "Form";
    // Get a reference to the template
    var t = getTemplate(template_name);
    // Add a new page based on the template
    if (t !== null) {
        t.spawn({
        nPage: numPages,      // Add the new page to end of document
        bOverlay: false,      // Create a new page, not an overlay
        bRename: true         // Rename the fields
    } else {
       app.alert("The template named \'" + template_name + " does not exist in this document.", 1);
    Thanks for your help

    Hi again GKaiseril,
    If you have the time, would you be able to tell me how to do that? I tried just changing the page number of the template page to zero, but I get the error "Please enter a starting value of at least 1."  I definitely noticed that all of the discussions about similar subject do all say to somehow put the first page of the form before the template and then hide the template, but I don't think that I know how to do that. I read your response on this discussion "Re: Self replicating form pages in Acrobat Pro 9 (Win XP)" before I ever started this discussion, but have to admit that I can't figure out how to follow your advice "When I create a from that uses a template, I create the template and then spawn the 1st page of the form before the template and then work out the scripting for the 1st page and template and then hide the template."
    Thanks

  • Change Button Name in JOptionPane.showMessageDialog

    Hello,
    I've written the following code that invokes a JOPtionPane messageDialog, when the delete button is hit in the following frame and the selectedItem in the JComboBox is Default.
    I want to change the JOPtionPane button name from OK to Close. Is there a way to do this with error message dialoges, as their is with confirmDialoges?
    Please help out.
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    public class MyJOptionPaneTest {
         public MyJOptionPaneTest()
              JFrame frame = new JFrame("My Frame");
              JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT,5,0));
              final JComboBox myComboBox = new JComboBox();
              myComboBox.setPreferredSize(new Dimension(100,20));
              myComboBox.getModel().setSelectedItem("Default");
              myComboBox.addItem("Default");
              myComboBox.addItem("Other");
              JButton deleteButton = new JButton("Delete");
              deleteButton.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        if(myComboBox.getSelectedItem().equals("Default"))
                             JOptionPane.showMessageDialog(null, "Default cannot be deleted", "Error", JOptionPane.ERROR_MESSAGE);
              panel.add(myComboBox);
              panel.add(deleteButton);
              frame.getContentPane().add(panel);
              frame.setSize(200,100);
              frame.setResizable(false);
              frame.setVisible(true);
         public static void main(String [] args)
              MyJOptionPaneTest test = new MyJOptionPaneTest();
    }

    Hi,
    yes, I've looked at the tutorials. But there is no way to change button title for JOptionPane.showMessageDialog. Only JOptionPane.showOptionsDialog provides you w/ that feature, becuz it provides the parameter in the method.
    I was wondering if there was another way to do this for showMessageDialog.

  • Help with buttons/actionscript

    I've got a movieclip acting as a button.  Code on the button itself handles roll-over/-out states, and I define an onRelease function in the main timeline as follows:
    backBut.onRelease=function(){
         gotoAndPlay(1);
    This code takes the movie back to the first frame and works on the third frame.  For some reason, though, the same code on the fifth frame has no effect.  The button doesn't do anything.  I have tried using the same button, I tried inserting a new keyframe with a new button, renaming the button, etc. and for some reason I just can't get it to work on the fifth frame.
    If it helps to visualize, I am essentially making a menu.  The first frame contains buttons to take you to submenus, located on following slides.  This button to go back to the original menu is on each frame with a submenu, but for some reason only works on one of them.  Thanks in advance for your help.

    Try moving that button in frame 5 to it's own layer.  If it's the same llibrary symbol, what happens is the name from the preceding instance gets inherited, along with other characteristics.  If frame 4 doesn't do anything, instead of a new layer, just try putting a blank keyframe between the buttons in frames 3 and 5.  This may not be the problem at all, but it's my first guess at the possible problem.

  • JOptionPane and JDialog.DO_NOTHING_ON_CLOSE broken?

    Hi there
    I've created a JDialog from a JOptionPane and I don't want the user to simply dispose of the dialog by clicking on the close button but they are still able and I'm sure that my code is correct. Is it my code that is wrong or is it a java bug? Oh I'm running on 1.3 BTW
    JFrame f = new JFrame();
    f.setSize(500, 500);
    f.setVisible(true);
    JOptionPane optionPane = new JOptionPane("Hello there", JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    JDialog d = optionPane.createDialog(f, "Testing");
    d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    d.setVisible(true);I know that I can just set up a JDialog directly and use the setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE) and it seems to work properly but I would like to see it work for JOptionPane!
    Thanks in advance

    Sorry but this doesn't make it work either. I've looked at the code for createDialog in JOptionPane and it actually adds a WindowListener to the dialog in there as well as a propertyListener. On closing the option pane it calls a method in windowClosing of the windowListener which in turn fires a property change event which then tells the dialog to dispose itself so the addition of another windowAdapter to override the windowClosing method will not help :-(
    I've managed to get round it by doing something similar to
    JFrame frame = new JFrame();
    final JDialog dialog = new JDialog(frame, "Testing", true);
    JButton button = new JButton("OK");
    button.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        dialog.dispose();
    JOptionPane optionPane = new JOptionPane(button, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    dialog.setContentPane(optionPane);
    dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    dialog.pack();
    dialog.setVisible(true);

  • Flash button will not update on DW 8 on Mac

    I just moved to a mac. I have been on XP. Whenever my site
    needed a new button, I would Duplicate an existing button, rename
    it and then change its display and link.
    Now, on the mac, I can duplicate and change the name.
    However, when I change the display and link, it takes the OK or
    Apply, but when I re-retrieve the changed button, there are no
    changes. I must really be missing something obvious?
    Thank you for any help!

    Why are you using Flash buttons? You know that some people
    won't see them,
    and search engines won't find them, right?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Todd Kreinbring" <[email protected]> wrote
    in message
    news:evhff4$3nv$[email protected]..
    >I just moved to a mac. I have been on XP. Whenever my
    site needed a new
    > button, I would Duplicate an existing button, rename it
    and then change
    > its
    > display and link.
    >
    > Now, on the mac, I can duplicate and change the name.
    However, when I
    > change
    > the display and link, it takes the OK or Apply, but when
    I re-retrieve the
    > changed button, there are no changes. I must really be
    missing something
    > obvious?
    >
    > Thank you for any help!
    >

  • JOptionPane JButton Icon

    Hi,
    Does anyone knows how to set icons in the JOptionPane buttons ?
    I use this but when I click it never closes the dialog.
    JButton[] options = new JButton[3];
    options[0] = new JButton("B1");
    options[1] = new JButton("B2");
    options[2] = new JButton("B3");
    int n = JOptionPane.showOptionDialog(null,
    "Would you like to replace it ?",
    "Question",
    JOptionPane.YES_NO_CANCEL_OPTION,
    JOptionPane.QUESTION_MESSAGE,
    null,
    options,
    null);
    System.out.println(n);
    Thanks.

    Use this :
    Icon[] options = { new ImageIcon("yes.gif"),new ImageIcon("no.gif"), new ImageIcon("cancel.gif")};
    int res = JOptionPane.showOptionDialog(null, "Select a button", "title", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);I hope this helps,
    Denis

  • Train button bar text

    I have a requirement where i need to show train at the top of the page (always) and
    train button bar at the bottom of the page with following requirements
    1. only back button, renamed to Previous if next is disabled, i.e for the last train stop
    2. only next renamed to Continue, if back is disabled i.e for the first stop
    3. both back renamed to Previous and next renamed to Continue for all other train stops
    for train at the top i used,
    <af:train id="t1" var="trainNode"
    value="#{controllerContext.currentViewPort.taskFlowContext.trainModel}">
    <f:facet name="nodeStamp">
    <af:commandNavigationItem text="#{trainNode.textAndAccessKey}" id="cni2"
    visited="#{trainNode.visited}"
    disabled="#{trainNode.disabled}"
    action="#{trainNode.action}"
    immediate="#{trainNode.visited}"></af:commandNavigationItem>
    </f:facet>
    </af:train>
    -- it is working fine
    for the train button bar, when i use
    <af:trainButtonBar id="tr_tbb1" var="trainNode"
    value="#{controllerContext.currentViewPort.taskFlowContext.trainModel}">
    <f:facet name="nodeStamp">
    <commandButton text="Previous" id="cnsdi2" // or <af:commandNavigationItem
    disabled="#{trainNode.disabled}"
    action="#{trainNode.action}"
    immediate="#{trainNode.visited}"/>
    </f:facet>
    </af:trainButtonBar>
    I never see the text getting update even if i hard-code,
    How do i acheive this ??
    thanks

    My requirement is to
    1. display only back button( renamed to Previous) at the last train stop. Next Button (renamed to Continue) should not be rendered at all
    2. display only next button (renamed to Continue) at the first train stop , back button( renamed to Previous) should not be rendered at all
    3. both back renamed to Previous and next renamed to Continue for all other train stops

  • Change Name of the ABAP program.

    Hi
    I need to change the name of an ABAP program,example from zXyyy to ZYxxx. How can i do it with out actually copying to another report.
    Thanks,
    Ravi.

    Hi ravi,
    go to se80.
    you can see object name. i.e your programe name <b>zXyyy</b>
    click right button on your prog name and say <b>rename</b>.
    give the name what you want and click button rename.
    hope this helps you..
    reward points for helpfull answers and close the thread if your question is sovled.
    regards,
    venu.

Maybe you are looking for