本文整理匯總了Java中java.awt.Checkbox.getState方法的典型用法代碼示例。如果您正苦於以下問題:Java Checkbox.getState方法的具體用法?Java Checkbox.getState怎麽用?Java Checkbox.getState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Checkbox
的用法示例。
在下文中一共展示了Checkbox.getState方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dialogItemChanged
import java.awt.Checkbox; //導入方法依賴的package包/類
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
chosenFilter = gd.getNextChoice();
chosenRadius = (double) gd.getNextNumber();
chosenIteration = (int) gd.getNextNumber();
Checkbox previewCheckbox = (Checkbox) gd.getCheckboxes().get(0);
if (gd.invalidNumber() || chosenRadius<=0 || chosenRadius>3 || chosenIteration<1 || chosenIteration>500) {
if (previewCheckbox.getState()) {
previewCheckbox.setSize(130, 20);
previewCheckbox.setLabel("Invalid number");
}
return false;
} else {
return true;
}
}
示例2: queryOptions
import java.awt.Checkbox; //導入方法依賴的package包/類
public boolean queryOptions() {
MesquiteInteger buttonPressed = new MesquiteInteger(1);
String help = "If you select \"minimize objection function\", then Mesquite will search for trees that have smaller values of the number calculated for each tree; if you turn this option off, Mesquite will look for trees with larger values. ";
help+="For example, if Treelength were the value calculated for each tree, one typically would search for trees with smaller values; i.e., one would choose \"minimize objection function\".";
help+= " If \"live updates\" is chosen, then each time a better tree is found, the tree will be redrawn (if it is visible in a tree window) and any calculations based upon the tree,";
help+=" such as tracing of a character history, a tree legend, or a chart, will be redone, which may substantially increase the time taken for the search.";
ExtensibleDialog dialog = new ExtensibleDialog(containerOfModule(), "Options for Search for Better Tree",buttonPressed); //MesquiteTrunk.mesquiteTrunk.containerOfModule()
dialog.appendToHelpString(help);
dialog.addLabel("Options for Search for Better Tree");
Checkbox smallerIsBetterBox = dialog.addCheckBox("minimize objection function", smallerIsBetter);
Checkbox liveUpdatesBox = dialog.addCheckBox("update display and calculations based upon tree as it is rearranged", liveUpdates);
dialog.completeAndShowDialog(true);
if (buttonPressed.getValue()==0) {
smallerIsBetter = smallerIsBetterBox.getState();
liveUpdates = liveUpdatesBox.getState();
//storePreferences();
}
dialog.dispose();
return (buttonPressed.getValue()==0);
}
示例3: queryOptions
import java.awt.Checkbox; //導入方法依賴的package包/類
public boolean queryOptions() {
MesquiteInteger buttonPressed = new MesquiteInteger(1);
ExtensibleDialog dialog = new ExtensibleDialog(containerOfModule(), "Select Taxa by Name Search",buttonPressed); //MesquiteTrunk.mesquiteTrunk.containerOfModule()
dialog.addLabel("Select Taxa by Name Search");
SingleLineTextField matchField = dialog.addTextField("Search string:", matchString, 20);
Checkbox caseSensitiveBox = dialog.addCheckBox("case sensitive", caseSensitive);
dialog.completeAndShowDialog(true);
if (buttonPressed.getValue()==0) {
matchString = matchField.getText();
caseSensitive = caseSensitiveBox.getState();
storePreferences();
}
dialog.dispose();
return (buttonPressed.getValue()==0) ;
}
示例4: getExportOptions
import java.awt.Checkbox; //導入方法依賴的package包/類
public boolean getExportOptions(boolean dataSelected, boolean taxaSelected){
MesquiteInteger buttonPressed = new MesquiteInteger(1);
PhylipExporterDialog exportDialog = new PhylipExporterDialog(this,containerOfModule(), "Export Phylip Options", buttonPressed);
Checkbox excludedCharactersCheckbox = exportDialog.addCheckBox("export excluded characters", localWriteExcludedChars);
Checkbox exportTreesCheckbox = exportDialog.addCheckBox("export trees if present", exportTrees);
Checkbox exportRAxMLModelFileCheckbox = exportDialog.addCheckBox("save RAxML model file", exportRAxMLModelFile);
Checkbox useTranslationTableCheckbox = exportDialog.addCheckBox("use simple taxon names (for RAxML)", useTranslationTable);
exportDialog.completeAndShowDialog(dataSelected, taxaSelected);
boolean ok = (exportDialog.query(dataSelected, taxaSelected)==0);
if (ok) {
localWriteExcludedChars = excludedCharactersCheckbox.getState();
exportTrees = exportTreesCheckbox.getState();
exportRAxMLModelFile = exportRAxMLModelFileCheckbox.getState();
useTranslationTable = useTranslationTableCheckbox.getState();
userSpecifiedWriteExcludedChars = true;
taxonNameLength = exportDialog.getTaxonNamesLength();
}
exportDialog.dispose();
return ok;
}
示例5: dialogItemChanged
import java.awt.Checkbox; //導入方法依賴的package包/類
@Override
public boolean dialogItemChanged(final GenericDialog gd, final AWTEvent e) {
final Vector<?> checkboxes = gd.getCheckboxes();
final Vector<?> nFields = gd.getNumericFields();
final Checkbox autoModeBox = (Checkbox) checkboxes.get(0);
final Checkbox singleSphereBox = (Checkbox) checkboxes.get(1);
final Checkbox showPlotBox = (Checkbox) checkboxes.get(2);
final TextField radiusField = (TextField) nFields.get(0);
final TextField minSpheresField = (TextField) nFields.get(3);
final TextField maxSpheresField = (TextField) nFields.get(4);
final TextField toleranceField = (TextField) nFields.get(5);
if (singleSphereBox.getState()) {
radiusField.setEnabled(true);
autoModeBox.setEnabled(false);
showPlotBox.setEnabled(false);
minSpheresField.setEnabled(false);
maxSpheresField.setEnabled(false);
toleranceField.setEnabled(false);
} else {
radiusField.setEnabled(false);
autoModeBox.setEnabled(true);
showPlotBox.setEnabled(true);
minSpheresField.setEnabled(true);
maxSpheresField.setEnabled(true);
toleranceField.setEnabled(true);
}
DialogModifier.registerMacroValues(gd, gd.getComponents());
return true;
}
示例6: dialogItemChanged
import java.awt.Checkbox; //導入方法依賴的package包/類
@Override
public boolean dialogItemChanged(final GenericDialog gd, final AWTEvent e) {
if (!DialogModifier.allNumbersValid(gd.getNumericFields()))
return false;
final Vector<?> checkboxes = gd.getCheckboxes();
final Vector<?> nFields = gd.getNumericFields();
final Checkbox calibration = (Checkbox) checkboxes.get(10);
final boolean isHUCalibrated = calibration.getState();
final TextField minT = (TextField) nFields.get(0);
final TextField maxT = (TextField) nFields.get(1);
final double min = Double.parseDouble(minT.getText());
final double max = Double.parseDouble(maxT.getText());
if (isHUCalibrated && !fieldUpdated) {
minT.setText("" + cal.getCValue(min));
maxT.setText("" + cal.getCValue(max));
fieldUpdated = true;
}
if (!isHUCalibrated && fieldUpdated) {
minT.setText("" + cal.getRawValue(min));
maxT.setText("" + cal.getRawValue(max));
fieldUpdated = false;
}
if (isHUCalibrated)
DialogModifier.replaceUnitString(gd, "grey", "HU");
else
DialogModifier.replaceUnitString(gd, "HU", "grey");
final Checkbox oriented = (Checkbox) checkboxes.get(9);
if (orienteer == null) {
oriented.setState(false);
oriented.setEnabled(false);
} else
oriented.setEnabled(true);
DialogModifier.registerMacroValues(gd, gd.getComponents());
return true;
}
示例7: itemStateChanged
import java.awt.Checkbox; //導入方法依賴的package包/類
public void itemStateChanged(ItemEvent check) {
// Process the reaction class checkboxes. First
// get the components of the panel cboxPanel (which
// contains a label and 9 checkboxes) and store in
// a Component array (Note: the method getComponents()
// is inherited from the Container class by the
// subclass Panel).
Component [] components = cboxPanel.getComponents();
// Now process these components. First cast each
// Component to a Checkbox. Then use the getState()
// method of Checkbox to return boolean true if
// checked and false otherwise. Use this to set the
// values of the boolean array includeReaction[].
// (Note: we must skip i=0 in the loop because the first
// component in cboxPanel is a Label, not a Checkbox.)
boolean checkAll = ((Checkbox)components[components.length-1]).getState();
if ( checkAll ) { // if "Choose All" selected
for (int i=1; i<9; i++) {
includeReaction[i] = true;
}
checkBox1.setState(true);
checkBox2.setState(true);
checkBox3.setState(true);
checkBox4.setState(true);
checkBox5.setState(true);
checkBox6.setState(true);
checkBox7.setState(true);
checkBox8.setState(true);
} else {
for (int i=1; i<components.length-1; i++) {
Checkbox cb = (Checkbox)components[i];
includeReaction[i] = cb.getState(); // true or false
}
}
}
示例8: dialogItemChanged
import java.awt.Checkbox; //導入方法依賴的package包/類
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
if (!DialogModifier.allNumbersValid(gd.getNumericFields()))
return false;
Vector<?> choices = gd.getChoices();
Vector<?> checkboxes = gd.getCheckboxes();
Vector<?> numbers = gd.getNumericFields();
// link algorithm choice to chunk size field
Choice choice = (Choice) choices.get(1);
TextField num = (TextField) numbers.get(5);
if (choice.getSelectedItem().contentEquals("Multithreaded")) {
num.setEnabled(true);
} else {
num.setEnabled(false);
}
// link show stack 3d to volume resampling
Checkbox box = (Checkbox) checkboxes.get(15);
TextField numb = (TextField) numbers.get(4);
if (box.getState()) {
numb.setEnabled(true);
} else {
numb.setEnabled(false);
}
// link show surfaces, gradient choice and split value
Checkbox surfbox = (Checkbox) checkboxes.get(11);
Choice col = (Choice) choices.get(0);
TextField split = (TextField) numbers.get(3);
if (!surfbox.getState()) {
col.setEnabled(false);
split.setEnabled(false);
} else {
col.setEnabled(true);
if (col.getSelectedIndex() == 1) {
split.setEnabled(true);
} else {
split.setEnabled(false);
}
}
DialogModifier.registerMacroValues(gd, gd.getComponents());
return true;
}
示例9: itemStateChanged
import java.awt.Checkbox; //導入方法依賴的package包/類
public void itemStateChanged(ItemEvent e)
{
// When the checkbox is clicked, output the list of available filters to the ImageJ log
Checkbox cb = (Checkbox) e.getSource();
if (cb.getState())
{
cb.setState(false);
logDemoFilters(TITLE);
}
}
示例10: itemStateChanged
import java.awt.Checkbox; //導入方法依賴的package包/類
public void itemStateChanged(ItemEvent e)
{
// When the checkbox is clicked, output the list of available filters to the ImageJ log
Checkbox cb = (Checkbox) e.getSource();
if (cb.getState())
{
cb.setState(false);
logDemoFilters();
}
}
示例11: itemStateChanged
import java.awt.Checkbox; //導入方法依賴的package包/類
public void itemStateChanged(ItemEvent e)
{
// When the checkbox is clicked, output example compounds to the ImageJ log
Checkbox cb = (Checkbox) e.getSource();
if (cb.getState())
{
cb.setState(false);
logExampleCompounds();
}
}
示例12: updateNotes
import java.awt.Checkbox; //導入方法依賴的package包/類
protected void updateNotes(JLabel notes, Checkbox heartCheck, Checkbox rawCheck,
Checkbox powerCheck) {
if (!heartCheck.getState() && !rawCheck.getState() && !powerCheck.getState()) {
notes.setText("At least one data window needs to be active.");
}
else {
notes.setText("");
}
rawCheck.setEnabled(!heartCheck.getState());
powerCheck.setEnabled(!heartCheck.getState());
}
示例13: checkDefaultLanguage
import java.awt.Checkbox; //導入方法依賴的package包/類
private boolean checkDefaultLanguage() {
// prendo il pannello 2 dello switch manager,
// scandisco tutti i chechbox, se ne trovo uno solo che inizia con
// +language_name ATTIVO, ritorno FALSE
// altrimenti ritorno TRUE
for (int count=0; count < switchesLowerPanel.getComponentCount(); count++) {
Checkbox ch = (Checkbox) switchesLowerPanel.getComponent(count);
if (ch.getLabel().startsWith("+language_name") && ch.getState()) {
return false;
}
}
return true;
}
示例14: next
import java.awt.Checkbox; //導入方法依賴的package包/類
public void next() {
try {
if (this.counter >= 1 && this.counter <= this.tables.size()) {
Table prev = this.tables.get(this.counter - 1);
prev.title = title_field.getText();
int i = 1;
while (i < this.checkboxes.size()) {
Checkbox c = this.checkboxes.get(i);
if (c.getState() == false) {
break;
}
i++;
}
if (i > prev.datarow_begin) {
prev.datarow_begin = i;
}
this.checkboxes.clear();
}
if (this.counter < this.tables.size()) {
Table current_table = this.tables.get(this.counter);
draw_table(current_table);
this.counter++;
} else if (this.counter == this.tables.size()) {
XmlOutput.create(this.tables, this.fonts, this.path);
}
} catch (Exception e) {
System.out
.println("Exception in class: gui and method: next. " + e);
}
}
示例15: queryOptions
import java.awt.Checkbox; //導入方法依賴的package包/類
public boolean queryOptions() {
MesquiteInteger buttonPressed = new MesquiteInteger(1);
ExtensibleDialog dialog = new ExtensibleDialog(containerOfModule(), "AlignDNAToProtein",buttonPressed); //MesquiteTrunk.mesquiteTrunk.containerOfModule()
dialog.addLabel("Align DNA to Protein");
Checkbox adjustCodonPositionsBox = dialog.addCheckBox("adjust codon positions if necessary in re-aligned sequences", adjustCodonPositions);
dialog.completeAndShowDialog(true);
if (buttonPressed.getValue()==0) {
adjustCodonPositions = adjustCodonPositionsBox.getState();
storePreferences();
}
dialog.dispose();
return (buttonPressed.getValue()==0);
}