Example usage for javax.swing.event ChangeEvent getSource

List of usage examples for javax.swing.event ChangeEvent getSource

Introduction

In this page you can find the example usage for javax.swing.event ChangeEvent getSource.

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java

private void hipSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_hipSpinnerStateChanged
{//GEN-HEADEREND:event_hipSpinnerStateChanged

    JSpinner src = (JSpinner) evt.getSource();

    this.parameters.setHipparcusNumber((Integer) src.getValue());

}

From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java

private void seedSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_seedSpinnerStateChanged
{//GEN-HEADEREND:event_seedSpinnerStateChanged

    JSpinner src = (JSpinner) evt.getSource();

    this.parameters.setSeed(((Number) src.getValue()).longValue());

}

From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java

private void massSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_massSpinnerStateChanged
{//GEN-HEADEREND:event_massSpinnerStateChanged

    JSpinner src = (JSpinner) evt.getSource();

    this.parameters.setMass((Double) src.getValue());

}

From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java

private void distanceSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_distanceSpinnerStateChanged
{//GEN-HEADEREND:event_distanceSpinnerStateChanged

    JSpinner src = (JSpinner) evt.getSource();

    this.parameters.setDistance((Double) src.getValue());

}

From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java

private void ascensionSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_ascensionSpinnerStateChanged
{//GEN-HEADEREND:event_ascensionSpinnerStateChanged

    JSpinner src = (JSpinner) evt.getSource();

    this.parameters.setRightAscension((Double) src.getValue());

}

From source file:com.alvermont.terraj.stargen.ui.StargenFrame.java

private void declinationSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_declinationSpinnerStateChanged
{//GEN-HEADEREND:event_declinationSpinnerStateChanged

    JSpinner src = (JSpinner) evt.getSource();

    this.parameters.setDeclination((Double) src.getValue());

}

From source file:lejos.pc.charting.LogChartFrame.java

private void domainDisplayLimitSlider_stateChanged(ChangeEvent e) {
    JSlider workingSlider = (JSlider) e.getSource();

    String unit = "ms";
    customChartPanel.getLoggingChartPanel();
    int mode = LoggingChart.DAL_TIME;
    int maxSliderPerMode = MAXDOMAIN_TIME_LIMIT;
    if (useDataPointsRadioButton.isSelected()) {
        unit = "datapoints";
        customChartPanel.getLoggingChartPanel();
        mode = LoggingChart.DAL_COUNT;/*from   ww w .  j  a  v a2  s . c o m*/
        maxSliderPerMode = MAXDOMAIN_DATAPOINT_LIMIT;
    }
    this.domainLimitSliderValue = workingSlider.getValue();

    int working = maxSliderPerMode;
    if (this.domainLimitSliderValue != maxSliderPerMode) {
        working = (int) (Math.pow((float) this.domainLimitSliderValue / maxSliderPerMode, DOMLIMIT_POW)
                * this.domainLimitSliderValue) + MINDOMAIN_LIMIT;
    }

    domainLimitLabel.setText(String.format("%1$,d %2$s", working, unit));

    if (workingSlider.getValueIsAdjusting())
        return;
    customChartPanel.getLoggingChartPanel().setDomainLimiting(mode, working);
}

From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java

private void jTabbedPane1StateChanged(ChangeEvent evt) {
    JTabbedPane pane = (JTabbedPane) evt.getSource();

    // Get current tab
    int sel = pane.getSelectedIndex();

    if (sel == 1) {
        symbolTableModel.reload();// w w w .  ja  v a2 s.  c  o  m
    }
}

From source file:de.lazyzero.kkMulticopterFlashTool.KKMulticopterFlashTool.java

private void initGUI() {
    mainPanel = new JPanel();

    // create the CellContraints
    CellConstraints cc = new CellConstraints();

    // create the Layout for Panel this
    String panelColumns = "fill:pref:grow";
    String panelRows = "3dlu,pref,3dlu,pref,3dlu,pref:grow";
    FormLayout panelLayout = new FormLayout(panelColumns, panelRows);
    mainPanel.setLayout(panelLayout);/*from w ww.j  av a  2  s  .c  om*/
    programmingPanel = ceateProgrammingPanel();
    eepromPanel = createEEpromPanel();

    tabbedPane.add(programmingPanel);

    programmerPanel = new ProgrammerPanel(this, programmers);
    controllerPanel = new ControllerPanel(this, avrs);

    mainPanel.add(programmerPanel, cc.xy(1, 2));
    mainPanel.add(controllerPanel, cc.xy(1, 4));
    mainPanel.add(tabbedPane, cc.xy(1, 6));

    logger.log(Level.INFO, "Set the port from the properties [usb]: " + settings.getProperty("port", "usb"));

    programmerPanel.setPort(settings.getProperty("port", "usb"));
    programmerPanel.setRate(settings.getProperty("rate", "19200"));
    programmerPanel.setDefaultRate(new Boolean(settings.getProperty("defaultRate", "true")));
    programmerPanel.setProgrammer(settings.getProperty("programmer", "usbasp"));
    controllerPanel.setController(settings.getProperty("controller", "Blackboard"));

    //      testPanel = new TestPanel();
    //      
    tabbedPane.addTab(_("programmingPanel.title"), programmingPanel);
    tabbedPane.setBorder(new LineBorder(Color.WHITE));
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    tabbedPane.addTab(_("eepromPanel.title"), eepromPanel);
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    tabbedPane.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent event) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) event.getSource();
            if (sourceTabbedPane.getSelectedComponent().equals(eepromPanel)) {
                logger.info("changed to eepromPanel");
                eepromResetPanel.firePropertyChange(ControllerPanel.CONTROLLER_CHANGED, 0, 1);
            } else if (sourceTabbedPane.getSelectedComponent().equals(programmingPanel)) {
                logger.info("changed to programmingPanel");
            }

        }
    });

    mainframe = new JFrame(_("title") + " " + VERSION + (isBeta ? " beta " + betaVersion : "") + " - " + mode);
    //      mainframe.setPreferredSize(preferredSize);
    //      mainframe.setSize(preferredSize);

    //      mainframe.add(tabbedPane);
    mainframe.add(mainPanel);
    mainframe.setJMenuBar((new kkMenu(this, firmwareReader)).getBar());
    mainframe.setIconImage(Icons.getImage(Icons.app, 16));

    mainframe.pack();
    mainframe.setLocationRelativeTo(getRootPane());

    mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    firmwarePanel.firePropertyChange(ControllerPanel.CONTROLLER_CHANGED, 0, 1);

}

From source file:com.alvermont.terraj.fracplanet.ui.AbstractTerrainViewerFrame.java

private void spinSliderStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_spinSliderStateChanged
{//GEN-HEADEREND:event_spinSliderStateChanged

    final JSlider source = (JSlider) evt.getSource();

    if (!source.getValueIsAdjusting()) {
        final float value = source.getValue() / 500.0f;

        log.debug("Spin slider set to: " + value);

        display.setObjectRotationSpeed(value);
    }//from  w ww .  j ava  2s .c  o m
}