当前位置: 首页>>代码示例>>Java>>正文


Java Choice.add方法代码示例

本文整理汇总了Java中java.awt.Choice.add方法的典型用法代码示例。如果您正苦于以下问题:Java Choice.add方法的具体用法?Java Choice.add怎么用?Java Choice.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Choice的用法示例。


在下文中一共展示了Choice.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: addImageName

import java.awt.Choice; //导入方法依赖的package包/类
/**
 * Adds the image name.
 *
 * @param title the title
 */
@SuppressWarnings("unchecked")
private void addImageName(String title){
	Vector<Choice> vc = gd.getChoices();
	Choice c = vc.get(1);
	c.removeAll();
	c.add(title);
	gd.validate();
	gd.pack();
}
 
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:15,代码来源:ImageDialog.java

示例3: DecisionVariableGUI

import java.awt.Choice; //导入方法依赖的package包/类
public DecisionVariableGUI(InfoGUI variableInformations) {

		controlIndex = index;
		index++;

		componentType = variableInformations.getComponentType();
		label = new Label(variableInformations.getLabelCaption());
		label.setPreferredSize(LABEL_DIMENSION);
		variableName = variableInformations.getVariableName();

		List<String> possibleValues = variableInformations.getValues();

		switch (componentType) {
		case TEXTFIELD:
			component = new TextField();
			break;

		case CHOICE:
			Choice variableValues = new Choice();
			if (!possibleValues.isEmpty()) {
				for (String value : possibleValues) {
					variableValues.add(value);
				}
				component = variableValues;
			}

			break;
		}

		component.setPreferredSize(COMPONENT_DIMENSION);

	}
 
开发者ID:siemens,项目名称:JMiniZinc,代码行数:33,代码来源:DecisionVariableGUI.java

示例4: create

import java.awt.Choice; //导入方法依赖的package包/类
private void create() {
	buttonsHigh = new JPanel();
	buttonsHigh.setLayout(new FlowLayout());
	buttonsHigh.setBorder(BorderFactory.createEmptyBorder(25, 0, 0, 0));
	buttonsLow = new JPanel();
	buttonsLow.setLayout(new FlowLayout());
	setBank = new Choice();
	setBank.add("Bank 1");
	setBank.add("Bank 2");
	buttonsHigh.add(setBank);
	writeROM = new JButton("Write ROM to cart");
	buttonsHigh.add(writeROM);
	readROM = new JButton("Read ROM to file");
	buttonsHigh.add(readROM);
	refresh = new JButton("Refresh");
	buttonsHigh.add(refresh);
	writeSRAM = new JButton("Write SAVE to cart");
	buttonsLow.add(writeSRAM);
	readSRAM = new JButton("Read SAVE to file");
	buttonsLow.add(readSRAM);
	about = new JButton("About");
	buttonsLow.add(about);
	quit = new JButton("Quit");
	buttonsLow.add(quit);

	console = new JScrollPane();
	console.setPreferredSize(new Dimension(600, 450));
	consoleText = new JTextArea();
	consoleText.setBorder(BorderFactory.createCompoundBorder(consoleText.getBorder(),
			BorderFactory.createEmptyBorder(5, 5, 5, 5)));
	consoleText.setEditable(false);
	console.setViewportView(consoleText);

	window.add(buttonsHigh, BorderLayout.NORTH);
	window.add(buttonsLow, BorderLayout.CENTER);
	window.add(console, BorderLayout.SOUTH);

	execCommand("--title --verbose");
}
 
开发者ID:hexensemble,项目名称:gb-usb-64m-cart-mac,代码行数:40,代码来源:ControlPanel.java

示例5: findPorts

import java.awt.Choice; //导入方法依赖的package包/类
public void findPorts(Choice choice){
	choice.removeAll();
	
	for(String port : OCPCore.getPorts()){
		choice.add(port);
	}
}
 
开发者ID:Error22,项目名称:OpenControlProtocol,代码行数:8,代码来源:ManualFrame.java

示例6: createRoiChoicePanel

import java.awt.Choice; //导入方法依赖的package包/类
private Panel createRoiChoicePanel(Choice imageList, Choice optionList, String label, int selectedOptionIndex)
{
	Panel panel = new Panel();
	panel.setLayout(new BorderLayout());
	Label listLabel = new Label(label, 0);
	listLabel.setFont(monoFont);
	// imageList.setSize(fontWidth * 3, fontWidth);
	panel.add(listLabel, BorderLayout.WEST);
	panel.add(optionList, BorderLayout.CENTER);
	panel.add(imageList, BorderLayout.EAST);
	optionList.add(OPTION_NONE);
	optionList.add(OPTION_MIN_VALUE);
	optionList.add(OPTION_USE_ROI);
	optionList.add(OPTION_MASK);
	imageList.add(CHANNEL_IMAGE);

	if (selectedOptionIndex < 4 && selectedOptionIndex >= 0)
	{
		optionList.select(selectedOptionIndex);
	}

	return panel;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:24,代码来源:CDA_Plugin.java

示例7: createChoicePanel

import java.awt.Choice; //导入方法依赖的package包/类
private Panel createChoicePanel(Choice list, String[] options, String selected, String label)
{
	Panel panel = new Panel();
	panel.setLayout(new BorderLayout());
	Label listLabel = new Label(label, 0);
	if (options != null)
	{
		for (String option : options)
			list.add(option);
		try
		{
			list.select(Integer.parseInt(selected));
		}
		catch (Exception ex)
		{
			list.select((String) selected);
		}
	}
	panel.add(listLabel, BorderLayout.WEST);
	panel.add(list, BorderLayout.CENTER);
	return panel;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:23,代码来源:Stack_Synchroniser.java

示例8: construirPanelSolicitud

import java.awt.Choice; //导入方法依赖的package包/类
public Panel construirPanelSolicitud() {
    Panel p = new Panel();
    codigosOperacion = new Choice();
    codop1 = "Crear";
    codop2 = "Eliminar";
    codop3 = "Leer";
    codop4 = "Escribir";
    codigosOperacion.add(codop1);
    codigosOperacion.add(codop2);
    codigosOperacion.add(codop3);
    codigosOperacion.add(codop4);
    campoMensaje = new TextField(10);
    botonSolicitud = new Button("Solicitar");
    botonSolicitud.addActionListener(new ManejadorSolicitud());
    p.add(new Label("Operacion:"));
    p.add(codigosOperacion);
    p.add(new Label("Datos:"));
    p.add(campoMensaje);
    p.add(botonSolicitud);
    return p;
}
 
开发者ID:strosek,项目名称:ds-tsoa,代码行数:22,代码来源:ClienteFrame.java

示例9: KeyboardPanel

import java.awt.Choice; //导入方法依赖的package包/类
public KeyboardPanel ()
{	setLayout(new BorderLayout());
	
	Panel center=new Panel();
	center.setLayout(new GridLayout(0,1));
	// the menu item
	center.add(MenuString=new MyTextField("",30));
	MenuString.setEditable(false);
	// the description
	center.add(ActionName=new MyTextField());
	ActionName.setEditable(false);
	// the key
	center.add(CharKey=new MyTextField());
	CharKey.setEditable(false);
	CharKey.addKeyListener(this);
	// modifiers
	center.add(Shift=new Checkbox(Global.name("keyeditor.shift")));
	center.add(Control=new Checkbox(Global.name("keyeditor.control")));
	center.add(Alt=new Checkbox(Global.name("keyeditor.alt")));
	add("Center",center);

	Panel south=new Panel();
	south.setLayout(new BorderLayout());
	Panel c=new Panel();
	// the choice of command keys
	C=new Choice();
	if (Global.NormalFont!=null) C.setFont(Global.NormalFont);
	c.add(C);
	C.add("-------------");
	south.add("Center",c);
	// default and undefine buttons
	Panel buttons=new Panel();
	buttons.add(new ButtonAction(this,
		Global.name("keyeditor.default"),"Default"));
	buttons.add(new ButtonAction(this,
		Global.name("keyeditor.none"),"None"));
	south.add("South",buttons);
	add("South",south);
}
 
开发者ID:Zenigata,项目名称:jago,代码行数:40,代码来源:KeyboardPanel.java

示例10: newSortChoice

import java.awt.Choice; //导入方法依赖的package包/类
private Choice newSortChoice(String[] labels) {
  Choice result = new Choice();
  result.add(labels[Field.NOP]);
  for(int i = Field.ASCENDING; i <= Field.CUSTOM; i++)
    result.add(labels[i]);
  return result;
}
 
开发者ID:tamirhassan,项目名称:pdfxtk,代码行数:8,代码来源:Find.java

示例11: initComponents

import java.awt.Choice; //导入方法依赖的package包/类
private void initComponents() {
	
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 439, 337);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	txtUsuario = new JTextField();
	txtUsuario.setFont(new Font("Tahoma", Font.BOLD, 11));
	txtUsuario.setEditable(false);
	txtUsuario.setBounds(16, 36, 314, 23);
	contentPane.add(txtUsuario);
	txtUsuario.setColumns(10);
	
	JLabel lblUsuario = new JLabel("Usuario");
	lblUsuario.setBounds(16, 21, 61, 14);
	contentPane.add(lblUsuario);
	
	txtCodigo = new JTextField();
	txtCodigo.setFont(new Font("Tahoma", Font.BOLD, 11));
	txtCodigo.setEditable(false);
	txtCodigo.setBounds(16, 146, 314, 23);
	contentPane.add(txtCodigo);
	txtCodigo.setColumns(10);
	
	lblCodigo = new JLabel("Codigo ");
	lblCodigo.setBounds(16, 128, 126, 14);
	contentPane.add(lblCodigo);	
	
	lblfecha_prestDePrestamo = new JLabel("Fecha de pr\u00E9stamo");
	lblfecha_prestDePrestamo.setBounds(16, 193, 148, 14);
	contentPane.add(lblfecha_prestDePrestamo);
	
	btnBuscarCodigo = new JButton("...");
	btnBuscarCodigo.setBounds(346, 146, 61, 23);
	contentPane.add(btnBuscarCodigo);
	btnBuscarCodigo.setEnabled(false);
	btnBuscarCodigo.addActionListener(this);
	
	btnBuscarUsuario = new JButton("...");
	btnBuscarUsuario.setBounds(346, 35, 61, 23);
	contentPane.add(btnBuscarUsuario);
	btnBuscarUsuario.addActionListener(this);
	
	tipo = new Choice();
	tipo.setBounds(16, 91, 115, 20);
	tipo.add("Seleccione");
	tipo.add("Libro");
	tipo.add("Revista");
	tipo.add("CDROM");
	tipo.add("Articulo");
	tipo.setEnabled(false);
	tipo.addItemListener(this);
	contentPane.add(tipo);
	
	lblTipo = new JLabel("Tipo");
	lblTipo.setBounds(16, 71, 46, 14);
	contentPane.add(lblTipo);
	
	addWindowListener(this);
	setVisible(true);
	setLocationRelativeTo(null);
}
 
开发者ID:JuandeLS3,项目名称:Library-app,代码行数:66,代码来源:NuevoPrestamo.java

示例12: addComponents

import java.awt.Choice; //导入方法依赖的package包/类
private void addComponents() {
	Panel panel = new Panel();
	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

	Box algorithmChosing = Box.createHorizontalBox();
	algorithmChosing.setAlignmentX(Box.CENTER_ALIGNMENT);
	Label choseTheAlgorithm = new Label("Chose the algorithm:");
	algorithmChosing.add(choseTheAlgorithm);

	algorithmType = new Choice();
	algorithmType.add(QUICKXPLAIN_HSDAG);
	algorithmType.add(SCD_HSDAG);
	algorithmType.add(FAST_DIAG_ALL);
	algorithmType.add(FAST_DIAG);

	algorithmChosing.add(algorithmType);
	algorithmChosing.add(Box.createHorizontalGlue());

	generateSolution = new Button("Start diagnosis ...");
	algorithmChosing.add(generateSolution);
	algorithmChosing.setAlignmentX(Box.RIGHT_ALIGNMENT);
	panel.add(algorithmChosing);

	generateSolution.addActionListener(new ActionListener() {

		@Override
		public void actionPerformed(ActionEvent e) {
			generateSolution.setEnabled(false);
			generateSolution();
			generateSolution.setEnabled(true);

		}

	});

	textLog = new TextArea();
	textLog.setEditable(false);
	textLog.setPreferredSize(new Dimension(500, 700));

	panel.add(Box.createRigidArea(new Dimension(0, 10)));
	panel.add(textLog);

	controlPanel.add(panel);
}
 
开发者ID:siemens,项目名称:JMiniZinc,代码行数:45,代码来源:VariableDialog.java

示例13: init

import java.awt.Choice; //导入方法依赖的package包/类
public void init ()
{
  cursorChoice = new Choice();
  cursorChoice.add ("Default");
  cursorChoice.add ("Crosshair");
  cursorChoice.add ("Text");
  cursorChoice.add ("Wait");
  cursorChoice.add ("Southwest Resize");
  cursorChoice.add ("Southeast Resize");
  cursorChoice.add ("Northwest Resize");
  cursorChoice.add ("Northeast Resize");
  cursorChoice.add ("North Resize");
  cursorChoice.add ("South Resize");
  cursorChoice.add ("West Resize");
  cursorChoice.add ("East Resize");
  cursorChoice.add ("Hand");
  cursorChoice.add ("Move");

  cursorChoice.addItemListener(this);

  add (cursorChoice, "North");

  cursorCanvas = new Canvas ()
    {
      public void paint (Graphics g)
      {
        Dimension d = this.getSize();
        g.setColor(Color.white);
        g.fillRect(0, 0, d.width, d.height/2);
        g.setColor(Color.black);
        g.fillRect(0, d.height/2, d.width, d.height/2);
        g.setColor(this.getBackground());
        g.fillRect(d.width/3, d.height/3, d.width/3,
                    d.height/3);
      }
    };

  cursorCanvas.setSize (80,80);

  add (cursorCanvas, "Center");

  Button cb = new Button ("Close");
  cb.addActionListener(new ActionListener () {
      public void actionPerformed (ActionEvent e) {
        dispose();
      }
    });

  add (cb, "South");
  setTitle ("Cursors");
  pack();
}
 
开发者ID:vilie,项目名称:javify,代码行数:53,代码来源:Demo.java

示例14: initInputPanel

import java.awt.Choice; //导入方法依赖的package包/类
private void initInputPanel(Panel p) {
   GridBagConstraints gbc=
     new GridBagConstraints();
   p.setLayout(new GridBagLayout());
   gbc.weightx=100;
   gbc.weighty=100;
   gbc.gridwidth=1;
   gbc.gridheight=1;
   gbc.fill=GridBagConstraints.HORIZONTAL;
   gbc.anchor=GridBagConstraints.WEST;

   gbc.gridx=0;
   gbc.gridy=0;
   Label typeLabel=new Label("Type");
   p.add(typeLabel,gbc);
   gbc.gridx=1;
   gbc.gridwidth=GridBagConstraints.REMAINDER;
   Label valueLabel=new Label("Value");
   p.add(valueLabel,gbc);

   gbc.gridx=0;
   gbc.gridy=1;
   Choice type=new Choice();
   type.add("Byte");
   type.add("Short");
   type.add("Character");
   type.add("Integer");
   type.add("Long");
   type.add("Float");
   type.add("Double");
   type.add("String");
   type.add("Object");
   type.select("Float");
   type.addItemListener(new TypeChoiceCommand());
   p.add(type,gbc);
   gbc.gridx=1;
   gbc.gridwidth=GridBagConstraints.REMAINDER;
   value=new ValueChoice();
   p.add(value,gbc);

   gbc.gridx=0;
   gbc.gridy=2;
   gbc.gridwidth=1;
   gbc.fill=GridBagConstraints.NONE;
   Button reset=new Button("Reset");
   reset.addActionListener(new ResetCommand());
   p.add(reset,gbc);
   gbc.gridx=1;
   gbc.gridwidth=GridBagConstraints.REMAINDER;
   Button position=new Button("Add");
   position.addActionListener(new AddCommand());
   p.add(position,gbc);

gbc.gridx=0;
gbc.gridy=3;
   gbc.gridwidth=1;
   gbc.gridheight=GridBagConstraints.REMAINDER;
   gbc.fill=GridBagConstraints.HORIZONTAL;
   Label format = new Label("Control String");
   p.add(format,gbc);
gbc.gridx=1;
   TextField formatString = new TextField(40);
   gbc.gridwidth=GridBagConstraints.REMAINDER;
   formatString.addTextListener(new FormatCommand());
   p.add(formatString,gbc);
 }
 
开发者ID:triguero,项目名称:Keel3.0,代码行数:67,代码来源:PrintfApplet.java

示例15: init

import java.awt.Choice; //导入方法依赖的package包/类
public void init ()
   {
     cursorChoice = new Choice();
     cursorChoice.add ("Default");
     cursorChoice.add ("Crosshair");
     cursorChoice.add ("Text");
     cursorChoice.add ("Wait");
     cursorChoice.add ("Southwest Resize");
     cursorChoice.add ("Southeast Resize");
     cursorChoice.add ("Northwest Resize");
     cursorChoice.add ("Northeast Resize");
     cursorChoice.add ("North Resize");
     cursorChoice.add ("South Resize");
     cursorChoice.add ("West Resize");
     cursorChoice.add ("East Resize");
     cursorChoice.add ("Hand");
     cursorChoice.add ("Move");
     
     cursorChoice.addItemListener(this);
     
     add (cursorChoice, "North");
     
     cursorCanvas = new Canvas () 
{ 
  public void paint (Graphics g) 
  {
    Dimension d = this.getSize();
    g.setColor(Color.white);
    g.fillRect(0, 0, d.width, d.height/2);
    g.setColor(Color.black);
    g.fillRect(0, d.height/2, d.width, d.height/2);
    g.setColor(this.getBackground());
    g.fillRect(d.width/3, d.height/3, d.width/3,
		d.height/3);
  }
};
     
     cursorCanvas.setSize (80,80);
     
     add (cursorCanvas, "Center");
     
     Button cb = new Button ("Close");
     cb.addActionListener(new ActionListener () {
  public void actionPerformed (ActionEvent e) {
    dispose();
  }
});
     
     add (cb, "South");
     setTitle ("Cursors");
     pack();
   }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:53,代码来源:Demo.java


注:本文中的java.awt.Choice.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。