How to create an YES/NO JOptionPane with the default focus on No?

Hi,
can somebody please show me how to display an JOptionPane with the options Yes and No that has the focus by default no the No button?
By default it is on the Yes button which is rather problematic for confirm dialogs like "Do you really want to delete everything?".
JPJava

It would help if JPJava gave some sample code SSCCE to show they know how to construct a JOptionPane
I use explorer to access the source files in the zip folder and JGrasp to view the source code
this is copy modify from the API
Object[] options = { "YES", "CANCEL" };//{"OK", "CANCEL"} shown in api
JOptionPane.showOptionDialog(null, "Are you sure you want to delete", "Confirm Delete",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[1]);//options[1] selects CANCEL option as defaultthis method constructs
showOptionDialog
public static int showOptionDialog(Component parentComponent,
                                   Object message,
                                   String title,
                                   int optionType,
                                   int messageType,
                                   Icon icon,
                                   Object[] options,
                                   Object initialValue)
                            throws HeadlessExceptionBrings up a dialog with a specified icon, where the initial
choice is determined by the initialValue parameter and the number of choices is determined by the optionType parameter.
If optionType is YES_NO_OPTION, or YES_NO_CANCEL_OPTION and the options parameter is null,
then the options are supplied by the look and feel.
The messageType parameter is primarily used to supply a default icon from the look and feel.
Parameters:
parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent
has no Frame, a default Frame is used
message - the Object to display
title - the title string for the dialog
optionType - an integer designating the options available on the dialog: YES_NO_OPTION, or
YES_NO_CANCEL_OPTION
messageType - an integer designating the kind of message this is, primarily used to determine the icon from
the pluggable Look and Feel: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE,
QUESTION_MESSAGE, or PLAIN_MESSAGE
icon - the icon to display in the dialog
options - an array of objects indicating the possible choices the user can make; if the objects are components,
they are rendered properly; non-String objects are rendered using their toString methods; if this parameter is null,
the options are determined by the Look and Feel
initialValue - the object that represents the default selection for the dialog; only meaningful if options is used; can be null
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog
Throws:
HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()Edited by: Ross_M on Sep 22, 2008 9:19 AM

Similar Messages

  • How to create a custom function module with the records in SAP R/3?

    Hi All,
    How to create a custom function module with the records in SAP R/3? Using RFC Adapter I have to fetch the custom function module records.
    Regards
    Sara

    Hi
    goto se37...here u need to create a function group... then u need to create a function module. inside assign import/export parameters. assign tables/exceptions. activate the same. now write ur code within the function module
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm
    Look at the below SAP HELP links, These links will show you the way to create a Function Module
    http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm

  • How to create a webservice in Tomcat with the use of Axis

    I am very new to webservices. I am suppose to create a webservice in Tomcat with the use of Axis. I have downloaded all the required jars.
    Please help me how to start.
    Thanx in advance.
    [email protected]

    Check out the Axis user's guide at: http://ws.apache.org/axis/java/user-guide.html

  • How to create an dynamic internal table with the structure of a ddic table

    Hi all,
    I want to fill ddic-tables (which I already created) in my abap dictionary with data out of CSV-files (which are located on the CRM-Server).  The ddic tables have different amount of fields.
    I started with creating a table which contains the name of the tables and the path to the matching CSV-file.
    At the beginning I'm filling an internal table with part of this data (the name of the ddic-tables) - after that I am looping at this internal table.
    LOOP AT lt_struc ASSIGNING <lfs_struc>.
         LOOP AT lv_itab1 INTO lv_wa1 WHERE ztab_name = <lfs_struc>.
         lv_feld = lv_wa1-zdat_name.
        ENDLOOP.
        CONCATENATE 'C:\-tmp\Exportierte Tabellen\' lv_feld INTO lv_pfad.
        Do.
        OPEN DATASET lv_pfad FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
        READ DATASET lv_pfad INTO lv_rec.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        enddo.
        REPLACE ALL OCCURRENCES OF '"' IN lv_rec WITH ''.
        SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
        INSERT into (<lfs_struc>) values lr_str_value.
        CLOSE DATASET lv_pfad.
    endloop.
    This is not the whole code, but it's working until
    SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
    I want to split all the data of lv_rec into an internal table which has the structure of the current ddic-table, but I didn't find out how to do give the internal table the structure of the ddic-table. In the code I used an internal tyble type string but I should be the structure of the matching tabel.
    If I try to create an internal table by using a fiel symbol, I am told, that the data types are not matching.
    Has anyone an idea?

    Hi Mayari,
    though you were successfull with
    METHOD cl_alv_table_create=>create_dynamic_table
    I must warn you not to use it. The reason is that the number of tables created is limited, the method uses GENERATE SUBROUTINE statement and this triggers an unwanted database commit.
    If you know the DDIC structure, it is (starting with ECC6.0) much easier:
    field-symbols:
      <table> type standard table.
    data:
      lr_data type ref to data.
    Create data lr_data type table of (<DDIC structure>).
    assign lr_data->* to <table>.
    The split code can be simplified gaining speed loosing complexity not loosing functionality.
    field-symbols:<fs_s> type any.
    field-symbols:<fs_t> type any.
    SPLIT lv_rec AT ';' INTO table it_string.
    loop at it_string assigning <fs_s>.
      assign component sy-tabix of wa_string to <fs_t>.
    if sy-subrc = 0.
      <fs_t> = <fs_s>.
    endif.
    at last.
      append <fs_itwa3> to <ft_itab3>.
    endat.
    endloop.
    Though it may work as Keshav.T suggested, there is no need to do that way.     
    Regards,
    Clemens

  • How to create a mp3 playlist compatable with the media server (storage link)

    Hi,
    I have setup the wrt160nl wireless router with the latest Firmware Version: 1.00.01 B17.
    Everything is working great. I can browse the artists, albums, song titles etc from my usb hard disk.
    What isn't working is the play lists.
    What format does the play list need to be in?
    I assume a text file with the tracks listed like: \music\acdc\back in black.mp3
    What file extention or name will the playlist need to be in?
    My pnp player only sees two playlists:
    1) playlistlastplayed
    2) playlistmostplayed
    If I knew where those play lists were stored on the usb hard drive (or linksys internal ram?) then I might have a clue.....
    Thanks for any help on this.

    Playlistlastplayed has every track on the hard disk - and I haven't played them all, only like 3
    Playlistmostplayed has ONLY 1 track that I haven't played from the linksys upnp server at all
    I can play music off the album, artist and song lists fine.
    I'd just like to be able to use a play list, and can't seem to find out how to make one.
    I realize and understand that the linksys storage link system doesn't create them.
    I assume I can make my own text file with track listings and copy the play list to the usb hard drive attached.
    I just need to know the format of the text file, and what extention will it need.
    I have tried .m3u .m3u8 .wpl
    I don't have iTunes but if you told me I have to download that, import my music into that, then create the playlist there, well, I guess I could try that. I rather not load iTunes if possible.
    Thanks

  • How to Create Simple In-Cell Charts with the REPT Function

    I found this technique on Juice Analytics, and was happy that I could adapt it to Numbers.
    Basically, you can create an in-cell chart by repeating a character, x number of times, where x can be a number or cell reference.
    See the screen shot below:
    [IMG]http://i240.photobucket.com/albums/ff100/MacFanMike/incell-graph.jpg[/IMG]
    You can read more about it, and download example here:
    http://www.numberstemplates.com/2007/08/29/tips-how-to-create-in-cell-charts-wit h-apple-iwork-numbers/

    I haven't tried myself but my guess is that you need to customize your tree cell editor for putting
    cursor at specific position, etc.

  • How to create a new tree node with the initial edit function

    Hi all,
    I would like to mimic the Windows system when the user creates a new node. The newly created node should be in the edit mode, i.e.it should
    be highlighted and the cursor should be appear at the end of
    the newly created node name.
    I have the folloing code after I create the new node and set its selection:
    TreePath selectionPath = getTree().getSelectionPath();
    tree.startEditingAtPath(selectionPath);
    However, this only partially does what I want, the cursor does not appear at the end of the node's name and I am not sure how to select the text name of the new node.
    I hope someone can help.
    Kanita

    I haven't tried myself but my guess is that you need to customize your tree cell editor for putting
    cursor at specific position, etc.

  • Help:  How to add a library item to hide the default Window menu

    Hi,
    In this post: Help: How to add a library item to hide the default Window menu, it described how to create an menu that will hide the default window menu.
    I'd like to know if there a way to put this component into library so that others can directly inherit this menu in other FORMS and how to implement it.
    Jimmy

    Hi,
    I found the solution and the post was not properly phrased. There is no need to add menu into library. All we need is to put the compiled menu into Oracle AS and add the menu name the menu module of the given form.
    Thanks.
    Jimmy

  • I created my Apple ID in Ireland, but would now like to switch to a German Apple ID, keeping the same email address. How do I delete my old Irish Apple ID, so I can create a new German one with the same email?

    I created my Apple ID in Ireland, but would now like to switch to a German Apple ID, keeping the same email address. How do I delete my old Irish Apple ID, so I can create a new German one with the same email?

    Welcome to the Apple Community.
    Click on your account name in the top right corner of the iTunes store in the iTunes application on your computer, enter your password and click the "view account" button. Navigate to the Apple ID summary where you have the option to "change country or region".
    In order to change your location, you will need a credit card registered to an address in the location you are trying to change to.
    You cannot change your location if you have credit on your account, if you are unable to spend your credit and leave a balance of zero, contact Apple, which you can do through iTunes Store Support.

  • How to create a new user aaa with same rights as existing user bbb ?

    Assume user bbb already exists in Oracla 10g database.
    How can I create a new user aaa with the same rights/permissions as the old user bbb?
    Is this procedure/command also working if the old user is user "system" (=dbadmin)?

    There is some possibilty to generate a EXPDP dump file which contains only DDL statements related to account and
    privileges: EXCLUDE/INCLUDE parameter can help.
    For example, following EXPDP statements seem to work with SYSTEM account:
    expdp / schemas=system content=metadata_only exclude=table,sequence,package,function,procedure,synonym,,type view dumpfile=DPD:system.dmp logfile=DPD:system.log
    Export: Release 10.2.0.2.0 - Production on Thursday, 14 February, 2008 9:41:36
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Starting "OPS$XXX"."SYS_EXPORT_SCHEMA_01":  /******** schemas=system con
    tent=metadata_only exclude=table,sequence,package,function,procedure,synonym,type view dumpfile=DPD:system.dmp logfile=DPD:system.log
    Processing object type SCHEMA_EXPORT/USER
    Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
    Processing object type SCHEMA_EXPORT/ROLE_GRANT
    Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA
    Master table "OPS$XXX"."SYS_EXPORT_SCHEMA_01" successfully loaded/unload
    ed
    Dump file set for OPS$XXX.SYS_EXPORT_SCHEMA_01 is:
      C:\TEMP\SYSTEM.DMP
    Job "OPS$XXX"."SYS_EXPORT_SCHEMA_01" successfully completed at 09:41:41
    impdp / sqlfile=dpd:system.sql dumpfile=DPD:system.dmp logfile=DPD:system.logImport: Release 10.2.0.2.0 - Production on Thursday, 14 February, 2008 9:42:46
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Master table "OPS$XXX"."SYS_SQL_FILE_FULL_05" successfully loaded/unload
    ed
    Starting "OPS$XXX"."SYS_SQL_FILE_FULL_05":  /******** sqlfile=dpd:system
    .sql dumpfile=DPD:system.dmp logfile=DPD:system.log
    Processing object type SCHEMA_EXPORT/USER
    Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
    Processing object type SCHEMA_EXPORT/ROLE_GRANT
    Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA
    Job "OPS$XXX"."SYS_SQL_FILE_FULL_05" successfully completed at 09:42:50and system.sql is:
    -- CONNECT OPS$XXX
    -- new object type path is: SCHEMA_EXPORT/USER
    -- CONNECT SYSTEM
    ALTER USER "SYSTEM" IDENTIFIED BY VALUES '970BAA5B81930A40'
          TEMPORARY TABLESPACE "TEMP";
    -- new object type path is: SCHEMA_EXPORT/SYSTEM_GRANT
    GRANT GLOBAL QUERY REWRITE TO "SYSTEM";
    GRANT CREATE MATERIALIZED VIEW TO "SYSTEM";
    GRANT SELECT ANY TABLE TO "SYSTEM";
    GRANT CREATE TABLE TO "SYSTEM";
    GRANT UNLIMITED TABLESPACE TO "SYSTEM" WITH ADMIN OPTION;
    -- new object type path is: SCHEMA_EXPORT/ROLE_GRANT
    GRANT "DBA" TO "SYSTEM" WITH ADMIN OPTION;
    GRANT "AQ_ADMINISTRATOR_ROLE" TO "SYSTEM" WITH ADMIN OPTION;
    GRANT "MGMT_USER" TO "SYSTEM";
    -- new object type path is: SCHEMA_EXPORT/DEFAULT_ROLE
    ALTER USER "SYSTEM" DEFAULT ROLE ALL;
    -- new object type path is: SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    BEGIN
    sys.dbms_logrep_imp.instantiate_schema(schema_name=>SYS_CONTEXT('USERENV','CURRENT_SCHEMA'), export_db_name=>'BAS002.REGRESS.RDBMS.DEV.US.ORACLE.COM', inst_scn=>'1456160');
    COMMIT;
    END;
    -- new object type path is: SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA
    BEGIN
    SYS.DBMS_AQ_IMP_INTERNAL.CLEANUP_SCHEMA_IMPORT;
    COMMIT;
    END;
    / These export and import steps don't take into account privileges granted on schema objects belonging to another user likely due to to the EXCLUDE statements.
    Message was edited by:
    Pierre Forstmann

  • How to create Using Formatted Text Field with multiple Sliders?

    Hi i found the Java Sun tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html very useful, and it tells how to create one Formatted Text Field with a Slider - however i need to create Formatted Text Field for multiple Sliders in one GUI, how do i do this?
    my code now is as follows, and the way it is now is scroll first slider is okay but scrolling second slider also changes value of text field of first slider! homework due tomorrow, please kindly help!
    // constructor
    label1 = new JLabel( "Individuals" );
    scroller1 = new JSlider( SwingConstants.HORIZONTAL,     0, 100, 10 );
    scroller1.setMajorTickSpacing( 10 );
    scroller1.setMinorTickSpacing( 1 );
    scroller1.setPaintTicks( true );
    scroller1.setPaintLabels( true );
    scroller1.addChangeListener(this);
    java.text.NumberFormat numberFormat = java.text.NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new NumberFormatter(numberFormat);
            formatter.setMinimum(new Integer(0));
            formatter.setMaximum(new Integer(100));
    textField1 = new JFormattedTextField(formatter);
    textField1.setValue(new Integer(10)); //FPS_INIT
    textField1.setColumns(1); //get some space
    textField1.addPropertyChangeListener(this);
    //React when the user presses Enter.
    textField1.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),  "check");
            textField1.getActionMap().put("check", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    if (!textField1.isEditValid()) { //The text is invalid.
                        Toolkit.getDefaultToolkit().beep();
                        textField1.selectAll();
                    } else try {                    //The text is valid,
                        textField1.commitEdit();     //so use it.
                    } catch (java.text.ParseException exc) { }
    label2 = new JLabel( "Precision" );
    scroller2 = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 8 );
    scroller2.setMajorTickSpacing( 10 );
    scroller2.setMinorTickSpacing( 1 );
    scroller2.setPaintTicks( true );
    scroller2.setPaintLabels( true );
    scroller2.addChangeListener(this);
    textField2 = new JFormattedTextField(formatter);
    textField2.setValue(new Integer(10)); //FPS_INIT
    textField2.setColumns(1); //get some space
    textField2.addPropertyChangeListener(this);
    //React when the user presses Enter.
    textField2.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),  "check");
            textField2.getActionMap().put("check", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    if (!textField2.isEditValid()) { //The text is invalid.
                        Toolkit.getDefaultToolkit().beep();
                        textField2.selectAll();
                    } else try {                    //The text is valid,
                        textField2.commitEdit();     //so use it.
                    } catch (java.text.ParseException exc) { }
    // State Changed
         public void stateChanged(ChangeEvent e) {
             JSlider source = (JSlider)e.getSource();
             int fps = (int)source.getValue();
             if (!source.getValueIsAdjusting()) { //done adjusting
                  if(source==scroller1)   {
                       System.out.println("source ==scoller1\n");
                       textField1.setValue(new Integer(fps)); //update ftf value
                  else if(source==scroller2)     {
                       System.out.println("source ==scoller2\n");
                       textField2.setValue(new Integer(fps)); //update ftf value
             } else { //value is adjusting; just set the text
                 if(source==scroller1)     textField1.setText(String.valueOf(fps));
                 else if(source==scroller2)     textField2.setText(String.valueOf(fps));
    // Property Change
        public void propertyChange(PropertyChangeEvent e) {
            if ("value".equals(e.getPropertyName())) {
                Number value = (Number)e.getNewValue();
                if (scroller1 != null && value != null) {
                    scroller1.setValue(value.intValue());
                 else if (scroller2 != null && value != null) {
                    scroller2.setValue(value.intValue());
        // ACTION PERFORMED
        public void actionPerformed(ActionEvent event) {
        if (!textField1.isEditValid()) { //The text is invalid.
            Toolkit.getDefaultToolkit().beep();
            textField1.selectAll();
        } else try {                    //The text is valid,
            textField1.commitEdit();     //so use it.
        } catch (java.text.ParseException exc) { }
             if (!textField2.isEditValid()) { //The text is invalid.
            Toolkit.getDefaultToolkit().beep();
            textField2.selectAll();
        } else try {                    //The text is valid,
            textField2.commitEdit();     //so use it.
        } catch (java.text.ParseException exc) { }
    ...

    if :p3_note_id is null
    then
    insert into notes (project_id, note, notes_month, notes_year) So, p3_note_id is NULL.
    Another option is that you have a trigger on table NOTES that generates a new note_id even for an update.

  • How to Create an Input Schedule Comparison with Data Using EVDRE

    Hello,
    I try implement the scenario described in "How to Create an Input Schedule Comparison with Data Using EVDRE".
    Once I am using the "Insert Function" from the panel and selecting the EVTIM function Excel crashes (see page 8 How to paper).
    Systems:
    BPC 7.0 NW SP02
    Office 2007
    BPCADminClient and BPCOfficeClient up to date
    Have anyone a solution?
    Thanks
    Oktay

    Hi Oktay -
    This function works in my BPC70NW SP02 system. Your issue might be that you are trying to access a TIME member that does not exist. Please make sure the offset value is a valid dimension member.
    I can confirm that EVTIM does allow the offset for base members (such as 2009.MAY) as well as parent nodes (such as 2009.Q1 or 2008.TOTAL)... BUT...the offset result of the EVTIM function needs to be a valid dimension member!
    Regards,
    Sheldon

  • How to create user editable Crystal Report with dynamic dataset

    What I would like to achieve:
    A program loads a report in runtime updates list of database fields (possibly includes sample data), open report in "Crystal Reports 2011" (or 2008) where user customizes report and saves it. Later on the program loads the report, fills actualized data and displays it in .net report viewer.
    What I do:
    CrReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
    CrReport.Load(TemplateFilename)
    Dim Results As DataTable
    DataTable is filled from a database
    CrReport.SetDataSource(mResults)
    CrReport.SaveAs(NewReportPath, True)
    The NewReportPath is opened in the default program.
    What are the problems
    The report is open in preview mode (not in design).
    When the field is added to the report the designer asks for XML datasource on preview.

    The short answer is that it is not possible. I broke the question to other two: How to save a report that it opens without preview? and How to create user editable Crystal Report with dynamic dataset, where it is possible to find details. Key answer is Re: How to create an editable previewable report?

  • How to create new view without interlinking with gantt chart or resource views

    ok clear
    one another question
       In msp how to create new view without interlinking with gantt chart or resource views

    Hi Shiv PMC--
    I splitted your question above in another thread in order not to have  a huge thread with many topics in it.
    That being said, I'm not sure to understand. A view is just a manner to display MS Project data with columns. A view can have a table with column (left part) associated with a Gantt chart. It can also just contain a table with no Gantt chart (like the task
    table) or a table with a timephased grid (resource and task usage).
    Please give us more information, maybe with a concrete example so we can help you.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • How to create labeled table of Content with expand and collapse

    Hi All,
    Can somebody help me how to create labeled table of Content with expand and collapse as example given below:
    User1
    Template1
    Template2
    User2
    +
    User3
    Template1
    Template2
    Like when we see expand (+) and collapse (-) button when we click on 'about this page' link.
    Thanks
    Bhupendra

    Hi,
    Tou can use Table inside table to show the details this way but I'm not sure about Expand/Collapse.
    Expand/Collapse are part of HGRID.
    I think we can develop this functionality with little manipulation.
    Regards,
    Reetesh Sharma
    Edited by: Reetesh Sharma on Jun 28, 2010 4:56 AM

Maybe you are looking for