How To Change InputDialog Buttons?

hi there
i made an InputDialog
and i want to change the button names ,how to do that?
and how to react with the user clicks a button?
here's what i did
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Custom_Dialog
    public static void main(String[] args) {
String Text=JOptionPane.showInputDialog(null,"Input Something","Search",JOptionPane.QUESTION_MESSAGE);                                   
}

hi i made it but i have a problem
is that when i press the Search Button The JDialog disappears and loses focus
and i want it to still focused i used requestfocus() but it doesn't work
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.*;
class Custom_Dialog
  public static void main(String[] args)
       JTextField textfield=new JTextField(5);
    Object[] options =
    {"Search", "Cancel"};
Object[]array={"Input Something",textfield};
    JOptionPane pane = new JOptionPane(array,
        JOptionPane.QUESTION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options);
    JDialog dialog = pane.createDialog(textfield, "Search");
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setVisible(true);
    if(pane.getValue().equals("Search")){
         System.out.println("Search Pressed");
         System.out.println(textfield.getText()+" Is Entered");
         dialog.requestFocus();
    else{
         System.out.println("Cancel Pressed");
}

Similar Messages

  • How to change the button's clicked color

    Dear all,
    How to change the button's clicked color
    I want it to be white in color as my button's background color is white
    Thanks

    How to change the button's clicked colorvia the UIManager

  • How to change the button image in theme editor

    How can i change the button image in theme editor. If i upload another button image in theme editor it doesn't show me the full image. it cuts it from the right. how can i view  the full image as a button.
    Thanks

    HI,
      Check this link
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/ep/modifying%252bthe%252blogon%252bpage
    Custom logon page
    Portal Customizations Intro - Login Part 1
    Change the portal logon page image programmatically
    Branding
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a000df6b-586a-2910-e6be-9fee831d5a30
    Thanks,
    Gopi

  • How to change the button colour automatically????

    i want to change the button color automatically ,if there is no data in next page ....plzz help

    Hi,
    create a binding for the data collection displayed on next page and do
    styleClass=#{bindings.iterator.estimatedRowCount<=0?'redClass' : ''}
    Then define a custom skin (see how to skin an application in the web developer guide) and use
    .redClass .af|commandButton{background-color:red}
    in this skin. Now when the page renders or when you PPR the button, the color should apply or not. Btw, the same EL on the disabled property or the rendered property would do the same trick (probably better than just a color change)
    Frank

  • How to change the button size of Calendar prompt

    I want to change the button size in Calendar prompt. How to change it?
    Thank you!

    I think it is not necessary to modify the Calendar button size.
    The Calendar button actual size is 20X20.
    But the gif file which is used by Calendar button is not filled by icon.
    It seems that the height is smaller than the other buttons.
    Edited by: user12291797 on Dec 3, 2009 12:59 AM

  • How to change the button dynamically?

    Hi,
        My Application is that,when i will press the button(on state-Enliglish text will come on the button,off state-Hindi Text will come on the button).
    So,my problem is that i can't write hindi text on the button,so only way is that i can port the image from the file,so how cal i do this without customizing the button.
    With Regards
    Dibya

    Broken Arrow wrote:
    Baji wrote:
    Place a boolean button in the LabVIEW front pannel and right click>>Advance>>Customize. ......
    Message Edited by Baji on 05-29-2009 04:23 PM
    The question, for whatever reason, was how to do this without customizing the button, although your solution is obviously the best way to do it, and how it is meant to be done.
    So, my question to the original poster, why can't you customize the button like Baji has suggested?
    Agreed.
    I would also encourage posting both in English and your native tongue to try and clarify the issue.
    Looking forward...
    Dynamic language changes are best handled using property nodes to change the captions and text of all FP objects. It is a lot of work to set-up the first time but once completed, maintaining the code is straight froward.
    If there are issues with just changing properties not fullfilling all reqs then a Picture Control takes care of most of the "all other cases" rather well (but is seldom trivial).
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to change the button lable for LOV ??

    when you press for lov you will get this LOV pop up. At the pop up, there are button , CANCEL,OK and FIND. i want to change to different word.
    any idea...how to do it.
    hairol

    see.. this is my problem,
    i'm writing a program to be used by users who don't speak english. I can change the prompt, lable and since the character set used is similar to english and that language is not supported so we use english.
    the problem is that these three button cannot display correct word for it. so my application will become half english and half other language.
    It believe it looks ugly.
    can't oracle do something to solve this problem.
    hairol

  • A question about how to change a button in a JPanel during runtime

    I am a beginner of GUI. Now I am trying to change a specific component, a button, when the application is running. For example, I have 3 buttons in a JPanel. Each button has its onw icon. If I click one of them, it will change its icon, but the other two don't change. I don't know if there is any method for changing a specific component during runtime. If any one knows please let me know, I will appreciate that very much!!!

    What you're going to have to do is loop inside the actionlistener but still have accessability to click while its looping. I don't know much about it, but I think you're going to need a thread. Try something like this... (it doesn't work yet, but I have to take off)
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    class buttonxdemo extends JFrame implements ActionListener{
      Buttonx mybutton;
      //set it all up, make it look pretty  =]
      public buttonxdemo()
           mybutton = new Buttonx("default");
           getContentPane().add(mybutton.thebutton);
           mybutton.thebutton.addActionListener(this);
           this.setDefaultCloseOperation(3);
           this.setSize(200,200);
      public void actionPerformed(ActionEvent ae){
        if (ae.getSource() == mybutton.thebutton)
             if (mybutton.keepGoing)
               mybutton.keepGoing = false;
                else if (!mybutton.keepGoing)
                     mybutton.keepGoing = true;     
          mybutton = new Buttonx(/*Icon,*/"My Button");
          //getContentPane().remove(mybutton);
          //getContentPane().add(mybutton.thebutton);
          mybutton.startstop();
      }//actionperformed
      static void main(String args[])
           new buttonxdemo().show();
    } //movingicondemo
    class Buttonx extends Thread{
      public boolean keepGoing;
      //public Icon ICx;            //perhaps an array, so you can loop through?
      public String strbuttonx;
      public JButton thebutton;     //may have to extend JFrame?
      public Buttonx(/*Icon IC,*/ String strbutton){
        //ICx = IC;
        strbuttonx = strbutton;
        thebutton = new JButton(strbuttonx);
      public void startstop()
        int i = 0;
        while (keepGoing)
          thebutton.setLabel(strbuttonx.substring(0,i));
          //if an array of Icons ICx
          //thebutton.setIcon(ICx);
    i++;
    if (i > strbuttonx.length() - 1)
    i = 0;
    try
         Thread.sleep(1000);
    catch (InterruptedException ie)
         System.out.println("sleep caught: " + ie);
    }//startstop()
    }//buttonx
    kev

  • How to change the Button content as CamelCasing in Windows phone 8.1 Message dialog

    This was already raised in
    Stack over flow, While showing the native Message dialog in Windows phone, i cant change the captions as camel case of command buttons. Is this a bug with windows phone 8.1(WinRT) are is there any workaround to fix this issue?
    Sankar

    This isn't recommended and violates the system style.
    If you want a custom dialog you need to use a different control. The MessageDialog always lower cases the buttons to match the system style and is not generally customizable.
    If you use a ContentDialog you can customize it fairly extensively, and it doesn't try to fix the case of its buttons. You'll probably want to create your own ContentDialog class (there's a template under Add.New Item...) with your desired contents, but here's
    a quick content-free example:
    ContentDialog cd = new ContentDialog();
    cd.Title = "My Title";
    cd.PrimaryButtonText = "CoNtInUe";
    cd.SecondaryButtonText = "sToP";
    await cd.ShowAsync();
    Also note that the guidelines
    for message dialogs suggest using clear and specific verbs rather than generic OK/Cancel.

  • BPS Web Application - How to change function button property dynamically

    We have created BPS web application for sales force, it contains 2 button.
    1. To send Workflow notification to Managers 'Request for Approval' - This would be used by sales person
    2. Button for Manager to approve the Plan 'Manager Approval' - This would be used by the Manager
    We are using Territory Management in CRM to determine who is the manager and sales person.
    We would like to use the same Web application to be used by both sales person as well as the manager. However depending on the user ID, we need to access the Territory Management table in BW to determine whether the person logging in is Manager / Sales person. If it is a Sales Person, we need to display 'Request for Approval' button and hide 'Manager Approval'  button. Similarly, if it is Manager,   'Manager Approval'  button to be displayed and 'Request for Approval' button to be hidden.
    Would appreciate, if any one has faced similar requirement and how to do this.
    Thanks,
    VJ Sudharsan

    Thanks Ananad and Srini for the suggestion. Actually I was working on the direction Anand Suggestion and make it working but I am not sure what I did is correct or not.
    I have a bogus variable that checks for Manager / Sales person and brings back following code in the variable, if it is manager:
    '<style> #Req_Approval_s </style>'
    and I added a new text component of type HTML and code
    <%=descr(VarvlSel2/value)%>
    it works. Is this the correct way of doing the enhancement. Or is there a different place where we can add JavaScript.
    Srini - I am using exit function, can you explain how we can I use BPS authorization to achieve this.

  • How to change export button file type as .xls

    Hi,
    In iSupplier, we have a export button to export planning details.By default the export button
    will export the VO details as .csv file. But the client need this file to be populated as .xls file.
    I have analyzed to set file type for export button, but i am not able to find the solution.
    Anybody can help me to change the export file type ....
    Thanks in advance..

    you need OBI generator for that.first you need to change the data to xml file and then you can do that.
    Best Regards,
    Krishna Priya Bandyopadhyay

  • How to change Complete button's caption?

    Is there any way to change the caption of Complete button? (which appears at the bottom right corner of the workspace)
    Please advise!
    Thanks,
    Nith

    I dont understand what you are talking.
    In ES2, I remember only User Action can change this caption. (Or you may refer the older version of LiveCycle)
    The Users Action panel is available only for User Activity. However, the Workspace startpoint doesn't have such an option to configure.
    What to do?
    Nith

  • How to change action button text in UWL?

    Hi All,
    I want to change the text of Action buttons like Resubmit, Forward, Assign To Me in UWL.
    Is it possible to change thru custom configuration file for a specific workitem?
    Thanks
    Sundar

    Hi Sundar,
    For the forward button , you are getting this message because you are using the handler dummy, ie no handler . For forward, write like this:
            <Action name="forward" handler="ProviderActionHandler">
              <Properties>
               <Property name="userIdList" value="${users}"/>
            <Property name="display_order_priority" value="3"/>
              </Properties>
              <Descriptions default="My Forward"/>
            </Action>
    If you provide this handler and these properties, then you must have the forward functionality screen, as defined by SAP.
    In case you want anything else to launch, like any web dynpro application, you need to have webdynprolauncher...and so the properties will be different.
    Let me know if your forward functionality is happening well or not?
    Regarding Assign to Me, do not put any extra action tag for that.
    Go to portal content and select 'Yes' for the Display UWL support Information. Log into portal and click on the task which you want to check. Below UWL  you will see a lot of information. In the section 'Supported Actions for this Item'(last section), Find the action Id for the 'Assign to Me' Display Text. I guess that action will be there in the uwl.standard file. Copy that action section and paste in your file. Just add one extra line: 
    <Descriptions default="My Forward"/> at the end of the </Properties> tag. Bo not create any new name, just add this default text. In this way functionality will remain same, only text will change.
    Log off and login to the portal. Hope you will see what you want.
    Thanks,
    Sonali.

  • How to change the Button Style

    I have some buttons(all are submitt buttons) in my page, when i run my page locally the styles are same but when i deploy it in server the button style changes to rectangular, i tried by giving attribute set value to /oracle/apps/fnd/attributesets/Buttons/Go, even then the same problem, can any one give me the solution for this

    Babu,
    Can you confirm Self Service Accessibility Features profile value is set to "Standard Accessibility".
    --Mukul                                                                                                                                                                                                                                                                                                       

  • How to change web button and bars colors??

    is there anyway to change illustrators default web buttons and bars after they are dragged to the canvas. it seems a lot of the buttons are yellow or blue. i wanted to specifically change the color of a "talk bubble." thanks

    You haven't specified which version of Illustrator you are using, but I will assume for purposes of this discussion, that my version, CS3, is not vastly different from yours. The "Web Buttons and Bars" is a collection of symbols, which gives you several options. When you drag a symbol to the artboard three buttons appear in the Control Panel: Edit Symbol, Break Link, and Duplicate. Each affords you certain option for editing the symbol.
    Edit Symbol puts the symbol into Isolation Mode, which allows access to the parts of the symbol through the Layers Panel and the Appearance Panel, and may be changed using any colors, effects, transformations, additions, deletions, or anything else you choose to do to it. When you are finished editing, and exit Isolation Mode, the changes you have made will appear in the symbol in the Symbols Panel and in any instances of the symbol you have put on the artboard.
    Break Link turns the symbol instance you have selected into an object which may be changed in any manner you choose, just as if you had built it yourself and then changed your mind. Changes to the object will have no effect on other instances of the symbol, nor on the symbol in the Symbols Panel, because it is no longer a symbol and is completely unrelated to either. If you wish, you may turn the edited object into a new symbol.
    Duplicate turns the selected symbol instance into a new symbol, identical to the original but having no connection either to it nor to other instances of the original. If the first symbol was named "Original," then a new one will appear in the Symbols Panel named "Original 1." The same options will be available in the Control Panel, and any changes you make will only be applied to the new symbol and any instances of it that you may have put onto the artboard.
    You may save your edited symbols through the Symbols Library Menu in the Symbols Panel.
    If any of this is unclear, doesn't work, or is flat wrong, please let me know.
    Peter

Maybe you are looking for