本文整理匯總了Java中java.awt.Choice.getSelectedIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java Choice.getSelectedIndex方法的具體用法?Java Choice.getSelectedIndex怎麽用?Java Choice.getSelectedIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Choice
的用法示例。
在下文中一共展示了Choice.getSelectedIndex方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GtkChoicePeer
import java.awt.Choice; //導入方法依賴的package包/類
public GtkChoicePeer (Choice c)
{
super (c);
int count = c.getItemCount ();
if (count > 0)
{
for (int i = 0; i < count; i++)
add(c.getItem(i), i);
selected = c.getSelectedIndex();
if (selected >= 0)
select( selected );
}
else
selected = -1;
}
示例2: dialogItemChanged
import java.awt.Choice; //導入方法依賴的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;
}
示例3: update
import java.awt.Choice; //導入方法依賴的package包/類
protected final static void update( final SpimData2 spimData, final Choice choice, final Label label1, final Label label2 )
{
final int index = choice.getSelectedIndex();
final BoundingBox bb = spimData.getBoundingBoxes().getBoundingBoxes().get( index );
label1.setText( "Bounding Box size: " + bb.dimension( 0 ) + "x" + bb.dimension( 1 ) + "x" + bb.dimension( 2 ) + " pixels" );
label2.setText( "Bounding Box offset: " + bb.min( 0 ) + "x" + bb.min( 1 ) + "x" + bb.min( 2 ) + " pixels" );
}
示例4: queryOptions
import java.awt.Choice; //導入方法依賴的package包/類
public boolean queryOptions() {
MesquiteInteger buttonPressed = new MesquiteInteger(1);
ExtensibleDialog dialog = new ExtensibleDialog(containerOfModule(), getName() + " Options",buttonPressed); //MesquiteTrunk.mesquiteTrunk.containerOfModule()
dialog.addLabel(getName() + " Options");
String helpString = "Please choose the options for consensus trees. ";
dialog.appendToHelpString(helpString);
queryOptionsSetup(dialog);
String[] rootingStrings = {"As specified in first tree", "Rooted", "Unrooted"};
Choice rootingChoice = dialog.addPopUpMenu("Treat trees as rooted or unrooted:", rootingStrings, 0);
//TextArea PAUPOptionsField = queryFilesDialog.addTextArea(PAUPOptions, 20);
dialog.completeAndShowDialog(true);
if (buttonPressed.getValue()==0) {
queryOptionsProcess(dialog);
int choiceValue = rootingChoice.getSelectedIndex();
if (choiceValue>=0)
rooting = choiceValue;
storePreferences();
}
dialog.dispose();
return (buttonPressed.getValue()==0);
}
示例5: queryOptions
import java.awt.Choice; //導入方法依賴的package包/類
public boolean queryOptions(MesquiteModule ownerModule) {
MesquiteInteger buttonPressed = new MesquiteInteger(1);
ExtensibleDialog dialog = new ExtensibleDialog(ownerModule.containerOfModule(), "Name category to use for sequence names",buttonPressed); //MesquiteTrunk.mesquiteTrunk.containerOfModule()
int tagNumber = getTagNumber(chosenNameCategoryTag);
Choice categoryChoice = dialog.addPopUpMenu("", nameCategoryDescriptions, tagNumber);
dialog.completeAndShowDialog(true);
boolean success=(buttonPressed.getValue()== dialog.defaultOK);
if (success) {
int chosen = categoryChoice.getSelectedIndex();
chosenNameCategoryTag = getCategoryTag(chosen);
}
dialog.dispose();
return success;
}