當前位置: 首頁>>代碼示例>>Java>>正文


Java Choice類代碼示例

本文整理匯總了Java中java.awt.Choice的典型用法代碼示例。如果您正苦於以下問題:Java Choice類的具體用法?Java Choice怎麽用?Java Choice使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Choice類屬於java.awt包,在下文中一共展示了Choice類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
 
開發者ID:taciano-perez,項目名稱:JamVM-PH,代碼行數:18,代碼來源:GtkChoicePeer.java

示例2: queryAdditionalParameters

import java.awt.Choice; //導入依賴的package包/類
@Override
public void queryAdditionalParameters( final GenericDialog gd )
{
	gd.addChoice( "ImgLib2_container_FFTs", BoundingBoxGUI.imgTypes, BoundingBoxGUI.imgTypes[ defaultFFTImgType ] );
	gd.addCheckbox( "Save_memory (not keep FFT's on CPU, 2x time & 0.5x memory)", defaultSaveMemory );
	saveMem = (Checkbox)gd.getCheckboxes().lastElement();
	gd.addChoice( "Type_of_iteration", iterationTypeString, iterationTypeString[ defaultIterationType ] );
	it = (Choice)gd.getChoices().lastElement();
	gd.addChoice( "Image_weights", weightsString, weightsString[ defaultWeightType ] );
	weight = (Choice)gd.getChoices().lastElement();
	gd.addChoice( "OSEM_acceleration", osemspeedupChoice, osemspeedupChoice[ defaultOSEMspeedupIndex ] );
	gd.addNumericField( "Number_of_iterations", defaultNumIterations, 0 );
	gd.addCheckbox( "Debug_mode", defaultDebugMode );
	gd.addCheckbox( "Adjust_blending_parameters (if stripes are visible)", defaultAdjustBlending );
	gd.addCheckbox( "Use_Tikhonov_regularization", defaultUseTikhonovRegularization );
	gd.addNumericField( "Tikhonov_parameter", defaultLambda, 4 );
	gd.addChoice( "Compute", blocksChoice, blocksChoice[ defaultBlockSizeIndex ] );
	block = (Choice)gd.getChoices().lastElement();
	gd.addChoice( "Compute_on", computationOnChoice, computationOnChoice[ defaultComputationTypeIndex ] );
	gpu = (Choice)gd.getChoices().lastElement();
	gd.addChoice( "PSF_estimation", extractPSFChoice, extractPSFChoice[ defaultExtractPSF ] );
	gd.addChoice( "PSF_display", displayPSFChoice, displayPSFChoice[ defaultDisplayPSF ] );
}
 
開發者ID:fiji,項目名稱:SPIM_Registration,代碼行數:24,代碼來源:EfficientBayesianBased.java

示例3: getRoiSource

import java.awt.Choice; //導入依賴的package包/類
private ImagePlus getRoiSource(ImagePlus imp, Choice imageList, Choice optionList)
{
	// Get the ROI option
	if (optionList.getSelectedItem().equals(OPTION_NONE))
	{
		// No ROI image
		return null;
	}

	// Find the image in the image list
	if (imageList.getSelectedItem().equals(CHANNEL_IMAGE))
	{
		// Channel image is the source for the ROI
		return imp;
	}

	return WindowManager.getImage(imageList.getSelectedItem());
}
 
開發者ID:aherbert,項目名稱:GDSC,代碼行數:19,代碼來源:CDA_Plugin.java

示例4: test

import java.awt.Choice; //導入依賴的package包/類
private static void test(final Point tmp) throws Exception {
    Choice choice = new Choice();
    for (int i = 1; i < 7; i++) {
        choice.add("Long-long-long-long-long text in the item-" + i);
    }
    Frame frame = new Frame();
    try {
        frame.setAlwaysOnTop(true);
        frame.setLayout(new FlowLayout());
        frame.add(choice);
        frame.pack();
        frameWidth = frame.getWidth();
        frame.setSize(frameWidth, SIZE);
        frame.setVisible(true);
        frame.setLocation(tmp.x, tmp.y);
        openPopup(choice);
    } finally {
        frame.dispose();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:ChoicePopupLocation.java

示例5: UI

import java.awt.Choice; //導入依賴的package包/類
private static void UI() {
    Frame frame = new Frame("Test frame");
    Choice choice = new Choice();

    Stream.of(new String[]{"item 1", "item 2", "item 3"}).forEach(choice::add);
    frame.add(choice);
    frame.setBounds(100, 100, 400, 200);

    frame.setVisible(true);
    Font font = choice.getFont();
    int size = font.getSize();
    int height = choice.getBounds().height;
    try {
        if (height < size) {
            throw new RuntimeException("Test failed");
        }
    } finally {
        frame.dispose();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:ChoiceTest.java

示例6: removeItemListener

import java.awt.Choice; //導入依賴的package包/類
/**
 * Maps {@code Choice.removeItemListener(ItemListener)} through queue
 */
public void removeItemListener(final ItemListener itemListener) {
    runMapping(new MapVoidAction("removeItemListener") {
        @Override
        public void map() {
            ((Choice) getSource()).removeItemListener(itemListener);
        }
    });
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:ChoiceOperator.java

示例7: select

import java.awt.Choice; //導入依賴的package包/類
/**
 * Maps {@code Choice.select(int)} through queue
 */
public void select(final int pos) {
    runMapping(new MapVoidAction("select") {
        @Override
        public void map() {
            ((Choice) getSource()).select(pos);
        }
    });
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:ChoiceOperator.java

示例8: setState

import java.awt.Choice; //導入依賴的package包/類
/**
 * Maps {@code Choice.select(String)} through queue
 */
public void setState(final String str) {
    runMapping(new MapVoidAction("select") {
        @Override
        public void map() {
            ((Choice) getSource()).select(str);
        }
    });
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:ChoiceOperator.java

示例9: checkComponent

import java.awt.Choice; //導入依賴的package包/類
@Override
public boolean checkComponent(Component comp) {
    if (comp instanceof Choice) {
        if (((Choice) comp).getSelectedItem() != null) {
            return (comparator.equals(((Choice) comp).getSelectedItem(),
                    label));
        }
    }
    return false;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:ChoiceOperator.java

示例10: DitherControls

import java.awt.Choice; //導入依賴的package包/類
public DitherControls(DitherTest app, int s, int e, DitherMethod type,
        boolean vertical) {
    applet = app;
    setLayout(dcLayout);
    add(new Label(vertical ? "Vertical" : "Horizontal"));
    add(choice = new Choice());
    for (DitherMethod m : DitherMethod.values()) {
        choice.addItem(m.toString().substring(0, 1)
                + m.toString().substring(1).toLowerCase());
    }
    choice.select(type.ordinal());
    add(start = new CardinalTextField(Integer.toString(s), 4));
    add(end = new CardinalTextField(Integer.toString(e), 4));
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:15,代碼來源:DitherTest.java

示例11: DrawControls

import java.awt.Choice; //導入依賴的package包/類
@SuppressWarnings("LeakingThisInConstructor")
public DrawControls(DrawPanel target) {
    this.target = target;
    setLayout(new FlowLayout());
    setBackground(Color.lightGray);
    target.setForeground(Color.red);
    CheckboxGroup group = new CheckboxGroup();
    Checkbox b;
    add(b = new Checkbox(null, group, false));
    b.addItemListener(this);
    b.setForeground(Color.red);
    add(b = new Checkbox(null, group, false));
    b.addItemListener(this);
    b.setForeground(Color.green);
    add(b = new Checkbox(null, group, false));
    b.addItemListener(this);
    b.setForeground(Color.blue);
    add(b = new Checkbox(null, group, false));
    b.addItemListener(this);
    b.setForeground(Color.pink);
    add(b = new Checkbox(null, group, false));
    b.addItemListener(this);
    b.setForeground(Color.orange);
    add(b = new Checkbox(null, group, true));
    b.addItemListener(this);
    b.setForeground(Color.black);
    target.setForeground(b.getForeground());
    Choice shapes = new Choice();
    shapes.addItemListener(this);
    shapes.addItem("Lines");
    shapes.addItem("Points");
    shapes.setBackground(Color.lightGray);
    add(shapes);
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:35,代碼來源:DrawTest.java

示例12: itemStateChanged

import java.awt.Choice; //導入依賴的package包/類
@Override
public void itemStateChanged(ItemEvent e) {
    if (e.getSource() instanceof Checkbox) {
        target.setForeground(((Component) e.getSource()).getForeground());
    } else if (e.getSource() instanceof Choice) {
        String choice = (String) e.getItem();
        if (choice.equals("Lines")) {
            target.setDrawMode(DrawPanel.LINES);
        } else if (choice.equals("Points")) {
            target.setDrawMode(DrawPanel.POINTS);
        }
    }
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:14,代碼來源:DrawTest.java

示例13: CardTest

import java.awt.Choice; //導入依賴的package包/類
@SuppressWarnings("LeakingThisInConstructor")
public CardTest() {
    setLayout(new BorderLayout());
    add("Center", cards = new CardPanel(this));
    Panel p = new Panel();
    p.setLayout(new FlowLayout());
    add("South", p);

    Button b = new Button("first");
    b.addActionListener(this);
    p.add(b);

    b = new Button("next");
    b.addActionListener(this);
    p.add(b);

    b = new Button("previous");
    b.addActionListener(this);
    p.add(b);

    b = new Button("last");
    b.addActionListener(this);
    p.add(b);

    Choice c = new Choice();
    c.addItem("one");
    c.addItem("two");
    c.addItem("three");
    c.addItem("four");
    c.addItem("five");
    c.addItem("six");
    c.addItemListener(this);
    p.add(c);
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:35,代碼來源:CardTest.java

示例14: getDump

import java.awt.Choice; //導入依賴的package包/類
/**
 * Returns information about component.
 */
@Override
public Hashtable<String, Object> getDump() {
    Hashtable<String, Object> result = super.getDump();
    if (((Choice) getSource()).getSelectedItem() != null) {
        result.put(SELECTED_ITEM_DPROP, ((Choice) getSource()).getSelectedItem());
    }
    String[] items = new String[((Choice) getSource()).getItemCount()];
    for (int i = 0; i < ((Choice) getSource()).getItemCount(); i++) {
        items[i] = ((Choice) getSource()).getItem(i);
    }
    addToDump(result, ITEM_PREFIX_DPROP, items);
    return result;
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:17,代碼來源:ChoiceOperator.java

示例15: add

import java.awt.Choice; //導入依賴的package包/類
/**
 * Maps {@code Choice.add(String)} through queue
 */
public void add(final String item) {
    runMapping(new MapVoidAction("add") {
        @Override
        public void map() {
            ((Choice) getSource()).add(item);
        }
    });
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:12,代碼來源:ChoiceOperator.java


注:本文中的java.awt.Choice類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。