Fetching keystrokes in a JDialog ?

Hi !
Is there an easy way to fetch any keystrokes (F1 for example) in a JDialog without having to modify the input map for each component of the dialog ?
Mikael

Use
public final void setInputMap(int condition, InputMap map)
on the rootpane of the JDialog
with the condition WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
Denis

Similar Messages

  • Displaying one JDialog window at a time

    Hi,
    I'm having some trouble trying to write a code where only one JDialog window appears at one time.
    -so when one jdialog box appears, no other jdialog can appear
    -I was thinking about using a boolean but it didn't work at all
    Here's my code:
    iimport javax.swing.*;
    import java.awt.event.*;
    public class Data extends JFrame
         JMenuItem existingRental;
         JMenuItem newRental;
         boolean one = true;
         public Data(){
              createMainMenu();
              setSize(350, 100);
              setVisible(true);
              setLocationRelativeTo(null);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public static void main(String[] args){
              new Data();
         private void createMainMenu(){
              JMenuBar mainMenuBar = new JMenuBar();  //notice - used JMenuBar
              setJMenuBar(mainMenuBar);
              JMenu windowMenu = new JMenu("Window");
              windowMenu.setMnemonic('w');
              mainMenuBar.add(windowMenu);
              newRental = new JMenuItem("New Rental");
              newRental.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
              newRental.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e){
                        new Rental();
                        one = true;
                        if(!one)
                             new ExistingRentals();
              existingRental = new JMenuItem("Existing Rentals");
              existingRental.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK));
              existingRental.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e){
                        new ExistingRentals();
                        one = true;
                        if(!one)
                             new Rental();
              windowMenu.add(newRental);
              windowMenu.add(existingRental);
    }JDialog two
    import javax.swing.*;]
    import java.awt.*;
    public class ExistingRentals extends JDialog
         private JList list;
         private JScrollBar scrollHorizontal;
         public ExistingRentals()
              existingRentalAgreement();
              setTitle("Rental List");
              setSize(200, 500);
              setVisible(true);
              setLocationRelativeTo(null);
         public void existingRentalAgreement()
              Container container = getContentPane();
              container.setLayout(new BorderLayout());
              list = new JList();
              scrollHorizontal = new JScrollBar(JScrollBar.HORIZONTAL);
              add(scrollHorizontal, BorderLayout.SOUTH);
              scrollHorizontal.add(list);
    }

    What if you made your jdialog modal. this can be done by passing a boolean parameter set to "true" to the JDialog super constructor. Here is what I mean with some other minor changes:
    ExistingRentals class ----------------------------------------
    import javax.swing.*;
    import java.awt.*;
    public class ExistingRentals extends JDialog
        private JList list;
        private JScrollBar scrollHorizontal;
        public ExistingRentals(JFrame parent, String title)
            super(parent, true); // true here makes dialog modal.[captain.obvious]false does the opposite[/captain.obvious]
            existingRentalAgreement();
            setTitle(title);
            setSize(200, 500);
            setVisible(true);
            setLocationRelativeTo(null);
        public void existingRentalAgreement()
            Container container = getContentPane();
            container.setLayout(new BorderLayout());
            list = new JList();
            scrollHorizontal = new JScrollBar(JScrollBar.HORIZONTAL);
            add(scrollHorizontal, BorderLayout.SOUTH);
            scrollHorizontal.add(list);
    import javax.swing.*;
    import java.awt.event.*;
    public class Data extends JFrame
        JMenuItem existingRental;
        JMenuItem newRental;
        boolean one = true;
        public Data() {
            createMainMenu();
            setSize(350, 100);
            setVisible(true);
            setLocationRelativeTo(null);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        public static void main(String[] args)
            new Data();
        private void createMainMenu()
            JMenuBar mainMenuBar = new JMenuBar(); // notice - used JMenuBar
            setJMenuBar(mainMenuBar);
            JMenu windowMenu = new JMenu("Window");
            windowMenu.setMnemonic('w');
            mainMenuBar.add(windowMenu);
            newRental = new JMenuItem("New Rental");
            newRental.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,
                    ActionEvent.CTRL_MASK));
            newRental.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    newRentalAction(e);
            existingRental = new JMenuItem("Existing Rentals");
            existingRental.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,
                    ActionEvent.CTRL_MASK));
            existingRental.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    existingRentalAction(e);
            windowMenu.add(newRental);
            windowMenu.add(existingRental);
        private void existingRentalAction(ActionEvent e)
            new ExistingRentals(this, "Existing Rental List");
            // one = true;
            // if (!one) new Rental();
        private void newRentalAction(ActionEvent e)
            // one = true;
            // if (!one)
            new ExistingRentals(this, "New Rental List");
            // new Rental();
    }

  • Tranfer data from a jdialog to a frame!

    Hello, everybody?!That is my doubt!!There's a jtable inside a jdialog, when a row was selected, and the "enter" key was pressed, i'd like to send the data to a frame (main).How could i create that?Thanks!!

    here's something rough - just sets the selection as the label's text. modify for the row data
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    class Testing
      JLabel selection = new JLabel("Selected Value = ");
      public void buildGUI()
        JButton btn = new JButton("Get Selection");
        final JFrame f = new JFrame();
        f.getContentPane().add(selection,BorderLayout.NORTH);
        f.getContentPane().add(btn,BorderLayout.SOUTH);
        f.setSize(200,80);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
        btn.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            final JDialog d = new JDialog();
            Object[] cols = {"A","B","C"};
            Object[][] data = {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15}};
            final JTable table = new JTable(data,cols){
              public boolean isCellEditable(int row, int col){
                return false;
            JScrollPane sp = new JScrollPane(table);
            sp.setPreferredSize(new Dimension(100,100));
            d.setModal(true);
            d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
            d.getContentPane().add(sp);
            d.pack();
            d.setLocationRelativeTo(f);
            Action enterAction = new AbstractAction(){
              public void actionPerformed(ActionEvent ae){
                selection.setText("Selected Value = " +
                table.getValueAt(table.getSelectedRow(),table.getSelectedColumn()));
                d.dispose();
            InputMap im = table.getInputMap(JTable.WHEN_FOCUSED);
            KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
            im.put(enter, "enter");
            table.getActionMap().put(im.get(enter), enterAction);
            d.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How to diable JDialog on refresh of a data in a tab

    Hi,
    I have an application which has a tab1 which contains a Jtable.On clicking a cell in Jtable a JDialog appears showing some more info on the cell clicked.
    Now i want to do this...
    When i refresh the tab1 the corresponding Jdialog should become empty without any value, assuming that tab1 content has changed.
    How i can go about doing the above?
    A simple code snippet/idea would be of great help.
    Thanks.

    Continued code
    fetch();
                        fetch2();
                        /*table.tableChanged(new TableModelEvent(table.getModel()));
                        if (pane != null) {
                             pane.setMessage("");
                        table.repaint();
                        table2.tableChanged(new TableModelEvent(table2.getModel()));
                        if (pane2 != null) {
                             pane2.setMessage("");
                        table2.repaint();*/
              lookup.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        /*if(b1!= true){
                             System.out.println("Coming");
                             JTabbedPane tabbedPane = new JTabbedPane();
                             JPanel phones = new JPanel();
                             mtm = new DefaultTableModel(columnNames, 2);
                             JTable table = new JTable();
                             table =  new JTable(mtm);
                             //JPanel phones = new JPanel();
                             JScrollPane scroller = new JScrollPane();
                             JPanel p = new JPanel(new BorderLayout());
                             JPanel topPanel = new JPanel();
                             JButton lookup = new JButton("Lookup");
                             scroller = new JScrollPane(table);
                             topPanel.add(lookup);
                             phones.add(scroller);
                             tabbedPane.addTab("Phones", phones);
                             p.add(topPanel, BorderLayout.NORTH);
                             p.add(tabbedPane, BorderLayout.CENTER);
                             setContentPane(p);
                             pack();
                             di = new Dbi();
                             fetch();
                             if (pane != null) {
                                  pane.setMessage("");
                             table.repaint();
                             b1=true;
                             System.out.println("Going");
                        fetch();
                        table.tableChanged(new TableModelEvent(table.getModel()));
                        if (pane != null) {
                             pane.setMessage("");
                        table.repaint();
                        //table.setModel(new DefaultTableModel(0, 0));
                        //b1=false;
              lookup1.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        fetch2();
                        table2.tableChanged(new TableModelEvent(table2.getModel()));
                        if (pane2 != null) {
                             pane2.setMessage("");
                        table2.repaint();
                        //table.setModel(new DefaultTableModel(0, 0));
         public void fetch() { // time-consuming task should be run
              Thread t = new Thread() { // in a separate thread
                   public void run() {
                        dbResult = di.getQueryResult("QUERY!!!!!");
                        mtm.setDataVector(dbResult, cnv);
              t.start(); // actionPerformed() immediately returns, not blocking GUI
         public void fetch2() { // time-consuming task should be run
              Thread t = new Thread() { // in a separate thread
                   public void run() {
                        dbResult = di2.getQueryResult("QUERY!!!!!");
                        mtm2.setDataVector(dbResult, cnv);
              t.start(); // actionPerformed() immediately returns, not blocking GUI
         public static void main(String[] args) {
              TestJava frame = new TestJava();
              frame.setVisible(true);
    class Dbi{ // make it a separate public class
         // meaningfull constructors, db connecton etc.
         public Vector<Vector> getQueryResult(String query) {
              Vector<String> v1 = new Vector<String>();
              Vector<String> v2 = new Vector<String>();
              Vector<String> v3 = new Vector<String>();
              Vector<String> v4 = new Vector<String>();
              v1.addAll(Arrays.asList(new String[] { "Tim Marshall",
                        "http://tim.marshall/", "Never never land" }));
              v2.addAll(Arrays.asList(new String[] { "Com Commercial",
                        "http://com.comcom/", "Land of gold" }));
              v3.addAll(Arrays.asList(new String[] { "Love Lovable",
                        "http://love.neverhate/", "Sun lotus state" }));
              v4.addAll(Arrays.asList(new String[] { "War Monger",
                        "http://war.momongers/", "Fire and ice city" }));
              Vector<Vector> v0 = new Vector<Vector>();
              v0.add(v1);
              v0.add(v2);
              v0.add(v3);
              v0.add(v4);
              return v0;
         // other important methods
    class Dbi2{ // make it a separate public class
         // meaningfull constructors, db connecton etc.
         public Vector<Vector> getQueryResult(String query) {
              Vector<String> v1 = new Vector<String>();
              Vector<String> v2 = new Vector<String>();
              Vector<String> v3 = new Vector<String>();
              Vector<String> v4 = new Vector<String>();
              v1.addAll(Arrays.asList(new String[] { "Ran Rand",
                        "http://tim.marshall/", "Never never land" }));
              v2.addAll(Arrays.asList(new String[] { "Jim Corbet",
                        "http://com.comcom/", "Land of gold" }));
              v3.addAll(Arrays.asList(new String[] { "Ram Jim",
                        "http://love.neverhate/", "Sun lotus state" }));
              v4.addAll(Arrays.asList(new String[] { "Click Thick",
                        "http://war.momongers/", "Fire and ice city" }));
              Vector<Vector> v0 = new Vector<Vector>();
              v0.add(v1);
              v0.add(v2);
              v0.add(v3);
              v0.add(v4);
              return v0;
         }

  • How to disable detection of ESCAPE key in JDialog?

    Hi,
    I've implemented a non-modal JDialog, and to be sure the user doesn't close it I call setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE)However, the user can always close it by pressing the ESCAPE key.
    Key binding does not work as the dialog is not a JComponent, and a KeyListener seems not to work.
    Is there a way to catch the ESCAPE key?
    Thanks in advance for any hint.

    However, the user can always close it by pressing the ESCAPE key.Is this a new feature in JDK1.5 or JDK6?
    The escape key is not supported by default in JDK1.4.2 so I'm surprised that its turned on by default in later versions.
    This is how I add the funtionality in JDK1.4.2:
    Action escapeAction = new AbstractAction()
         public void actionPerformed(ActionEvent e)
              System.out.println("escape");
              setVisible( false );
    KeyStroke escapeKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
    getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
         .put(escapeKeyStroke, "escape");
    getRootPane().getActionMap().put("escape", escapeAction);So, presumably you could override the default behaviour by using a dummy Action.

  • Enabling non-modal JDialog

    I have created a JDialog which is non-modal. This dialog has lot of controls viz. buttons, combo box etc. This dialog is launched on clicking a button placed on panel. Surprisingly, when the dialog is launched, all components are disabled. Is there any way I can make these enabled? There is no line of code which has been done to change the behaviour of these components. They work fine if I make the dialog modal. Please advice.

    Thanks.
    The constructor for creating the dialog is pasted as below:
    public AbstractDialog(Frame owner, String title, boolean isModal) {
              super(owner, title, isModal);
              JRootPane rootPane = getRootPane();
              Action escapeKeyAction = new AbstractAction() {
         public void actionPerformed(ActionEvent e) {
         AbstractDialog.this.dispose();
              rootPane.registerKeyboardAction( escapeKeyAction,
    KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0 ),
    JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
              UFSAFocusTraversalPolicy obj = new UFSAFocusTraversalPolicy ();
              //obj.setImplicitDownCycleTraversal(false);
              this.setFocusTraversalPolicy(obj);
              this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
         this.setFocusCycleRoot(true);
         this.addWindowListener(windowAdapter);
    The isModal passed is false.

  • Non modal JDialog

    Hi All,
    I want a non modal JDialog which is used to show the message to the user that it is searching for the records, when a search is performed and records are retrieved from the database. When the search is going on user might hit cancel on the JDialog to cancel the search. My problem is, the cancel button on the Search dialog is not catching the event and user is not able to select the cancel option on the dialog.
    Here is my code :
    class SearchWindow extends JDialog {
    private JPanel btnPanel;
    private JLabel lblSearch;
    private JButton btnCancel;
    * Constructor
    public SearchWindow() {
    super((Frame)null, false);
    setTitle("Searching Shipment Legs");
    cancelled = false;
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent evt) {
    close();
    Container contentPane = getContentPane();
    contentPane.setLayout(null);
    addButtons();
    pack();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setSize(new Dimension(300, 100));
    setSize(300,100);
    setLocation((screenSize.width-700)/2,(screenSize.height-450)/2);
    private void addButtons() {
    btnPanel = new JPanel();
    btnPanel.setLayout(new BorderLayout());
    lblSearch = new JLabel("Searching..........");
    btnCancel = new JButton("Cancel");
    btnPanel.setBackground(Color.lightGray);
    lblSearch.setBackground(Color.lightGray);
    btnCancel.setBackground(Color.lightGray);
    btnPanel.add(lblSearch, BorderLayout.CENTER);
    btnPanel.add(btnCancel, BorderLayout.SOUTH);
    btnCancel.addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent evt) {
    System.out.println("cancel");
    cancelled = true;
    close();
    btnPanel.setBounds(0,0,200,50);
    this.getContentPane().add(btnPanel);
    lblSearch.setVisible(true);
    btnCancel.setVisible(true);
    this.getContentPane().validate();
    public void close() {
    this.setVisible(false);
    this.dispose();
    public void show() {
    super.show();
    paintComponents(getGraphics());
    this.setModal(false);
    Any help is greatly appreciated.
    Thanks,
    Bhaskar

    Hi Haroldsmith
    I am calling this search window in one of my programs where on button click it will fetch the records from the database. When this process is on, search dialog is shown up. Ths dialog is shown correctly and its getting closed as soon as the search is completed. But the probelm is its not allowing me to click on cancel button.
    Bhaskar

  • Initializing JDialogs or Other GUI Components within SwingWorker

    Hello Every one,
    I have been using SwingWorker class heavily in my application and recently I noticed that If I click on a button twice or thrice the third or 4th it takes more time to perform the action in which SwingWorker is being used. So I started reading more about SwingWorker and after reading number of articles and posts on this forum I believe I am not using SwingWorker correctly. But, I am not still sure ( or may be I am afriad or I am not ready to change my code in so many files and so many locations :(
    So I thought to ask some gurus following questions, in this forum before I proceeed with the code refactoring.
    Question 1:* I am performing GUI operations in doInBackground() is it ok to perform swing operations or create swing components in this method of SwingWorker?
    Example Code :
    jbtnModifyUser Action Event
    private void jbtnModifyUserActionPerformed(java.awt.event.ActionEvent evt) {
    setButtonsState(false);
    final SwingWorker worker = new SwingWorker() {
    protected Object doInBackground() {
    try {
    openUserModifierDialog(SELECTED_PROFILE);
    } catch (Exception ex) {
    ex.printStackTrace();
    } finally {
    return null;
    public void done()
    setButtonsState(true);
    worker.execute();
    }Open Dialog Method wich I call from several other Swing Components Action performed event
    private void openUserModifierDialog(UserProfile profile) throws ServerException {
    UserModifierDialog modifier = new UserModifierDialog(_frame, true, profile);
    modifier.pack();
    modifier.setVisible(true);
    if (modifier.isModified()) {
    resetFields();
    populateUserTable();
    } If I click 3 to 4 times same button the 4th or 5th time the dialog opens after soem delay like 10 seconds. But in first two three click it opens quickly like in 2 to 3 seconds. Is it due to the fact that I am perfoming Swing GUI operations in doInBackgroundMethod()?
    Question 2: Should I use EventQueue.invokeLater() but as far as I have learned from the articles, the actionPerformed events already run on EDT.
    Question 3:_ Each dialog has multiple swing components like combo boxes, tables, tress which it populates after fetching data from the Database in its constructor. It takes like 1 to 2 seconds to bring data and initialize all swing components. Once the Dialog is initialized in the constructor I call my own function to set the existing user details ( As shown below ).
    I need to set all the details before I show the Dialog to the user. To achieve this what is the best practice? Where should I use SwingWorker in current scenario? in Dialog's PostInitialize()? In Dialog's Constructor()? or in the Frame's openModifierDialog()?
    public UserModifierDialog(java.awt.Frame parent, boolean modal, UserProfile userprofile)
    throws ServerException {
    super(parent, modal);
    if (userprofile != null) {
    SELECTED_USER_PROFILE = userprofile;
    }else{
    //throw new Exception("Invalid user record. User profile cannot be null. ");
    initComponents();
    postInitialize(); // my function called to set the user details on the screen
    private void postInitialize() throws ServerException {
    _userManager = new UserManager();
    initializeAllPermissions();
    initializeUserGroups();
    setFields(SELECTED_USER_PROFILE);
    private void initializeUserGroups() throws ServerException {
    _jcbUserGroup.removeAllItems();
    _jcbUserGroup.setModel(new ArrayListModel(_userManager.getAllUserGroups ()));
    _jcbUserGroup.setSelectedIndex(0);
    private void setFields(Userprofile profile) throws ServerException{
    _jlblUserID.setText(profile.getUserid().toString());
    _jtfUserName.setText(profile.getUsername());
    _jtfFirstName.setText(profile.getFirstname());
    _jtfLastName.setText(profile.getLastname());
    _jtfPassword.setText(profile.getPassword());
    _jtfConfirmPassword.setText(profile.getPassword());
    _jtaDescription.setText(profile.getDescription());
    _jcbUserGroup.setSelectedItem(_userManager.getUserGroup(profile.getUserGroupID()));
    } Question 4: I noticed that if I use following code in my openModifierDialog function to execute the worker rather then its own execute method the dialog opens quickly each time.
    Is it good idea to use the following to execute a SwingWorker or I shouldn't as I may fall in some threading issues later on which I am not aware of?
    Thread t = new Thread(worker);
    t.start();Hope to hear some useful comments / answers to my queries.
    Thanks in advance.
    Regards

    Thanks for your prompt reply and answers to my queries.
    Well, I know there are enormous faults in this code. Thats why I am seeking guru's advice to clean the mess. Let me give you breif background of the code. The current code was written by some one else using old version of SwingWorker and I am just trying to clean the mess.
    All the JDialog or Swing Components intialization code was in construct() method of previous SwingWorker. Later on when the SwingWorker became the part of Java SE 6 all application code was refactored and the GUI components initialization was moved to the new function doInBackground().
    The sample code represents the current condition of the code. All I needed was a shortcut to clean the mess or to avoid changes at so many places. But it seems that there is no easy workout for the current situation and I have to change the entire application code. I have gone through the SwingWorker API and tutorial @ [http://java.sun.com/developer/technicalArticles/javase/swingworker] and I am doing following to clean this mess.
    Well the following code is proposed refactoring of the previous code. Hope to hear your comments on it.
    private void jbtnModifyUserActionPerformed(java.awt.event.ActionEvent evt) {
    try{
    openUserModifierDialog(SELECTED_PROFILE);
    } catch (Exception ex) {
    logger.error(ex);
    //show some message here
    } finally {
    private void openUserModifierDialog(UserProfile profile) throws ServerException {
    UserModifierDialog modifier = new UserModifierDialog(_frame, true, profile);
    modifier.pack();
    modifier.setVisible(true);
    if (modifier.isModified()) {
    resetFields();
    //UserModifierDialog Constructor
    public UserModifierDialog(java.awt.Frame parent, boolean modal, UserProfile userprofile)
    throws ServerException {
    super(parent, modal);
    if (userprofile != null) {
    SELECTED_USER_PROFILE = userprofile;
    } else {
    //throw new Exception("Invalid user record. User profile cannot be null. ");
    initComponents();
    postInitialize(); // My function called to set the user details on the screen
    private void postInitialize() {
    _userManager = new UserManager();
    setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
    final SwingWorker worker = new SwingWorker() {
    protected Object doInBackground() {
    try {
    return _userManager.getAllUserGroups(); //returns ArrayList of all user groups from database
    } catch (ServerException ex) {
    //Show Message here
    return null;
    protected void done() {
    try {
    if (get() != null) {
    _jcbUserGroup.setModel(new ArrayListModel((ArrayList) get()));
    _jcbUserGroup.setEditable(false);
    setFields(SELECTED_USER_PROFILE);
    else
    //show some error to user that data is empty
    } catch (InterruptedException ex) {
    //show message here
    } catch (ExecutionException ex) {
    //show message here
    } finally {
    setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
    worker.execute();
    private void setFields(Userprofile profile) throws ServerException {
    _jlblUserID.setText(profile.getUserid().toString());
    _jtfUserName.setText(profile.getUsername());
    _jtfFirstName.setText(profile.getFirstname());
    _jtfLastName.setText(profile.getLastname());
    _jtfPassword.setText(profile.getPassword());
    _jtfConfirmPassword.setText(profile.getPassword());
    _jtaDescription.setText(profile.getDescription());
    _jcbUserGroup.setSelectedItem(_userManager.getUserGroup(profile.getUserGroupID()));
    }In some places where data is way too huge I am going to use process and publish methods of SwingWorker.
    Now I have another question, how I can notify/throw any exceptions occured inside SwingWorker doInBackground method or done method to the function who executed SwingWorker. Currenlty I am catching the excpetions in the done method and showing a dialog box. But I want to throw it to the postInitialize method the method who created and executed the Worker. What is the best practice of handling exceptions in SwingWorker methods.
    Do you see any problems in proposed refactoring?
    Hope to hear your comments.
    Regards

  • Keystrokes for button actions in JOptionPane

    When running my app in Windows, the Alt key must be pressed to cause the "Yes" button or "No" button to respond from the keyboard. Can I set an option in JOptionPane, or elsewhere, to not require pressing the Alt key to activate a button in JOptionPane?

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    * Class JPSOptionPane
    * @author Sreenivasa Reddy M
    * @version 1.0
    public class JPSOptionPane {
    private static boolean isKeyPressed;
    private static Object selectedValue;
    * Method showOptionDialog
    * @param parentComponent
    * @param message
    * @param title
    * @param optionType
    * @param messageType
    * @param icon
    * @param options
    * @param initialValue
    * @return
    public static int showOptionDialog (Component parentComponent,
    Object message, String title,
    int optionType, int messageType,
    Icon icon, Object [] options,
    Object initialValue) {
    JOptionPane pane = new JOptionPane (message, messageType, optionType,icon, options, initialValue);
    pane.setInitialValue (initialValue);
    HashSet hash1 = new HashSet ();
    hash1.add (AWTKeyStroke.getAWTKeyStroke (KeyEvent.VK_UP, 0,true));
    hash1.add (AWTKeyStroke.getAWTKeyStroke (KeyEvent.VK_TAB, 0,true));
    pane.setFocusTraversalKeys (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,hash1);
    HashSet hash2 = new HashSet ();
    hash2.add (AWTKeyStroke.getAWTKeyStroke (KeyEvent.VK_TAB, 1, true));
    hash2.add (AWTKeyStroke.getAWTKeyStroke (KeyEvent.VK_DOWN, 0, true));
    final JDialog dialog = pane.createDialog (parentComponent, title);
    pane.setFocusTraversalKeys (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, hash2);
    ActionListener yActionLis=new ActionListener(){
    public void actionPerformed(ActionEvent e){
    isKeyPressed=true;
    dialog.dispose();
    selectedValue=new Integer(0);
    KeyStroke ks_y=KeyStroke.getKeyStroke(KeyEvent.VK_Y,8,true);
    pane.registerKeyboardAction(yActionLis,ks_y,JComponent.WHEN_IN_FOCUSED_WINDOW);
              ActionListener nActionLis=new ActionListener(){
    public void actionPerformed(ActionEvent e){
    isKeyPressed=true;
    dialog.dispose();
    selectedValue=new Integer(1);
    KeyStroke ks_n=KeyStroke.getKeyStroke(KeyEvent.VK_N,8,true);
    pane.registerKeyboardAction(nActionLis,ks_n,JComponent.WHEN_IN_FOCUSED_WINDOW);
    pane.selectInitialValue();
    dialog.show ();
    if(!isKeyPressed){
    dialog.dispose ();
    selectedValue = pane.getValue();
              isKeyPressed=false;
    else{
              isKeyPressed=false;
    return ((Integer) selectedValue).intValue ();
    if (selectedValue == null) {
    return JOptionPane.CLOSED_OPTION;
    if (options == null) {
    if (selectedValue instanceof Integer) {
    return ((Integer) selectedValue).intValue ();
    return JOptionPane.CLOSED_OPTION;
    for (int counter = 0, maxCounter = options.length; counter < maxCounter; counter++) {
    if (options [counter].equals (selectedValue)) {
    return counter;
    return JOptionPane.CLOSED_OPTION;
    * Method showInputDialog
    * @param parentComponent
    * @param message
    * @param title
    * @param messageType
    * @param icon
    * @param selectionValues
    * @param initialSelectionValue
    * @return
    * @throws HeadlessException
    public static Object showInputDialog (Component parentComponent,
    Object message, String title,
    int messageType, Icon icon,
    Object [] selectionValues,
    Object initialSelectionValue)
    throws HeadlessException {
    JOptionPane pane = new JOptionPane (message, messageType,JOptionPane.OK_CANCEL_OPTION,
    icon, null, null);
    HashSet hash1 = new HashSet ();
    hash1.add (AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_UP,0,true));
    pane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, hash1);
    HashSet hash2 = new HashSet ();
    hash2.add(AWTKeyStroke.getAWTKeyStroke (KeyEvent.VK_DOWN, 0,true));
    pane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, hash2);
    pane.setWantsInput (true);
    pane.setSelectionValues (selectionValues);
    pane.setInitialSelectionValue (initialSelectionValue);
    JDialog dialog = pane.createDialog (parentComponent, title);
    pane.selectInitialValue();
    dialog.show();
    dialog.dispose();
    Object value = pane.getInputValue();
    if (value == JOptionPane.UNINITIALIZED_VALUE){
    return null;
    return value;
    public static void showMessageDialog(Component parentComponent,
    Object message)
    throws HeadlessException{
    JOptionPane.showMessageDialog(parentComponent,message);
    public static void showMessageDialog(Component parentComponent,
    Object message,
    String title,
    int messageType)
    throws HeadlessException{
    JOptionPane.showMessageDialog(parentComponent,message,title,
    messageType);
    public static void showMessageDialog(Component parentComponent,
    Object message,
    String title,
    int messageType,
    Icon icon)
    throws HeadlessException{
    JOptionPane.showMessageDialog(parentComponent,message,title,
    messageType,icon);

  • Esc key not working with JDialog

    Hi,
    We are facing a KeyListening problem with JDialog. We developed an application using JRE 1.4.0. When we migrate from 1.4.0 to 1.4.2.The Esc keys(All keys) associated with the JDialog is not listening. Following is code piece is showing the Esc key. The same piece of code is working with 1.4.0 and with lesser versions. U'r help will be appriciated.
    import java.awt.Container;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JPanel;
    public class EscDialog extends JDialog implements KeyListener {
         static EscDialog ed = new EscDialog();
         public static void main(String[] args) {
              ed.setSize(200, 300);
              ed.addKeyListener(ed);
              JButton jb = new JButton("Test");
              JPanel jp = new JPanel();
              jp.add(jb);
              Container cp = ed.getContentPane();
              cp.add(jp);
              ed.show();
         public void keyPressed(KeyEvent anEvent) {
              if (anEvent.getKeyCode() == KeyEvent.VK_ESCAPE)
                   System.exit(0);
         public void keyTyped(KeyEvent anEvent) {
         public void keyReleased(KeyEvent anEvent) {
    }

    An example:import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JDialog {
        public Test () {
            getContentPane ().setLayout (new FlowLayout ());
            getContentPane ().add (new JLabel ("Press escape to exit..."));
            getRootPane ().getInputMap ().put (KeyStroke.getKeyStroke (KeyEvent.VK_ESCAPE, 0), "dispose");
            getRootPane ().getActionMap ().put ("dispose", new AbstractAction () {
                public void actionPerformed (ActionEvent event) {
                    dispose ();
            pack ();
            setDefaultCloseOperation (DO_NOTHING_ON_CLOSE);
            setLocationRelativeTo (null);
            setTitle ("Test");
            setVisible (true);
        public static void main (String[] parameters) {
            new Test ();
    }Kind regards,
      Levi

  • Cannot override Ctrl + C in JDialog

    Hey guys I cannot override the Ctrl+C function in JDialog for some reason. I can get other combos to work (Ctrl + O) but no cigar with C.
    Below is the code I'm using, Im wondering if anyone has any suggestions?
    Thanks
              KeyStroke ctrlCKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK, false);          
              Action closeWindow = new AbstractAction()
                   public void actionPerformed(ActionEvent e)
                        System.out.println("hello");
                        setVisible(false);
              _mainPanel.getInputMap().put(ctrlCKeyStroke, "none");
              _mainPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
              .put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK), "CTRLC");

    I am no expert in this, but I think that you have to bind the InputMap for the JTextField's Ctrl-C to a null action. This unbinds the keystroke from this component. And then you have to bind it correctly for the containing control, here mainPanel. Something like so perhaps:
    import java.awt.Dimension;
    import java.awt.EventQueue;
    import java.awt.event.ActionEvent;
    import java.awt.event.InputEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.AbstractAction;
    import javax.swing.InputMap;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.KeyStroke;
    public class OverrideCtrlC
      private static final String CTRL_C_KEYSTROKE = "Control-C";
      private JPanel mainPanel = new JPanel();
      private JTextField textField = new JTextField(12);
      public OverrideCtrlC()
        mainPanel.add(textField);
        mainPanel.setPreferredSize(new Dimension(300, 200));
        setKeyBindings();
      private void setKeyBindings()
        int inputMapArg = JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT;
        InputMap inputmap = mainPanel.getInputMap(inputMapArg);
        KeyStroke ctrlCStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK);
        inputmap.put(ctrlCStroke, CTRL_C_KEYSTROKE);
        mainPanel.getActionMap().put(CTRL_C_KEYSTROKE, new CtrlCAction());
        inputmap = textField.getInputMap();
        inputmap.put(ctrlCStroke, "null"); // I don't map this to an action
      private class CtrlCAction extends AbstractAction
        public void actionPerformed(ActionEvent arg0)
          JOptionPane.showMessageDialog(mainPanel, "Control C has been pushed",
              "Ctrl-C Action", JOptionPane.INFORMATION_MESSAGE);
      public JPanel getPanel()
        return mainPanel;
      private static void createAndShowGUI()
        JFrame frame = new JFrame("OverrideCtrlC Application");
        frame.getContentPane().add(new OverrideCtrlC().getPanel());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args)
        EventQueue.invokeLater(new Runnable()
          public void run()
            createAndShowGUI();
    }Edited by: Encephalopathic on Jul 2, 2008 3:39 PM

  • Enter in JDialog

    Hello friends !
    I have JDialog with some JLabels, JSpinners and one JButton.
    The JSpinners are numerical, i.e. if I type say "bla bla" in it, I hear a beep. Only when enter a number JSpinner accepts it.
    When I click the JButton, loadPicture() called.
    I want that if I press Enter after (enter some number in the JSpinner), loadPicture() will be called.
    What should I add ?
    Below is the code of the JDialog.
    Thanks in advance !!!
    public class JCRandomCrosswordDialog extends JDialog implements ActionListener {
         private JCFrame mainFrame;
         private JTextField fillingPercentageField;
         private JSpinner rowsSpinner, columnsSpinner;
         private JButton createButton = new JButton("Create random crossword");
         public JCRandomCrosswordDialog(JCFrame mainFrame) {
                super(mainFrame, "Create random crossword", true);
                this.mainFrame = mainFrame;
                rowsSpinner = new JSpinner(new SpinnerNumberModel(mainFrame.getDefaultNumberOfRows(), 1, mainFrame.getMaxNumberOfRows(), 1));
                columnsSpinner = new JSpinner(new SpinnerNumberModel(mainFrame.getDefaultNumberOfColumns(), 1, mainFrame.getMaxNumberOfColumns(), 1));
                fillingPercentageField = new JTextField(String.valueOf(mainFrame.getDefaultPercentageOfFilling()));
                ((JSpinner.DefaultEditor)(rowsSpinner.getEditor())).getTextField().setHorizontalAlignment(JTextField.LEFT);
                ((JSpinner.DefaultEditor)(columnsSpinner.getEditor())).getTextField().setHorizontalAlignment(JTextField.LEFT);
                JCToolkit.setSelectAllFieldText(((JSpinner.DefaultEditor)(rowsSpinner.getEditor())).getTextField());
                JCToolkit.setSelectAllFieldText(((JSpinner.DefaultEditor)(columnsSpinner.getEditor())).getTextField());
                JCToolkit.setSelectAllFieldText(fillingPercentageField);
                Container contentPane = getContentPane();
                JPanel dialogPanel = new JPanel();
             dialogPanel.setLayout(new GridLayout(3, 2));
             dialogPanel.add(new JLabel("  Number of rows:", JLabel.LEFT));
             dialogPanel.add(rowsSpinner);
             dialogPanel.add(new JLabel("  Number of columns:", JLabel.LEFT));
             dialogPanel.add(columnsSpinner);
             dialogPanel.add(new JLabel("  Filling percentage:", JLabel.LEFT));
             dialogPanel.add(fillingPercentageField);
             contentPane.add(dialogPanel, BorderLayout.NORTH);
             createButton.addActionListener(this);
             contentPane.add(createButton, BorderLayout.SOUTH);
                setSize(260, 125);
         public void actionPerformed(ActionEvent e) {
              int numOfRows = getSpinnerValue(rowsSpinner, mainFrame.getDefaultNumberOfRows());
              if ((numOfRows < 1) || (numOfRows > mainFrame.getMaxNumberOfRows())) throw new NumberFormatException();
              int numOfColumns = getSpinnerValue(columnsSpinner, mainFrame.getDefaultNumberOfColumns());
              if ((numOfColumns < 1) || (numOfColumns > mainFrame.getMaxNumberOfColumns())) throw new NumberFormatException();
              try {     
                   float percentage = (Float.valueOf(fillingPercentageField.getText())).floatValue();
                   if ((percentage < 0.0f) || (percentage > 100.0f)) throw new NumberFormatException();
                   dispose();
                   ((JCFrame)getOwner()).loadPicture(JCToolkit.getRandomCrossword(numOfRows, numOfColumns, percentage / 100));
              } catch (NumberFormatException nfe) {
                   fillingPercentageField.requestFocus();
         private int getSpinnerValue(JSpinner spinner, int defaultValue) {
              try { spinner.commitEdit(); }
              catch (ParseException pe) { spinner.setValue(defaultValue); }
              return ((Integer)(spinner.getValue())).intValue();
    }

    OK, Michael. Now is much much better !
    But still 2 questions:
    1) If I type some string on the "Number of rows" spinner, then press Enter, the dialog takes the default value 10 (which I see when I enter the dialog again). But If I enter some string in the "Filling percentage" spinner, then press Enter, the dialog doesn't take the default value (it takes all the string). Why ?
    2) I want that if the entered number is out of legal range, i.e. for example ((numOfRows < 1) || (numOfRows > 99)) then pressing Enter will not close the dialog with the default values, and the user will need to enter a legal values. What should I change to add this requirement ?
    Many thanks again !!!
    Here is the last code:
    import javax.swing.*;       
    public class Test {
         private static void createAndShowGUI() {       
            JFrame frame = new JFrame("HelloWorldSwing");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            MyDialog dialog = new MyDialog(frame);
                MyMenuBar menuBar = new MyMenuBar(frame);
              frame.setJMenuBar(menuBar);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    import java.text.ParseException;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MyDialog extends JDialog implements ActionListener {
         private JFrame mainFrame;
         private JTextField fillingPercentageField;
         private JSpinner rowsSpinner, columnsSpinner;
         private JButton createButton = new JButton("Create random crossword");
         public MyDialog(JFrame mainFrame) {
                super(mainFrame, "Create random crossword", true);
                this.mainFrame = mainFrame;
                rowsSpinner = new JSpinner(new SpinnerNumberModel(10, 1, 99, 1));
                columnsSpinner = new JSpinner(new SpinnerNumberModel(20, 1, 100, 2));
                fillingPercentageField = new JTextField(String.valueOf(8.7));
                ((JSpinner.DefaultEditor)(rowsSpinner.getEditor())).getTextField().setHorizontalAlignment(JTextField.LEFT);
                ((JSpinner.DefaultEditor)(columnsSpinner.getEditor())).getTextField().setHorizontalAlignment(JTextField.LEFT);
                Container contentPane = getContentPane();
                JPanel dialogPanel = new JPanel();
                  dialogPanel.setLayout(new GridLayout(3, 2));
                  dialogPanel.add(new JLabel("  Number of rows:", JLabel.LEFT));
                  dialogPanel.add(rowsSpinner);
                  dialogPanel.add(new JLabel("  Number of columns:", JLabel.LEFT));
                  dialogPanel.add(columnsSpinner);
                  dialogPanel.add(new JLabel("  Filling percentage:", JLabel.LEFT));
                  dialogPanel.add(fillingPercentageField);
                  contentPane.add(dialogPanel, BorderLayout.NORTH);
                  createButton.addActionListener(this);
                  contentPane.add(createButton, BorderLayout.SOUTH);
                  KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {
                      public boolean dispatchKeyEvent(KeyEvent ke) {
                             if(ke.getID() == KeyEvent.KEY_PRESSED) {
                               if (((KeyEvent) ke).getKeyCode() == KeyEvent.VK_ENTER) {
                                      //createButton.doClick();
                                      if(isVisible()) createButton.doClick();
                             return false;
                setSize(260, 125);
         public void actionPerformed(ActionEvent e) {
              int numOfRows = getSpinnerValue(rowsSpinner, 10);
              if ((numOfRows < 1) || (numOfRows > 99)) throw new NumberFormatException();
              int numOfColumns = getSpinnerValue(columnsSpinner, 20);
              if ((numOfColumns < 1) || (numOfColumns > 100)) throw new NumberFormatException();
              try {     
                   float percentage = (Float.valueOf(fillingPercentageField.getText())).floatValue();
                   if ((percentage < 0.0f) || (percentage > 100.0f)) throw new NumberFormatException();
              } catch (NumberFormatException nfe) {
                   fillingPercentageField.requestFocus();
              } finally {
                   dispose();
              JOptionPane.showMessageDialog(mainFrame, "OK", "Important Message", JOptionPane.PLAIN_MESSAGE);
         private int getSpinnerValue(JSpinner spinner, int defaultValue) {
              try { spinner.commitEdit(); }
              catch (ParseException pe) { spinner.setValue(defaultValue); }
              return ((Integer)(spinner.getValue())).intValue();
    import javax.swing.*;
    import java.awt.event.*;
    public class MyMenuBar extends JMenuBar implements ActionListener {
         private JFrame mainFrame;
         private JMenuItem showDialog;
         private MyDialog dialog;
         public MyMenuBar(JFrame mainFrame) {
              this.mainFrame = mainFrame;
              dialog = new MyDialog(mainFrame);
              JMenu menu = new JMenu("Misc");    
              menu.setMnemonic(KeyEvent.VK_M);
              showDialog = new JMenuItem("Show dialog");
              showDialog.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, 0));
              showDialog.addActionListener(this);
              menu.add(showDialog);
              add(menu);
         public void actionPerformed(ActionEvent e) {
              if (e.getSource() == showDialog) {
                   dialog.setVisible(true);
                   return;
    }

  • How to remove the icon of java in JDialog?

    How to remove the icon of java in JDialog, and change it to my own icon.

    Please make the extra effort to write out words such as "please" and "your". The extra keystrokes won't cost much in the way of time, and the enhanced clarity will be appreciated by those communicating on a forum with international readership.

  • KeyStroke Problem...

    Hi
    I added KeyStroke to mainPanel to look for Enter key pressed using InputMap and ActionMap. The requirement is whereever the focus is pressing enter next button should be activated.
    It works okay when no dialog is used inside the panel. But when a JOptionPane or JDialog is created hitting enter on dialog buttons, the keystroke is also passed to the panel. Which is not allowing the dialog to close. Do any one have solution for this?
    Im aware of the optional way to add KeyListener to all the components in the mainPanel which i dont want to do...
    I have attached the sample code....
    public class KeyStroke extends JFrame implements ActionListener {
         private JButton next;
         public KeyStroke(){
              JPanel mainPanel=new JPanel();
              JTextField textarea=new JTextField(15);
              next=new JButton("Next");
              next.addActionListener(this);
    mainPanel.add(textarea);
              mainPanel.add(next);
              Action pressedEnterKeyAction = new AbstractAction() {
                   public void actionPerformed(ActionEvent arg0) {
         next.doClick();
    mainPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ).
                   put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0,true),"pressedEnter");
    mainPanel.getActionMap().put("pressedEnter",     pressedEnterKeyAction);
              this.getContentPane().add(mainPanel);
         public void actionPerformed(ActionEvent e) {
              JOptionPane.showMessageDialog(this,     "Button Clicked", "dialog",
                                  JOptionPane.INFORMATION_MESSAGE);
    *************************************************

    1) Use the "code" tags when posting code so it retains its original formatting.
    2) Use a better name for your test class. KeyStroke is a class in the JDK
    3) The code you posted isn't compilable or executable.

  • Configuring what element gets enter key press in JDialog?

    Hi all,
    In windows applications, some dialogs or windows, have a specific button that gets activated when enter is pressed. E.g. in a JDialog, the OK button would normally be activated when no button had focus. How do you set this to be? Is there some API call to do this? And is there some way to do the same with the escape key, so that cancel will always get triggered when its pressed?
    I just don't want to have to manually add a key listener to each component in the dialog that listens for the escape and enter buttons to be pressed.
    thanks,
    J

    As for the Esc key, there is nothing "out of the box" to do this. I created a JDialog sub-class to handle it, which I use in place of JDialog throughout my app. In the JDialog sub-class, over-ride the createRootPane() method as follows:
        * Overriding this method to register an action so the 'Esc' key will dismiss
        * the dialog.
        * @return a <code>JRootPane</code> with the appropiate action registered
       protected JRootPane createRootPane()
          JRootPane pane = super.createRootPane();
          pane.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW ).
             put( KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0 ), "escPressed" );
          pane.getActionMap().put( "escPressed",
             new AbstractAction( "escPressed" )
                public void actionPerformed( ActionEvent actionEvent )
                   onDialogClose();
          return pane;
       }then, create an abstract onDialogClose() method like the following:
        * This method gets called when the user attemps to close the JDialog via the
        * 'Esc' key.  It is up to the sub-class to implement this method and handle
        * the situation appropriately.
       protected abstract void onDialogClose();Alternatively, you could create a default implemenation of onDialogClose() instead of making it abstract; sub-classes could still over-ride it if they needed custom behavior.
    HTH,
    Jamie

Maybe you are looking for

  • How do I enforce "Show My Picture" instead of "Hide My Picture" in Lync Server 2013?

    I was scouring TechNet and the web for a script that could perform the same task as one that I previously used for Lync 2010. In Lync 2010, we had already used Lync policy to enforce that only the Active Directory photo could be used. One thing that

  • Balance Sheet in Profit Center

    Hello All, How can you generate balance sheets for Profit Centers when the profit centers are linked to the sales order? so that whenever there is a sales order generated, the line items are all assigned to the profit centers. Thanks, Please respond

  • How do you turn on pano in the camera

    How do you turn on Pano in the camera? At the bottom of the screen I can see a partial pano word, but nothing happens when I tap it. On the bottom I have slo-mo on one side and pano on the other, but they are partially faded out.

  • Odd Behavior of iPad in Dock -- Anyone Else Having This Problem?

    I connected my iPad dock to my stereo system. Last week I docked my iPad to play Pandora. After about an hour, the music went off. I went to the iPad to see what was happening and I noticed the iPad was randomly doing things. While I was watching (an

  • Multiple patterns for one SimpleDateFormat???

    Newbie so be nice! :) I am using the following formatter to define a SimpleDateFormat: private static SimpleDateFormat theFormatter;      static {           theFormatter = new SimpleDateFormat("yyyyMMdd");           theFormatter.setTimeZone(TimeZone.