當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。