PointSpinner value not reflected in focus lost

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

PointSpinner value not reflected in focus lost

Postby rathinamsm » Sun Oct 14, 2012 11:42 pm

Hi Team,
I tried a sample using the Point Spinner Demo. In that,
When i enter the values as 100,200 and pressed the button using mouse to get the values from the Point spinner, it returns the old value. ( Note: Even though I triggered button action using mouse )

When i press tab from the spinner then value the value changed to (100,200) and the value gets reflected.

Please let us know...
rathinamsm
 
Posts: 40
Joined: Wed Nov 02, 2011 5:36 am

Re: PointSpinner value not reflected in focus lost

Postby JIDE Support » Mon Oct 15, 2012 8:46 am

It works fine on my end. Could you please give us more details about your testing? For example, the test case and the release of JIDE you used, the steps you tested. A screencast will be good.

Thanks,
--
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36522
Joined: Sun Sep 14, 2003 10:49 am

Re: PointSpinner value not reflected in focus lost

Postby rathinamsm » Wed Oct 17, 2012 10:52 pm

Hi Team,

Please follow the sample below.

Scenario 1:
----------------
1. enter the value as 100,200
2. press the button to get the value
3. it will print as 0.
Expected : 100,200

But the working steps is:
1. enter the value 200,200
2. press enter key
3. press the button and the print msg will be 200,200

Please resolve this.
Hope now you understood.

( And i noticed that the focus listener is not working in the point spinner. )


Code: Select all
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.jidesoft.plaf.LookAndFeelFactory;
import com.jidesoft.spinner.PointSpinner;
import com.jidesoft.swing.JideButton;

public class PointSpinnerDemo1 extends JFrame {

   PointSpinnerDemo1() {

      setTitle( "Focus retained problem" );
      getContentPane().add( getDemoPanel() );
      pack();
      setVisible( true );
   }

   public Component getDemoPanel() {

      JPanel panel = new JPanel();
      panel.setLayout( new BorderLayout() );

      final PointSpinner pointSpinner = new PointSpinner();
      panel.add( pointSpinner, BorderLayout.CENTER );
      final JideButton jbtn = new JideButton( "Press To Get Value" );
      jbtn.addActionListener( new ActionListener() {

         @Override
         public void actionPerformed(ActionEvent e) {

            System.out.println( "Value : " + pointSpinner.getValue() );
         }
      } );
      panel.add( jbtn, BorderLayout.NORTH );
      pointSpinner.addFocusListener( new FocusListener() {

         @Override
         public void focusLost(FocusEvent e) {

            System.out.println( "--How to call this--------------fl" );
            jbtn.doClick();
         }

         @Override
         public void focusGained(FocusEvent e) {

         }
      } );

      return panel;
   }

   static public void main(String[] s) {

      LookAndFeelFactory.installDefaultLookAndFeelAndExtension();
      new PointSpinnerDemo1();
   }
}
rathinamsm
 
Posts: 40
Joined: Wed Nov 02, 2011 5:36 am

Re: PointSpinner value not reflected in focus lost

Postby JIDE Support » Thu Oct 18, 2012 1:18 pm

It is as designed. The input will be set back to model when the text field lose focus or user input enter. If you want to get the value in your case, please commit it by yourself.
Code: Select all
            public void actionPerformed(ActionEvent e) {
                try {
                    ((PointSpinner.PointEditor)pointSpinner.getEditor()).getTextField().commitEdit();
                }
                catch (ParseException e1) {
                    e1.printStackTrace();
                }
                System.out.println( "Value : " + pointSpinner.getValue() );
            }


Thanks,
--
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36522
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 11 guests

cron