JOptionPane and keystroke mappings

Hi,
The java doc for JOptionPane gives default keystroke mappings for JOptionPane as:
"JOptionPane (Java L&F)
Navigate in/out | Alt+F6
Retract dialog | Esc
Activate the default button (if defined) | Enter"
I have a new class myOptionPane that overrides a number of the functions, and also the creation of the dialog used. Now I'm trying to catch this ESC, and in addition to the dialog retraction do something. Preferably, I could handle the ESC action myself. I tried overriding the processKeyEvent() function for the dialog, and tried adding a KeyListener to the dialog. Neither even caught the event! Its as if JOptionPane just eats up these events leaving no one an option to catch them!
Any help?? Please!!!
Shefali

Hi,
I created a class for the dialog I am using, and added the key listener in that, and then it works! For whatever reason, adding the key listener to the object wasn't working, I don't know why!!
But thanks anyways,
Shefali.

Similar Messages

  • Automatic Creation of Roles and Role Mappings in GRC

    Hi,
    we are planning to use SAP Identity Management and SAP GRC Access Management.
    In SAP IDM we have defined several business roles that contain privilieges in SAP systems. When a user is requesting a role, the request will first be sent to SAP GRC for approval and risk checking.
    In order to get this to work, we need to load the business roles of SAP IDM into SAP GRC and we also need to configure the role mapping between the business roles and the technical SAP privileges.
    From what I understood, this could be implemented by loading the required information via Excel filles into SAP IDM.However, this is a quite cumbersome and error-rpone approach an we would like to automate this.
    Is there a way to use e.g. web service calls to create/delete roles and role mappings in SAP GRC?
    BTW: is a documentation of all available GRC web service calls and their parameters available?
    Thanks for your help in advance!
    Best regards
    Tom

    Hi Tom,
    as stated before, the web service description is in the config guide.
    Unfortunately there is no web service to create roles or even mappings in CUP - this is one of many I would also like to se created
    I don't think in your context you will be able to directly send Business Roles to CUP. The role mapping only happens after you send the request, so I'm not sure if that's in time for risk analysis - you will need to try that.
    Are you a customer or a consultant - anyway, feel free to contact me if you need further help integrating CUP and IdM. This is an evolving interface with many possible scenarios, so it's not easy to give you good advise without seeing the full picture.
    Frank.

  • Can someone pleas tell me about abap, java and xslt mappings

    Hi,
    can someone please tell me about abap, java and xslt mappings.
    Thanks,
    Bernard.

    HI,
    JAVA mapping
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping sample code for java mapping blog=/pub/wlg/4143 tutorial sax and dom
    ABAP mapping
    ABAP mappings run on ABAP Stack and are developed in the ABAP workbench of the Integration Server.
    You normally do not need to use the ABAP mappings and is preferable for someone with ABAP programming background. I should say JAVA functions would suffice any complex scenarios.
    refer step by step guides for ABAP Mapping
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
    /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    ABAP Mapping
    /people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
    https://websmp101.sap-ag.de/~sapdownload/011000358700003082332004E/HowToABAPMapping.pdf
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    /people/r.eijpe/blog
    ABAP Mapping Vs Java Mapping.
    Re: Message Mapping of type ABAP Class not being shown
    Re: Performance of mappings (JAVA, XSLT, ABAP)
    XSLT Mapping
    XSLT stands for EXtensible Stylesheet Language Transformations. It is an XML based language for transforming XML documents into any other formats suitable for browser to display, on the basis of set of well-defined rules.
    /people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae3f15
    /people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=xslt+mapping&adv=false&sortby=cm_rnd_rankvalue#
    Steps required for developing XSLT Mapping
    u2022 Create a source data type and a target data type
    u2022 Create Message types for the source and target data types.
    u2022 Create Message Interfaces includes Inbound Message interface and Outbound Message interface.
    u2022 XSLT Mapping does not require creation of Message mapping, so donu2019t create any Message mapping.
    u2022 Create an .XSL file which converts source data type into target data type.
    u2022 Zip that .xsl file and import it into Integration Repository under Imported Archives.
    u2022 In Interface Mapping choose mapping program as XSL and specify this zip program. (Through search help you will get XSL Mapping programs that you imported under Imported Archives, select your corresponding XSL Program)
    u2022 Test this mapping program by navigating to Test tab.
    By having look at above steps you can easily find out that this mapping is no where different from other mapping programs, here the challenging lies in creating an XSLT file. If you spend couple of minutes in studying XPATH tutorial you would be in ideal position to create an XSL Transformation (.xsl extension).
    If you still find difficulties in generating XSL Transformation, then you can make use of a tool u201CAltova MapForceu201D which will create XSL file for you.
    Steps for creating XSL file using this tool:
    1. Open the Alto MapForce, import the source .xml and .xsd file in it
    2. Similarly import the target .xml and .xsd in MapForce.
    3. These two data files should match with source and target data types in Integration Repository.
    4. Complete the graphical mapping using extensive list of XSLT functions available there.
    5. Save the mapping file.
    6. Click the XSLT tab. You will have the entire xslt logic there.
    7. Copy that content and save it as .xsl file.
    8. Zip above .xsl file and import the same into IR under Imported Archives.
    Hope this clears your doubts
    Thanks
    Saiyog

  • RESOURCE_NOT_FOUND for XSLT and Java Mappings (SXMB_MONI)

    Experts,
    I need your opinion / experience about a problem that we have been facing here:
    XI 3.0 was upgraded to PI 7.0, but since then all interfaces that uses XSLT and Java Mappings throws a RESOURCE_NOT_FOUND error in SXMB_MONI only in the production environment.
    We found SAP Note 951318 that describes exactly the scenario we have here. The note also inform that the issue is solved at SP 07 (for PI 7.0).
    The problem is that we find out that abap and java instance are with different SP ( SP 13 for abap and SP 09 for java) after XI upgrade to 7.0, since they had a error at java instance.
    Have anyone of you facing with this problem?
    I believe that even having a SP greater than 07 (as sap note 951318 requires), as we have an difference between abap and java SP, this issue might have been causing the problem.
    Points will be given.
    Regards,
    Daniela

    Yes, thats true. As you can see,
    In XI 3.0 (SAP Netweaver'04), the issue is solved in:
               SP 18,
               SP 17, patch 1 (archive SAPXITOOL17_1. sca for XI Tools)
               SP 16, patch 4 (archive SAPXITOOL16_4.sca for XI Tools).
    you need to import and put a patch if you are using XI 3.0. but in your case it is PI 7.0.
    So please check out the SAP Note : 950608 and download SP 07,patch 2 (archive SAPXITOOL07_2.sca for XI Tools).and Note 952402 .
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • 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);

  • Help on assignment, don't understand JOptionPane and showInputDialog

    Hi, I am currently studying java and have problems doing my assignment. here is the assignment question. What I am looking for is pointers and hints to start on my assignment. I am not looking for the source code, rather the way to actually understand it and start writting my code
    I believe this assignment wanted me to create a class Object called Zeller with the methods in it and a ZellerTester to test the Object?
    I read up on the JOptionPane and the showInputDialog, but don't really quite understand it.
    Do i need a constructor for the Object Zeller?
    Does my assignment require me to put the showInputDialog as a method in the Zeller class? Or put it in the ZellerTester?
    The isLeapYear is a method in the Object Zeller?
    Here is the assignment question
    Examine the method
    showInputDialog() and study its function. Note the return type of this method.
    Write a program on the following requirements:
    1. Use the JOptionPane facility to ask the user for three positive integers,
    representing the day, month and year of a date.
    2. Use the Zeller�s congruence formula to find the day of the week.
    3. Should include a method boolean isLeapYear(int year)
    that will return true if year is a leap year, and false otherwise.
    The method should check for leap years as follow:
    return true if the year is divisible by 400.
    return true if the year is divisible by 4 but not by 100
    return false for the remaining values
    Thank you.

    I can't seems to return the method back to the main
    Not sure where has gone wrong...
    here is my code
    import javax.swing.*;
    public class ZellerTester
        public static void main(String[]args)
        int day  = 28;
        int month = 2;
        int year = 2007;
        int z;
        boolean isLeapYear;
        String[] displayName = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
        if(month==1 || month==2) {
            if (isLeapYear = false)
                day = day-1;
              else
                day = day-2;
        if(month<3)
            month = month + 12;
        z = (1 + day + (month * 2) + (3 * (month + 1) / 5) +
             year + year / 4 + year / 400 - year/ 100) % 7;
        System.out.println("The day is " +displayName[z]);
    public boolean isLeapYear(int year)
           if (year%400 == 0)
               return true;
           else if((year%4 == 0) && (year%100 != 0))
                return true;
           else
                 return false;
    }

  • How to change the icon of JOptionPane and JFileChooser in swing

    Hi,
    Does any body know how to change the icon of JOptionPane and JFileChooser in swing.
    Please help me out in this.
    Thanx in advance.

    Try this
    import javax.swing.*;
    import java.awt.event.*;
    public class Untitled4 {
      public Untitled4() {
      public static void main(String[] args) {
        ImageIcon i = new ImageIcon("C:/TestTree/closed.gif");
        JOptionPane p = new JOptionPane();
        p.setMessage("This JOptionPane has my icon");
        p.setMessageType(JOptionPane.QUESTION_MESSAGE);
        p.setOptionType(JOptionPane.YES_NO_CANCEL_OPTION);
        final JDialog d = p.createDialog("test");
        d.setIconImage(i.getImage());
        d.setVisible(true);
        d.setModal(true);
        if(Integer.parseInt(p.getValue().toString()) == JOptionPane.YES_OPTION) {
            System.out.println("You Clicked Yes");
    }

  • JOptionPane and Threads

    I have a Class called Execute which runs as a thread. If this fails, then I want to show a JOptionPane from the main thread saying it failed (this works), but also I want to create a JOptionPane within the run() method of Execute stating the reason for the failure.
    I can not put a JOptionPane directly inside the run method 'cos it doesn't get rendered correctly, so I run this in it own thread. Only trouble is that now I have two modal dialog boxes appearing simultaneously; what I want is to have them appear consecutively. I have tried to join the thread that creates the pop-up but then it does not get rendered. Any ideas? I have posted an extract of the code below for testing
    public class Execute implements Runnable {
         File success = new File ("/ukirtdata/orac_data/deferred/.success");
         File failure = new File ("/ukirtdata/orac_data/deferred/.failure");
         success.delete();
         failure.delete();
         try {
             success.createNewFile();
             failure.createNewFile();
         catch (IOException ioe) {
             logger.error("Unable to create success/fail file", ioe);
             return;
         SpItem itemToExecute;
         if (!isDeferred) {
             itemToExecute = ProgramTree.selectedItem;
             logger.info("Executing observation from Program List");
         else {
             itemToExecute = DeferredProgramList.currentItem;
             logger.info("Executing observation from deferred list");
         SpItem inst = (SpItem) SpTreeMan.findInstrument(itemToExecute);
         if (inst == null) {
             logger.error("No instrument found");
             success.delete();
             return;
         String tname = QtTools.translate(itemToExecute, inst.type().getReadable());
         // Catch null sequence names - probably means translation
         // failed:
         if (tname == null) {
             //new ErrorBox ("Translation failed. Please report this!");
             logger.error("Translation failed. Please report this!");
             new PopUp ("Translation Error",
                     "An error occurred during translation",
                     JOptionPane.ERROR_MESSAGE).start();
             success.delete();
             return;
         else{
             logger.info("Trans OK");
             logger.debug("Translated file is "+tname);
                failure.delete()
                return;
        public class PopUp extends Thread implements Serializable{
         String _message;
         String _title;
            int    _errLevel;
         public PopUp (String title, String message, int errorLevel) {
             _message=message;
             _title = title;
             _errLevel=errorLevel;
         public void run() {
             JOptionPane.showMessageDialog(null,
                               _message,
                               _title,
                               _errLevel);

    Comeon,
    Someone must have some idea. I have tried making popup extend JOptionPane and implement Runnable, added a window listener which sets a boolean popDisplayed on windowOpen and windowClose, but this gets me nowhere (I have a Thread.sleep in the code as well)

  • JOptionPane and JList HELP!!!

    Hi there,
    I want to be able to use a JOptionPane and add these elements to my JList component. I know how to add elements to it through the source code but am not able to get a user to inout values into this JList. 've got my JOptionPane running by using the following code:
    public void actionPerformed(ActionEvent ae) {
           if(ae.getActionCommand().equals("New Player")){
                s1 = JOptionPane.showInputDialog("Enter player: ");
                list.append(s1);
           repaint();
      }I want the values taken from this Prompt and be shown in my JList. I tried doing:
    list.addElement(s1);
    list.append(s1);
    I tried looking at the Java API website but didn't find it helpful at all of what I'm trying to do.

    I keep getting an error on the line where it says:
    list.add(s1);And even when I try:
    list.addElement(s1);Still same error. Is it a different way of doing it?
    Thanks for any response

  • Mouse clicks and keystrokes

    When I edit mouse click in mouse properties, it
    doesn't always make the sound when it's checked (ticked), and
    sometimes makes a mouse click sound when it's not ticked. If you
    run it through again, it often responds differently. The same thing
    happens with keystroke sounds, though less frequently. Is this a
    common problem, is it my computer, or is there some way of fixing
    this problem?

    Keyboard shortcuts were often missed.  For example, I tried this sequence many times. 
    0: (setup:  text editor is scrolled to first line and cursor is at the beginning of the first line)
    1: Click on text editor window to focus it.
    2: press SHIFT-DownArrow to move cursor down one line and select the first line
    3: press CMD-X to cut the line.
    Automator never would capture those key strokes. 
    But today I has a break through.  This sequence does work:
    0: (setup:  text editor is scrolled to bottom of the file and the cursor is placed below the last line.)
    1: Click on text editor window to focus it.
    2: press SHIFT-UpArror to move cursor up one line and select the last line.
    3: press CMD-X to cut the line.
    about 70% of the time this did get recorded correctly (I did maybe 3 recordings and one failed to select).  Once it got recorded correctly it worked reliably. 
    So it seems to be able to capture some sequences but not others.  Both sequences work very reliably when I type them but automator can only capture the last sequence. 
    Thanks for the suggestions.  This tool is better than nothing but not anything I would recommend.

  • Structure, NODE, VALUE, and FUNCTIONAL MAPPINGS

    Guys -
    I am a novice to XI. But, I guess as per my understanding this is what I think. Please advis me if you have better opinion that would justify this answer in certifrication.
    XI by definition supports only the following 4 mappings types:
    Message (Graphical), XSLT, JAVA & ABAP
    However, first in Element cardinality addresses something called NODE MAPPING which describes as follows:
    Mapping of Non Mandatory Nodes (minOccurs=0)
    ====================================
    1. If a non mandatory node contains elements with minOccurs>0, these elements becomes mandatory after their parent node is assigned
    2. Assignment of element is not sufficient
    3. Node has to be 'created' by assigning a suitable source node/element
    Therefore, as per this discription, I believe NODE mapping a valid for CERTIFICATION
    Secondly, as per my understanding of message mapping, we map source and target STRUCTURES here. Does not this mean STRUCTURE MAPPING? Please confirm?
    Thirdly, You experts all must have done Value Mappings in your projects and there is no need for me to describe more about it. Can not we consider this as a valid answer for CERTIFICATION?
    Last but not least FUNCTIONAL MAPPING; I am not sure why this option is here? May be this is just to add confusion. On the otherside, it make sense if we consider including functions (both standard and user-defined) in our mapping. Does this make sense being a valid Mapping at all?
    In other words, let me ask you all experts; Is this a direct or indirect question? If it is direct then we should turn down all the options. If indirect, may the first 3 are correct or all four.
    Therefore, I rely on your guys for you input. Please provide your valuble analysis.
    Thanks

    Hi Sudarsana,
    The types of message mapping viz. graphical, ABAP, java and XSLT - are the features of XI.
    On the other hand, the types - structure mapping and value mapping - are general concepts. Any integration tool should support these.
    <b>Structure Mapping</b> is not very much concerned which values are being mapped. It is more concerned about the structure of source and target elements.
    It can be of two types (these don't have formal names as such)
    1) Mapping values of some source elements to some target elements
    e.g. source has element <fname> which is directly mapped to element <FirstName> in the target.
    2) Mapping values after changing the element structure
    e.g. source is
    <name>
         <fname> --- </fname>
         <lname> --- </lname>
    </name>
    And target is
    <fullname> --- </fullname>
    So here we concatenate source elements and map to target.
    <b>Value Mapping</b> concentrates on the actual values that are being mapped.
    Sometimes the requirement is like although source and target strcutres are similar, values need to be translated into another set and then mapped.
    e.g. we have an element called <TravelClass> in both source and target element.
    Now assume that source message uses codes such as 1, 2 etc. for this element. However, the target mmay expect strings values such as 'business', 'economy' etc. for this element.
    In such cases, we use value mapping. Essentially we achieve the following translation:
    1 -
    > business
    2 -
    > economy
    In graphical mapping we have a standard function called ValueMapping to define a simple table like one above.
    Finally, the term 'Functional Mapping' is given only to confuse the people
    Hope this clears your query.
    Regards,

  • JOptionPane and JDialog

    Hi guys,
    I've been scooting around the net trying to find an answer to this problem. Basically I have a JDialog that users enter registration details. If they haven't completed all fields or if the password confirmation is wrong then a JOptionPane.showMessageDialog appears telling users what has happened. However if they were to then click ok in the OptionPane it closes both the option pane and the original Dialog window. Have you guys any idea?
    A code snippet below:
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.*;
    public class Register extends JDialog implements ActionListener {
         //declare components
         JLabel lblHeading;
         JLabel lblUserName;
         JLabel lblUserPwd;
         JLabel lblCnfUserPwd;
         JLabel lblFrstName;
         JLabel lblLstName;
         JLabel lblAge;
         JLabel lblEmpId;
         JLabel lblSex;
         JLabel lblEmail;
         String usrName;
         String strUsrPwd;
         String strCnfPwd;
         String frstName;
         String lstName;
         String age;
         String empid;
         String email;
         String sex;
         Socket toServer;
         ObjectInputStream streamFromServer;
         PrintStream streamToServer;
         JComboBox listSex;
         JTextField txtUserName;
         JPasswordField txtUsrPwd;
         JPasswordField txtCnfUsrPwd;
         JTextField txtFrstName;
         JTextField txtLstName;
         JTextField txtAge;
         JTextField txtEmpId;
         JTextField txtEmail;
         Font f;
         Color r;
         JButton btnSubmit;
         JButton btnCancel;
         public Register() {
              this.setTitle("Registration Form");
            JPanel panel=new JPanel();
              //apply the layout
               panel.setLayout(new GridBagLayout());
               GridBagConstraints gbCons=new GridBagConstraints();
              //place the components
              gbCons.gridx=0;
              gbCons.gridy=0;
              lblHeading=new JLabel("Please register below");
               Font f = new Font("Monospaced" , Font.BOLD , 12);
              lblHeading.setFont(f);
              Color c=new Color(0,200,0);
              lblHeading.setForeground(new Color(131,25,38));
              lblHeading.setVerticalAlignment(SwingConstants.TOP);
              gbCons.anchor=GridBagConstraints.EAST;
              panel.add(lblHeading, gbCons);
              gbCons.gridx = 0;
              gbCons.gridy = 1;
              lblUserName = new JLabel("Enter Username");
              gbCons.anchor=GridBagConstraints.WEST;
              panel.add(lblUserName, gbCons);
              gbCons.gridx=1;
              gbCons.gridy=1;
              txtUserName=new JTextField(15);
              panel.add(txtUserName, gbCons);
              gbCons.gridx=0;
              gbCons.gridy=2;
              lblUserPwd=new JLabel("Enter Password ");
              panel.add(lblUserPwd, gbCons);
              gbCons.gridx = 1;
              gbCons.gridy = 2;
              txtUsrPwd = new JPasswordField(15);
              panel.add(txtUsrPwd, gbCons);
              gbCons.gridx=0;
              gbCons.gridy=3;
              lblCnfUserPwd=new JLabel("Confirm Password ");
              panel.add(lblCnfUserPwd, gbCons);
              gbCons.gridx=1;
              gbCons.gridy=3;
              txtCnfUsrPwd=new JPasswordField(15);
              panel.add(txtCnfUsrPwd, gbCons);
              gbCons.gridx=0;
              gbCons.gridy=4;
              lblEmpId=new JLabel("Employee ID");
              panel.add(lblEmpId, gbCons);
              gbCons.gridx=1;
              gbCons.gridy=4;
              txtEmpId=new JTextField(15);
              panel.add(txtEmpId, gbCons);
              gbCons.gridx=0;
              gbCons.gridy=5;
              lblFrstName=new JLabel("First Name");
              panel.add(lblFrstName, gbCons);
              gbCons.gridx=1;
              gbCons.gridy=5;
              txtFrstName=new JTextField(15);
              panel.add(txtFrstName, gbCons);
              gbCons.gridx=0;
              gbCons.gridy=6;
              lblLstName=new JLabel("Last Name");
              panel.add(lblLstName, gbCons);
              gbCons.gridx = 1;
              gbCons.gridy = 6;
              txtLstName=new JTextField(15);
              panel.add(txtLstName, gbCons);
              gbCons.gridx=0;
              gbCons.gridy=7;
              lblAge=new JLabel("Age");
              panel.add(lblAge, gbCons);
              gbCons.gridx=1;
              gbCons.gridy=7;
              txtAge=new JTextField(3);
              panel.add(txtAge, gbCons);
              gbCons.gridx=0;
              gbCons.gridy=8;
              lblEmail=new JLabel("Email address");
              panel.add(lblEmail, gbCons);
              gbCons.gridx=1;
              gbCons.gridy=8;
              txtEmail=new JTextField(20);
              panel.add(txtEmail, gbCons);
              gbCons.gridx=0;
              gbCons.gridy=9;
              lblSex=new JLabel("Sex");
              panel.add(lblSex, gbCons);
              gbCons.gridx = 1;
              gbCons.gridy=9;
              String [] sex= {"Male", "Female"};
              listSex = new JComboBox(sex);
              listSex.setSelectedIndex(0);
              panel.add(listSex, gbCons);
              JPanel btnPanel=new JPanel();
              btnSubmit=new JButton("Submit");
              btnPanel.add(btnSubmit);
              btnSubmit.addActionListener(this); //add listener to the Submit button
              btnCancel=new JButton("Cancel");
              btnPanel.add(btnCancel);
              btnCancel.addActionListener(this); //add listener to the Cancel button
              gbCons.gridx=0;
              gbCons.gridy=10;
              gbCons.anchor=GridBagConstraints.EAST;
              panel.add(btnPanel, gbCons);
              getContentPane().add(panel);
             setDefaultCloseOperation(DISPOSE_ON_CLOSE); //get rid of this window only on closing
              setVisible(true);
              setSize(450,400);
             }//end Register()
              public void actionPerformed(ActionEvent ae) {
                   Object o = ae.getSource(); //get the source of the event
                   if(o == btnCancel)
                        this.dispose();
                   if(o == btnSubmit){
                        usrName = txtUserName.getText();
                        strUsrPwd = txtUsrPwd.getText();
                        strCnfPwd = txtCnfUsrPwd.getText();
                        frstName = txtFrstName.getText();
                        lstName = txtLstName.getText();
                        age = txtAge.getText();
                        empid = txtEmpId.getText();
                        email = txtEmail.getText();
                        sex = (String)listSex.getItemAt(0);
                        if ((usrName.length() == 0) || (strUsrPwd.length() == 0) ||
                        (strCnfPwd.length() == 0) || (frstName.length() == 0) ||
                        (lstName.length() == 0) || (age.length() == 0) ||
                        (empid.length() == 0) || (email.length() == 0))
                        JOptionPane.showMessageDialog(null,
                        "One or more entry is empty. Please fill out all entries.", "Message", JOptionPane.ERROR_MESSAGE);
                        if ((!strUsrPwd.equals(strCnfPwd))){
                             JOptionPane.showMessageDialog(null,
                             "Passwords do not match. Please try again", "Message", JOptionPane.ERROR_MESSAGE);
                        Thanks,
    Chris

    try something like this:
    import java.awt.Dimension;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.event.ActionListener;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    public class About extends JDialog {
    /** Creates new form About */
    public About(JFrame parent) {
    super(parent,true);
    initComponents();
    pack();
    Rectangle parentBounds = parent.getBounds();
    Dimension size = getSize();
    // Center in the parent
    int x = Math.max(0, parentBounds.x + (parentBounds.width - size.width) / 2);
    int y = Math.max(0, parentBounds.y + (parentBounds.height - size.height) / 2);
    setLocation(new Point(x, y));
    and from the main dialog:
    new About(this).setVisible(true);

  • Htmleditor and keystroke and backspace

    hi:
    i got a problem and have been gnawed for weeks.
    i am using textpane to implement a WYSIWYG html editor. i wanner do an action when the BACKSPACE key pressed, but the action should occure before the letter be delete from the screen or model .
    how can i do it?

    Hi,
    you can use the editor's KeyMap and override the respective keystroke with your action as in     Keymap map = getKeymap();
        KeyStroke bs = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0);
        map.addActionForKeyStroke(bs, new MyCustomizedAction());If the original action (delete letter) is to be done after your customized action has been performed, you can create a customized action which accepts another action in its constructor. In this constructor you then pass the original action for backspace and call this action from your customized one.
    See a working example of the above in class SHTMLEditorPane of open source application SimplyHTML at http://www.lightdev.com/dev/sh.htm
    Ulrich

  • Context Directory Agent ipv4 and ipv6 mappings

    I have the context directory agent 1.0 patch 2 installed and running.  It works good mostly.  We have a duel stack running ipv6 and ipv4 on our workstations.  They connect to the AD with ipv6, so the mapping is for ipv6.  Is there a way to get the ipv4 mappings?
    We need to map both addresses for the Web Filtering on the CX.

    Same question.

  • Robot class and keystrokes

    Can somebody help me? I have a 14000 plus line coded program. I need to generate software produced keystrokes. For example I would like to have my program hit the 'Enter' key instead of it being generated from the keyboard by a user. Now, I have just briefly been introduced to the Robot class and I am trying to understand it. I guess to use it I have to throw a AWTException. The problem is where I need to use the Robot class is in a JButton ActionListener(), which is on line 8000 nested in another frame. My question is how and where do I throw the AWTException in my program so that I can use the Robot class to generate an 'Enter' keystroke? I have noticed that in some sample programs the AWTException follows the opening
    public static void main(String[] args) throws AWTException
    statement. I tried attaching this in my program but the code nested in a AcitionListener did not recognize it.
    What I am hoping is that I can throw the exception in the following format:
    try
    Robot robot = new Robot();
    robot.keypressed(VK_ENTER);
    catch (AWTException exception)
    exception.printStackTrace();
    This is just a format I made up to show what I am looking for it has no actual copyright.
    I do not want to throw the AWTExecption for my whole program just this localized area when I need to have the software hit enter for me.
    Anyway, this is my problem can you help me out
    Derek.

    I just figured the problem out myself, by just guessing believe it or not.
    As follows :
    try
    Robot rob = new Robot():
    rob.keyPressed(VK_ENTER);
    catch(AWTException exception)
    exception.printStackTrace();
    It worked perfectly.

Maybe you are looking for

  • Error Installing the SALESTRACK analytic workspace in the OLAPTRAIN schema

    Hello all, I am working on Oracle 11g v.11.1.0. When I am trying to install the SALESTRACK aw, it gives me an error saying,'OLAP error,Unable to parse the XML string returned from client to server'. What actually does the error denote? And how shall

  • A page from a template doesn't inherit a background image.

    I created a template and gave it a background image, tested in the browser, and it worked fine. Then I made a page from that template and it simply didn't show the background image, even though all the other components showed up properly. Any ideas a

  • Photo stream stopped working

    I was using photo stream and right in the middle of it it just stopped. Now it won't transfer anymore of my pictures. I have 2 "new" iPads and was trying to load all of my pics from one to the other.

  • Creation of VMs question

    Hi All I have worked with VM's before but i just want some general assistance/advise/idea , im currently wanting to do an experiment in regards to server 2008 R2, heres what i want to do. I want to run Forefront, DC and Exchange via one machine. my q

  • How to keep saved passwords before uninstallation

    I want to do a fresh instal of FF, but would like to keep ONLY my saved passwords and nothing else. Can some kind person tell me how please?