Examples of Choice


Examples of java.awt.Choice

        {
            try
            {
                String indexStr = (String) inputForm.get(peer.getId());
                int i = Integer.parseInt(indexStr);
                Choice choice = (Choice) peer.getComponentObject();
                if (choice.getSelectedIndex() != i)
                {
                    _logger.finest("item changes detected on component " + choice);
                    choice.select(i);
                    postEvent(context, new ItemEvent(choice, ItemEvent.ITEM_STATE_CHANGED, choice, ItemEvent.SELECTED));
                }
            } catch (NumberFormatException e)
            {
                _logger.warning("Choice input value is not an integer");
View Full Code Here

Examples of java.awt.Choice

     * @return java.awt.Choice
     */
    private Choice getMessageOutputLevelChoice() {
        if (iMessageOutputLevelChoice == null) {
            try {
                iMessageOutputLevelChoice = new Choice();
                iMessageOutputLevelChoice.setName("MessageOutputLevelChoice");
                iMessageOutputLevelChoice.add("Error");
                iMessageOutputLevelChoice.add("Warning");
                iMessageOutputLevelChoice.add("Info");
                iMessageOutputLevelChoice.add("Verbose");
View Full Code Here

Examples of java.awt.Choice

     * @return java.awt.Choice
     */
    private Choice getMessageOutputLevelChoice() {
        if (iMessageOutputLevelChoice == null) {
            try {
                iMessageOutputLevelChoice = new Choice();
                iMessageOutputLevelChoice.setName("MessageOutputLevelChoice");
                iMessageOutputLevelChoice.add("Error");
                iMessageOutputLevelChoice.add("Warning");
                iMessageOutputLevelChoice.add("Info");
                iMessageOutputLevelChoice.add("Verbose");
View Full Code Here

Examples of java.awt.Choice

        Choice cursorChoice;

        Canvas cursorCanvas;

        public void init() {
            cursorChoice = new Choice();
            cursorChoice.add("Default");
            cursorChoice.add("Crosshair");
            cursorChoice.add("Text");
            cursorChoice.add("Wait");
            cursorChoice.add("Southwest Resize");
View Full Code Here

Examples of java.awt.Choice

public class testName implements Testlet
{

  public void test(TestHarness harness)
  {
   Choice a0 = new Choice();
   Choice a1 = new Choice();
   Choice a2 = new Choice();
   harness.check(a0.getName(), "choice0");
   harness.check(a1.getName(), "choice1");
   harness.check(a2.getName(), "choice2");
   Choice a3 = new Choice();
   Choice a4 = new Choice();
   Choice a5 = new Choice();
   harness.check(a5.getName(), "choice3");
   harness.check(a4.getName(), "choice4");
   harness.check(a3.getName(), "choice5");
  
   CheckboxMenuItem b0 = new CheckboxMenuItem();
   CheckboxMenuItem b1 = new CheckboxMenuItem();
View Full Code Here

Examples of java.awt.Choice

   */
  public void test(TestHarness harness)
  {
    setBackground(Color.red);
    Frame f = new Frame();
    Choice c = new Choice();
    c.setBackground(Color.blue);
    add(c);
    f.add(this);
    f.pack();
    f.show();
    Rectangle bounds = c.getBounds();
    Insets i = f.getInsets();
    Point loc = f.getLocationOnScreen();
    bounds.x += i.left + loc.x;
    bounds.y += i.top + loc.y;
   
View Full Code Here

Examples of java.awt.Choice

public class remove implements Testlet
{

  public void test(TestHarness harness)
  {
    Choice c = new Choice();
   
    // testing remove with only one item
    harness.check(c.getSelectedIndex(), -1);
    harness.check(c.getItemCount(), 0);
    c.add("item1");
    harness.check(c.getSelectedIndex(), 0);
    harness.check(c.getItemCount(), 1);
    c.select(0);
    harness.check(c.getSelectedIndex(), 0);
    c.remove(0);
    harness.check(c.getSelectedIndex(), -1);
    harness.check(c.getItemCount(), 0);
   
    // testing remove with two items
    c.add("item1");
    c.add("item2");
    harness.check(c.getItemCount(), 2);
    c.select(0);
    harness.check(c.getSelectedIndex(), 0);
    c.select(1);
    harness.check(c.getSelectedIndex(), 1);
    c.remove(1);
    harness.check(c.getSelectedIndex(), 0);
    harness.check(c.getItemCount(), 1);
    c.remove(0);
    harness.check(c.getSelectedIndex(), -1);
    harness.check(c.getItemCount(), 0);
   
    // testing remove with more than two items
    harness.check(c.getSelectedIndex(), -1);
    c.add("item1");
    harness.check(c.getSelectedIndex(), 0);
    c.add("item2");
    harness.check(c.getSelectedIndex(), 0);
    c.add("item3");
    harness.check(c.getSelectedIndex(), 0);
    c.add("item4");
    harness.check(c.getSelectedIndex(), 0);   
    harness.check(c.getItemCount(), 4);
    c.select(2);
    harness.check(c.getSelectedIndex(), 2);
    c.select(1);
    harness.check(c.getSelectedIndex(), 1);
    c.remove(1);
    harness.check(c.getSelectedIndex(), 0);
    harness.check(c.getItemCount(), 3);
    c.remove(0);
    harness.check(c.getSelectedIndex(), 0);
    harness.check(c.getItemCount(), 2);
    c.remove(0);
    harness.check(c.getSelectedIndex(), 0);
    harness.check(c.getItemCount(), 1);
    c.remove(0);
    harness.check(c.getSelectedIndex(), -1);
    harness.check(c.getItemCount(), 0);
   
    // testing remove with invalid indexes.
    boolean fail = false;
    try
      {
        c.remove(2);
      }
    catch (ArrayIndexOutOfBoundsException e)
      {
        fail = true;
      }
    harness.check(fail);
   
    // testing remove on last index
    c.add("item1");
    c.add("item2");
    c.add("item3");
    harness.check(c.getSelectedIndex(), 0);
    c.select(2);
    harness.check(c.getSelectedIndex(), 2);
    c.remove(2);
    harness.check(c.getSelectedIndex(), 0);
  }
View Full Code Here

Examples of java.awt.Choice

        pText.setBackground(SystemColor.control);
        pLabel.setBackground(SystemColor.control);
        pButton.setBackground(SystemColor.control);
        pLabel.add(createLabel("Recent:"));

        recent = new Choice();

        try {
            settings = ConnectionDialogCommon.loadRecentConnectionSettings();
        } catch (java.io.IOException ioe) {
            ioe.printStackTrace();
        }

        recent.add(ConnectionDialogCommon.emptySettingName);

        Enumeration en = settings.elements();

        while (en.hasMoreElements()) {
            recent.add(((ConnectionSetting) en.nextElement()).getName());
        }

        recent.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {

                String s = (String) e.getItem();
                ConnectionSetting setting =
                    (ConnectionSetting) settings.get(s);

                if (setting != null) {
                    mName.setText(setting.getName());
                    mDriver.setText(setting.getDriver());
                    mURL.setText(setting.getUrl());
                    mUser.setText(setting.getUser());
                    mPassword.setText(setting.getPassword());
                }
            }
        });
        pText.add(recent);

        Button b;

        b = new Button("Clr");

        b.setActionCommand("Clear");
        b.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                ConnectionDialogCommon.deleteRecentConnectionSettings();

                settings = new Hashtable();

                recent.removeAll();
                recent.add(ConnectionDialogCommon.emptySettingName);
                mName.setText(null);
            }
        });
        pClearButton.add(b);
        pLabel.add(createLabel("Setting Name:"));

        mName = new TextField("");

        pText.add(mName);
        pLabel.add(createLabel("Type:"));

        types     = new Choice();
        connTypes = ConnectionDialogCommon.getTypes();

        for (int i = 0; i < connTypes.length; i++) {
            types.add(connTypes[i][0]);
        }
View Full Code Here

Examples of java.awt.Choice

        panSetting.add(tooltipDelay);

        tempPanel.add(panSetting);

        panSetting = new Panel(new FlowLayout(FlowLayout.LEFT));
        unitStartChar = new Choice();
        // Add option for "A, B, C, D..."
        unitStartChar.addItem("\u0041, \u0042, \u0043, \u0044..."); //$NON-NLS-1$
        // Add option for "ALPHA, BETA, GAMMA, DELTA..."
        unitStartChar.addItem("\u0391, \u0392, \u0393, \u0394..."); //$NON-NLS-1$
        // Add option for "alpha, beta, gamma, delta..."
        unitStartChar.addItem("\u03B1, \u03B2, \u03B3, \u03B4..."); //$NON-NLS-1$
        panSetting.add(unitStartChar);
        panSetting.add(new Label(Messages
                .getString("CommonSettingsDialog.protoMechUnitCodes"))); //$NON-NLS-1$

        panSetting = new Panel(new FlowLayout(FlowLayout.LEFT));
        panSetting.add(new Label(Messages
                .getString("CommonSettingsDialog.pathFiderTimeLimit"))); //$NON-NLS-1$
        maxPathfinderTime = new TextField(5);
        panSetting.add(maxPathfinderTime);
        tempPanel.add(panSetting);

        getFocus = new Checkbox(Messages
                .getString("CommonSettingsDialog.getFocus")); //$NON-NLS-1$
        tempPanel.add(getFocus);
        tempPanel.add(panSetting);

        // player-specific settings
        defaultAutoejectDisabled = new Checkbox(Messages
                .getString("CommonSettingsDialog.defaultAutoejectDisabled")); //$NON-NLS-1$
        defaultAutoejectDisabled.addItemListener(this);
        tempPanel.add(defaultAutoejectDisabled);

        useAverageSkills = new Checkbox(Messages
                .getString("CommonSettingsDialog.useAverageSkills")); //$NON-NLS-1$
        useAverageSkills.addItemListener(this);
        tempPanel.add(useAverageSkills);

        showUnitId = new Checkbox(Messages
                .getString("CommonSettingsDialog.showUnitId")); //$NON-NLS-1$
        showUnitId.addItemListener(this);
        tempPanel.add(showUnitId);

        // client-side gameLog settings
        keepGameLog = new Checkbox(Messages
                .getString("CommonSettingsDialog.keepGameLog")); //$NON-NLS-1$
        keepGameLog.addItemListener(this);
        tempPanel.add(keepGameLog);

        panSetting = new Panel(new FlowLayout(FlowLayout.LEFT));
        panSetting.add(new Label(Messages
                .getString("CommonSettingsDialog.logFileName"))); //$NON-NLS-1$
        gameLogFilename = new TextField(15);
        panSetting.add(gameLogFilename);
        tempPanel.add(panSetting);

        panSetting = new Panel(new FlowLayout(FlowLayout.LEFT));
        panSetting.add(new Label(Messages
                .getString("CommonSettingsDialog.tileset"))); //$NON-NLS-1$
        tileSetChoice = new Choice();
        panSetting.add(tileSetChoice);
        tempPanel.add(panSetting);

        /*
         * panSetting = new Panel(new FlowLayout(FlowLayout.LEFT));
         * panSetting.add( new
         * Label(Messages.getString("CommonSettingsDialog.logFileMaxSize")) );
         * //$NON-NLS-1$ gameLogMaxSize = new TextField(5); panSetting.add(
         * gameLogMaxSize ); tempPanel.add( panSetting );
         */

        stampFilenames = new Checkbox(Messages
                .getString("CommonSettingsDialog.stampFilenames")); //$NON-NLS-1$
        stampFilenames.addItemListener(this);
        tempPanel.add(stampFilenames);

        panSetting = new Panel(new FlowLayout(FlowLayout.LEFT));
        panSetting.add(new Label(Messages
                .getString("CommonSettingsDialog.stampFormat"))); //$NON-NLS-1$
        stampFormat = new TextField(15);
        panSetting.add(stampFormat);
        tempPanel.add(panSetting);

        // scrolling options
        tempPanel.add(new AdvancedLabel(Messages
                .getString("CommonSettingsDialog.mapScrollText"))); //$NON-NLS-1$

        rightDragScroll = new Checkbox(Messages
                .getString("CommonSettingsDialog.rightDragScroll")); //$NON-NLS-1$
        tempPanel.add(rightDragScroll);

        ctlScroll = new Checkbox(Messages
                .getString("CommonSettingsDialog.ctlScroll")); //$NON-NLS-1$
        tempPanel.add(ctlScroll);

        clickEdgeScroll = new Checkbox(Messages
                .getString("CommonSettingsDialog.clickEdgeScroll")); //$NON-NLS-1$
        tempPanel.add(clickEdgeScroll);

        alwaysRightClickScroll = new Checkbox(Messages
                .getString("CommonSettingsDialog.alwaysRightClickScroll")); //$NON-NLS-1$
        tempPanel.add(alwaysRightClickScroll);

        autoEdgeScroll = new Checkbox(Messages
                .getString("CommonSettingsDialog.autoEdgeScroll")); //$NON-NLS-1$
        tempPanel.add(autoEdgeScroll);

        panSetting = new Panel(new FlowLayout(FlowLayout.LEFT));
        panSetting.add(new Label(Messages
                .getString("CommonSettingsDialog.scrollSesitivity"))); //$NON-NLS-1$
        scrollSensitivity = new TextField(4);
        panSetting.add(scrollSensitivity);
        tempPanel.add(panSetting);

        // locale settings
        panSetting = new Panel(new FlowLayout(FlowLayout.LEFT));
        panSetting.add(new Label(Messages
                .getString("CommonSettingsDialog.locale"))); //$NON-NLS-1$
        // locale = new TextField(8);
        locale = new Choice();
        locale.add(Messages.getString("CommonSettingsDialog.locale.English")); //$NON-NLS-1$
        locale.add(Messages.getString("CommonSettingsDialog.locale.Deutsch")); //$NON-NLS-1$
        locale.add(Messages.getString("CommonSettingsDialog.locale.Russian")); //$NON-NLS-1$
        panSetting.add(locale);
        tempPanel.add(panSetting);
View Full Code Here

Examples of java.awt.Choice

        labTeam = new Label(
                Messages.getString("ChatLounge.labTeam"), Label.RIGHT); //$NON-NLS-1$
        labCamo = new Label(
                Messages.getString("ChatLounge.labCamo"), Label.RIGHT); //$NON-NLS-1$

        choTeam = new Choice();
        setupTeams();
        choTeam.addItemListener(this);

        butCamo = new ImageButton();
        butCamo.setLabel(Messages.getString("ChatLounge.noCamo")); //$NON-NLS-1$
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.