Package javax.swing

Examples of javax.swing.JSpinner$SpinnerNumberFormatter


    action.setGroup(instrument.pencil.canvas().getDrawing().getSelection().duplicateDeep(false));
  }

  @Override
  public boolean isConditionRespected() {
    final JSpinner spinner = interaction.getSpinner();
    return (spinner==instrument.thicknessField || spinner==instrument.frameArcField) && instrument.hand.isActivated();
  }
View Full Code Here


    action.setPencil(instrument.pencil);
  }

  @Override
  public boolean isConditionRespected() {
    final JSpinner spinner = interaction.getSpinner();
    return (spinner==instrument.thicknessField || spinner==instrument.frameArcField) && instrument.pencil.isActivated();
  }
View Full Code Here

    super(ins, ModifyShapeProperty.class);
  }

  @Override
  public void initAction() {
    final JSpinner spinner = interaction.getSpinner();
    action.setGroup(instrument.pencil.canvas().getDrawing().getSelection().duplicateDeep(false));

    if(spinner==instrument.shadowSizeField)
      action.setProperty(ShapeProperties.SHADOW_SIZE);
    else
View Full Code Here

      super.updateAction();
  }

  @Override
  public boolean isConditionRespected() {
    final JSpinner spinner = getInteraction().getSpinner();
    return (spinner==instrument.shadowAngleField || spinner==instrument.shadowSizeField) && instrument.hand.isActivated();
  }
View Full Code Here

  }


  @Override
  public void initAction() {
    final JSpinner spinner = getInteraction().getSpinner();
    action.setPencil(instrument.pencil);

    if(spinner==instrument.shadowAngleField)
      action.setProperty(ShapeProperties.SHADOW_ANGLE);
    else
View Full Code Here

      super.updateAction();
  }

  @Override
  public boolean isConditionRespected() {
    final JSpinner spinner = interaction.getSpinner();
    return (spinner==instrument.shadowSizeField || spinner==instrument.shadowAngleField) && instrument.pencil.isActivated();
  }
View Full Code Here

    textOutHolder.setLayout(new BorderLayout());
    textOutHolder.setBorder(BorderFactory.createTitledBorder("Output options"));
   
    SpinnerNumberModel snm = new SpinnerNumberModel();
    snm.setValue(1); snm.setMinimum(1);
    m_outputStepSpinner = new JSpinner(snm);
    Dimension spinD = m_outputStepSpinner.getPreferredSize();
    spinD = new Dimension((int)(spinD.getWidth() * 1.5),
        (int)spinD.getHeight());
    m_outputStepSpinner.setPreferredSize(spinD);
    JPanel checkHolder = new JPanel();
    checkHolder.setLayout(new BorderLayout());
    checkHolder.add(m_outputPredsCheckBox, BorderLayout.WEST);
    //labAndSpinnerHolder.add(m_outputStepSpinner, BorderLayout.EAST);
    JPanel comboAndSpinnerHolder = new JPanel();
    comboAndSpinnerHolder.setLayout(new BorderLayout());
   
    JPanel combo1Holder = new JPanel(); combo1Holder.setLayout(new BorderLayout());
    combo1Holder.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0));
    combo1Holder.add(m_outputPredsCombo, BorderLayout.EAST);

    combo1Holder.add(m_outputPredsComboLabel, BorderLayout.CENTER);
   
    comboAndSpinnerHolder.add(combo1Holder, BorderLayout.NORTH);
   
    JPanel spinnerHolder1 = new JPanel();
    spinnerHolder1.setLayout(new BorderLayout());
    spinnerHolder1.add(m_outputStepSpinner, BorderLayout.EAST);
    spinnerHolder1.add(m_outputStepLabel, BorderLayout.CENTER);
   
    JPanel spinnerHolder2 = new JPanel();
    spinnerHolder2.setLayout(new BorderLayout());
    spinnerHolder2.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
    spinnerHolder2.add(spinnerHolder1, BorderLayout.NORTH);
   
    comboAndSpinnerHolder.add(spinnerHolder2, BorderLayout.CENTER);
    textOutHolder.add(comboAndSpinnerHolder, BorderLayout.CENTER);
   
    textOutHolder.add(checkHolder, BorderLayout.NORTH);
    m_outputStepSpinner.setEnabled(false);
    m_outputStepLabel.setEnabled(false);
    m_outputPredsCombo.setEnabled(false);
    m_outputPredsCheckBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        m_outputStepSpinner.setEnabled(m_outputPredsCheckBox.isSelected());
        m_outputStepLabel.setEnabled(m_outputPredsCheckBox.isSelected());
        m_outputPredsComboLabel.setEnabled(m_outputPredsCheckBox.isSelected());
        m_outputPredsCombo.setEnabled(m_outputPredsCheckBox.isSelected());
      }
    });
   
    JPanel temp1 = new JPanel();
    temp1.setLayout(new BorderLayout());
    temp1.add(m_outputFutureCheckBox, BorderLayout.NORTH);
    textOutHolder.add(temp1, BorderLayout.SOUTH);
    outputOptsHolder.add(textOutHolder);
    m_outputFutureCheckBox.setSelected(true);
   
    JPanel graphOutputHolder = new JPanel();
    graphOutputHolder.setLayout(new BorderLayout());
    graphOutputHolder.setBorder(BorderFactory.
        createTitledBorder("Graphing options"));
   
    outputOptsHolder.add(graphOutputHolder);
   
    snm = new SpinnerNumberModel();
    snm.setValue(1); snm.setMinimum(1);
    m_graphPredsAtStepSpinner = new JSpinner(snm);
    spinD = m_graphPredsAtStepSpinner.getPreferredSize();
    spinD = new Dimension((int)(spinD.getWidth() * 1.5),
        (int)spinD.getHeight());
    m_graphPredsAtStepSpinner.setPreferredSize(spinD);
    JPanel labAndSpinnerHolder = new JPanel();
View Full Code Here

    lagPanel.setLayout(new GridLayout(1,2));
    //lagPanel.setBorder(BorderFactory.createTitledBorder("Lag creation"));   
   
    SpinnerNumberModel snm = new SpinnerNumberModel();
    snm.setValue(1); snm.setMinimum(1);
    m_minLagSpinner = new JSpinner(snm);
    Dimension spinD = m_minLagSpinner.getPreferredSize();
    spinD = new Dimension((int)(spinD.getWidth() * 1.5),
        (int)spinD.getHeight());
    m_minLagSpinner.setPreferredSize(spinD);
   
    JPanel temp1 = new JPanel();
    temp1.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0));
    temp1.setLayout(new BorderLayout());
    final JLabel minLagLab = new JLabel("Minimum lag", JLabel.RIGHT);
    temp1.add(minLagLab, BorderLayout.CENTER);
    temp1.add(m_minLagSpinner, BorderLayout.EAST);
    JPanel spinnerHolder = new JPanel();
    spinnerHolder.setLayout(new BorderLayout());
    spinnerHolder.setBorder(BorderFactory.createTitledBorder("Lag length"));
   
    JPanel vH = new JPanel();
    vH.setLayout(new BorderLayout());

    JPanel varianceHolder = new JPanel();
    varianceHolder.setLayout(new BorderLayout());
    varianceHolder.add(m_adjustForVarianceCheckBox, BorderLayout.EAST);
    m_adjustForVarianceCheckBox.setSelected(false);
    vH.add(varianceHolder, BorderLayout.NORTH);
   
    JPanel checkHolder = new JPanel();
    checkHolder.setLayout(new BorderLayout());
    checkHolder.add(m_useCustomLags, BorderLayout.EAST);
    vH.add(checkHolder, BorderLayout.SOUTH);
   
    spinnerHolder.add(vH, BorderLayout.NORTH);
    spinnerHolder.add(temp1, BorderLayout.CENTER);
   
    snm = new SpinnerNumberModel();
    snm.setValue(12); snm.setMinimum(1);
    m_maxLagSpinner = new JSpinner(snm);
    m_maxLagSpinner.setPreferredSize(spinD);
    JPanel temp2 = new JPanel();
    temp2.setLayout(new BorderLayout());
    temp2.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
    final JLabel maxLagLab = new JLabel("Maximum lag", JLabel.RIGHT);
    temp2.add(maxLagLab, BorderLayout.CENTER);
    temp2.add(m_maxLagSpinner, BorderLayout.EAST);
   
    final JLabel fineTuneLab = new JLabel("Fine tune lag selection", JLabel.RIGHT);
    JPanel fPanel = new JPanel(); fPanel.setLayout(new BorderLayout());
    fPanel.add(temp2, BorderLayout.NORTH);
   
    JPanel fineHolder = new JPanel(); fineHolder.setLayout(new BorderLayout());
    fineHolder.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
    fineHolder.add(fineTuneLab, BorderLayout.CENTER);
    fineHolder.add(m_fineTuneLagsField, BorderLayout.EAST);
    m_fineTuneLagsField.setPreferredSize(spinD);
    fineTuneLab.setEnabled(false);
    fineTuneLab.setToolTipText("Specify ranges to fine tune " +
        "lags within minimum and maximum (e.g. 2,3,6-8)");
    m_fineTuneLagsField.setEnabled(false);
    m_fineTuneLagsField.setToolTipText("Specify ranges to fine tune " +
        "lags within minimum and maximum (e.g. 2,3,6-8)");
   
    fPanel.add(fineHolder,BorderLayout.SOUTH);
           
    spinnerHolder.add(fPanel, BorderLayout.SOUTH);
   
    m_useCustomLags.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        boolean enabled = m_useCustomLags.isSelected();
        m_minLagSpinner.setEnabled(enabled);
        m_maxLagSpinner.setEnabled(enabled);
        minLagLab.setEnabled(enabled);
        maxLagLab.setEnabled(enabled);
        fineTuneLab.setEnabled(enabled);
        m_fineTuneLagsField.setEnabled(enabled);
       
        m_averageLongLags.setEnabled(enabled);
        if (!enabled) {
          m_averageLongLags.setSelected(false);
        }
        /*m_averageLagsAfter.setEnabled(enabled);
        m_numConsecutiveToAverage.setEnabled(enabled); */
      }
    });   
   
    snm = new SpinnerNumberModel();
    snm.setValue(2); snm.setMinimum(1);
    m_averageLagsAfter = new JSpinner(snm);
    m_averageLagsAfter.setPreferredSize(spinD);
   
    snm = new SpinnerNumberModel();
    snm.setValue(2); snm.setMinimum(2);
    m_numConsecutiveToAverage = new JSpinner(snm);
    m_numConsecutiveToAverage.setPreferredSize(spinD);
   
    JPanel averageLagHolder = new JPanel();
    averageLagHolder.setBorder(BorderFactory.createTitledBorder("Averaging"));
    averageLagHolder.setLayout(new BorderLayout());
View Full Code Here

    .contains("showing=false");
  }

  @Test
  public void should_format_JSpinner() {
    JSpinner spinner = spinner().withName("spinner").withValues(6, 2, 8, 1).createNew();
    assertThat(formatted(spinner)).contains("javax.swing.JSpinner").contains("name='spinner'").contains("value=6")
    .contains("enabled=true").contains("visible=true").contains("showing=false");
  }
View Full Code Here

  }

  @Test
  public void should_return_text_using_driver() {
    JSpinnerDriver driver = fixture.driver();
    JSpinner target = fixture.target();
    when(driver.textOf(target)).thenReturn("Six");
    assertThat(fixture.text()).isEqualTo("Six");
    verify(driver).textOf(target);
  }
View Full Code Here

TOP

Related Classes of javax.swing.JSpinner$SpinnerNumberFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.