Java Code Examples for java.awt.event.ItemEvent#DESELECTED

The following examples show how to use java.awt.event.ItemEvent#DESELECTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeochronSampleCustomMetadataDialog.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
public void itemStateChanged ( ItemEvent evt ) {
    String geologicAge = (String) evt.getItem();

    if ( evt.getStateChange() == ItemEvent.SELECTED ) {
        // parse the string to get ages
        String[] pass1 = geologicAge.split( "\\x28" );//?"("
        String[] pass2 = pass1[1].split( "-" );

        String ageMin = pass2[0].split( "Ma" )[0].trim();
        String ageMax = pass2[1].split( "Ma" )[0].trim();

        System.out.println( "AGE = " + ageMin + "   " + ageMax );
        minAbsAgeMa_txtBox.setText( ageMin );
        maxAbsAgeMa_txtBox.setText( ageMax );

    } else if ( evt.getStateChange() == ItemEvent.DESELECTED ) {
        // Item is no longer selected
    }
}
 
Example 2
Source File: FcdProPlusPanel.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e) {
	if (checkingSettings) return;
	if (e.getSource() == cbMixerGain) {
		if (e.getStateChange() == ItemEvent.DESELECTED) {
			setMixerGain(false);
		} else {
			setMixerGain(true);
		}		
	}
	if (e.getSource() == cbLnaGain) {
		if (e.getStateChange() == ItemEvent.DESELECTED) {
			setLnaGain(false);
		} else {
			setLnaGain(true);
		}
	}
	if (e.getSource() == cbBiasTee ) {

		if (e.getStateChange() == ItemEvent.DESELECTED) {
			setBiasTee(false);
		} else {
			setBiasTee(true);
		}
	}
}
 
Example 3
Source File: JExtendedComboBox.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void fireItemStateChanged(ItemEvent e) {
    switch (e.getStateChange()) {
        case ItemEvent.SELECTED:

            if (e.getItem() instanceof JSeparator) {
                SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            selectNextItem();
                        }
                    });

            }

            break;
        case ItemEvent.DESELECTED:

            if (!(e.getItem() instanceof JSeparator)) {
                lastSelectedIndex = model.getIndexOf(e.getItem());
            }

            break;
    }

    super.fireItemStateChanged(e);
}
 
Example 4
Source File: Stitch_Many_Images.java    From Stitching with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void itemStateChanged( final ItemEvent event ) 
{
	// one cannot deselect, just select another one
	if ( event.getStateChange() == ItemEvent.DESELECTED )
		checkbox.setState( true );
	else if ( event.getStateChange() == ItemEvent.SELECTED )
		for ( final Object o : checkboxes )
			if ( o == checkbox )
				((Checkbox)o).setState( true );
			else
				((Checkbox)o).setState( false );
}
 
Example 5
Source File: CCheckboxMenuItem.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void handleAction(final boolean state) {
    final CheckboxMenuItem target = (CheckboxMenuItem)getTarget();
    SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
        public void run() {
            target.setState(state);
        }
    });
    ItemEvent event = new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED, target.getLabel(), state ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
    SunToolkit.postEvent(SunToolkit.targetToAppContext(getTarget()), event);
}
 
Example 6
Source File: SampleAnalysisWorkflowManagerLAICPMS.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
public void itemStateChanged(ItemEvent evt) {

            if (evt.getStateChange() == ItemEvent.SELECTED) {
                // Item was just selected
                mySample.setAnalysisPurpose(ANALYSIS_PURPOSE.valueOf((String) evt.getItem()));

            } else if (evt.getStateChange() == ItemEvent.DESELECTED) {
                // Item is no longer selected
            }
        }
 
Example 7
Source File: HealthTab.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e) {
	super.itemStateChanged(e);
	Object source = e.getItemSelectable();
	
	if (source == showRawValues) { //updateProperty(e, decoder.flipReceivedBits); }

		if (e.getStateChange() == ItemEvent.DESELECTED) {
			Config.displayRawValues = false;
		} else {
			Config.displayRawValues = true;
		}
		Config.save();
		if (realTime != null)
			updateTabRT(realTime, false);
		if (maxPayload != null)
			updateTabMax(maxPayload);
		if (minPayload != null)
			updateTabMin(minPayload);
	}
	
	if (source == cbUTC) {
		if (realTime != null)
			updateTabRT(realTime, false);
		if (maxPayload != null)
			updateTabMax(maxPayload);
		if (minPayload != null)
			updateTabMin(minPayload);
		//parseFrames();
	}
	
}
 
Example 8
Source File: AbstractProjectManagerForRawData.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent evt) {

    if (evt.getStateChange() == ItemEvent.SELECTED) {
        // Item was just selected
        project.setAnalysisPurpose(ANALYSIS_PURPOSE.valueOf((String) evt.getItem()));

    } else if (evt.getStateChange() == ItemEvent.DESELECTED) {
        // Item is no longer selected
    }
}
 
Example 9
Source File: SyntaxColoringPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void itemStateChanged( ItemEvent e ) {
    if( e.getStateChange() == ItemEvent.DESELECTED || !listen )
        return;
    updateData();
    fireChanged();
}
 
Example 10
Source File: StatisticsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e) {
    switch(e.getStateChange()) {
        case ItemEvent.SELECTED:
            filterMask &= ~itemMask;
            break;
        case ItemEvent.DESELECTED:
            filterMask |= itemMask;
            break;
        default:
            return;
    }
    treePanel.setFilterMask(filterMask);
    NbPreferences.forModule(StatisticsPanel.class).putInt(KEY_FILTER_MASK, filterMask);
}
 
Example 11
Source File: GeochronSampleCustomMetadataDialog.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
public void itemStateChanged ( ItemEvent evt ) {

            if ( evt.getStateChange() == ItemEvent.SELECTED ) {
                // Item was just selected
                sample.setAnalysisPurpose( ANALYSIS_PURPOSE.valueOf( (String) evt.getItem() ) );

                // show detrital choices
                detritalTypePanel.setVisible( sample.getAnalysisPurpose().compareTo( ANALYSIS_PURPOSE.DetritalSpectrum ) == 0 );

            } else if ( evt.getStateChange() == ItemEvent.DESELECTED ) {
                // Item is no longer selected
            }
        }
 
Example 12
Source File: GraphFrame.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e) {
	if (e.getSource() == cbRoundLabels) {
		if (e.getStateChange() == ItemEvent.DESELECTED) {
			roundLabels = false;
		} else {
			roundLabels = true;
		}
		if (textDisplay)
			diagnosticTable.updateData();
		else
			panel.updateGraphData("GraphFrame:stateChange:altLabels");
	}
	if (e.getSource() == cbShowSun) {
		if (e.getStateChange() == ItemEvent.DESELECTED) {
			showSun = false;
		} else {
			showSun = true;
		}
		if (textDisplay)
			diagnosticTable.updateData();
		else
			panel.updateGraphData("GraphFrame:stateChange:altLabels");
	}
	if (e.getSource() == cbUptime) {
		if (e.getStateChange() == ItemEvent.DESELECTED) {
			hideUptime = true;
		} else {
			hideUptime = false;
		}
		if (textDisplay)
			diagnosticTable.updateData();
		else
			panel.updateGraphData("GraphFrame:stateChange:Uptime");
	}		
	toggleSunCheckBox();
}
 
Example 13
Source File: SampleAnalysisWorkflowManagerIDTIMS.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
public void itemStateChanged(ItemEvent evt) {

            if (evt.getStateChange() == ItemEvent.SELECTED) {
                // Item was just selected
                mySample.setAnalysisPurpose(ANALYSIS_PURPOSE.valueOf((String) evt.getItem()));

            } else if (evt.getStateChange() == ItemEvent.DESELECTED) {
                // Item is no longer selected
            }
        }
 
Example 14
Source File: CCheckboxMenuItem.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void handleAction(final boolean state) {
    final CheckboxMenuItem target = (CheckboxMenuItem)getTarget();
    SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
        public void run() {
            target.setState(state);
        }
    });
    ItemEvent event = new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED, target.getLabel(), state ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
    SunToolkit.postEvent(SunToolkit.targetToAppContext(getTarget()), event);
}
 
Example 15
Source File: CheckBoxUpdater.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent e) {
    if (ItemEvent.SELECTED == e.getStateChange() || ItemEvent.DESELECTED == e.getStateChange()) {
        boolean isSelected = checkBox.isSelected();
        if (verifier != null) {
            if (verifier.verifyValue(isSelected)) {
                setValue(isSelected);
            }
        } else {
            // If there is no defined verifier, simply change the value
            setValue(isSelected);
        }
    }
}
 
Example 16
Source File: CCheckboxMenuItem.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void handleAction(final boolean state) {
    final CheckboxMenuItem target = (CheckboxMenuItem)getTarget();
    SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
        public void run() {
            target.setState(state);
        }
    });
    ItemEvent event = new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED, target.getLabel(), state ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
    SunToolkit.postEvent(SunToolkit.targetToAppContext(getTarget()), event);
}
 
Example 17
Source File: OutputPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void sourceFolderItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_sourceFolderItemStateChanged
    if (ignoreEvent) {
        return;
    }
    if (evt.getStateChange() == ItemEvent.DESELECTED) {
        int index = findIndex(evt.getItem());
        // if index == -1 then item was removed and will not be saved
        if (index != -1) {
            saveOutput(index);
        }
    } else {
        loadOutput();
    }
}
 
Example 18
Source File: CCheckboxMenuItem.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void handleAction(final boolean state) {
    final CheckboxMenuItem target = (CheckboxMenuItem)getTarget();
    SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
        public void run() {
            target.setState(state);
        }
    });
    ItemEvent event = new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED, target.getLabel(), state ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
    SunToolkit.postEvent(SunToolkit.targetToAppContext(getTarget()), event);
}
 
Example 19
Source File: CCheckboxMenuItem.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void handleAction(final boolean state) {
    final CheckboxMenuItem target = (CheckboxMenuItem)getTarget();
    SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
        public void run() {
            target.setState(state);
        }
    });
    ItemEvent event = new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED, target.getLabel(), state ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
    SunToolkit.postEvent(SunToolkit.targetToAppContext(getTarget()), event);
}
 
Example 20
Source File: AbstractSampleLegacyManagerDialog.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
@Override
public void itemStateChanged(ItemEvent evt) {

    if (evt.getStateChange() == ItemEvent.SELECTED) {
        // Item was just selected
        mySample.setMineralName((String) evt.getItem());

    } else if (evt.getStateChange() == ItemEvent.DESELECTED) {
        // Item is no longer selected
    }
}