当前位置: 首页>>代码示例>>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;未经允许,请勿转载。