Package java.awt

Examples of java.awt.Choice$ChoiceStateController


        };
        files.addItemListener(this);

        // Create the 'Look In' component
        lookIn = new Choice();
        lookIn.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                AWTFileSelector.this.cwd = new File(lookIn.getSelectedItem());
                refresh();               
            }
           
        });
        rebuildLookIn();

        // Create the tool bar
        Panel z = new Panel(new FlowLayout());
        if (showButtons) {
            home = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_HOME, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.home") : null, "home"); //$NON-NLS-1$ //$NON-NLS-2$
            home.setHoverButton(true);
            home.addActionListener(this);
            home.setToolTipText(Messages.getString("AWTFileSelector.navigateToYourHomeDirectory")); //$NON-NLS-1$
            z.add(home);
            parent = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_UP_FOLDER, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.home") : null, "home"); //$NON-NLS-1$ //$NON-NLS-2$
            parent.setHoverButton(true);
            parent.addActionListener(this);
            parent.setToolTipText(Messages.getString("AWTFileSelector.navigateToParent")); //$NON-NLS-1$
            z.add(parent);
            newFolder = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_NEW_FOLDER, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.new") : null, "newFolder"); //$NON-NLS-1$ //$NON-NLS-2$
            newFolder.setHoverButton(true);
            newFolder.addActionListener(this);
            newFolder.setToolTipText(Messages.getString("AWTFileSelector.createFolder")); //$NON-NLS-1$
            z.add(newFolder);
            remove = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_DELETE, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.delete") : null, "delete"); //$NON-NLS-1$ //$NON-NLS-2$
            remove.setHoverButton(true);
            remove.addActionListener(this);
            remove.setToolTipText(Messages.getString("AWTFileSelector.removeSelected")); //$NON-NLS-1$
            z.add(remove);
        }
        if (showHiddenFilesSwitch) {
            showHiddenFiles = new Checkbox(Messages.getString("AWTFileSelector.hiddentFiles"));             //$NON-NLS-1$
            showHiddenFiles.addItemListener(new ItemListener() {

                public void itemStateChanged(ItemEvent e) {
                    refresh();
                }
            });
        }

        // Create the top bar
        Panel top = new Panel(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.weightx = 1.0;
        UIUtil.gridBagAdd(top, lookIn, gbc, GridBagConstraints.RELATIVE);
        gbc.weightx = 0.0;
        UIUtil.gridBagAdd(top, z, gbc, GridBagConstraints.REMAINDER);
       
        // Create the path panel
        Panel pathPanel = new Panel(new GridBagLayout());
        GridBagConstraints gbc1 = new GridBagConstraints();
        path = new TextField(""); //$NON-NLS-1$
        path.addActionListener(this);
        gbc1.fill = GridBagConstraints.HORIZONTAL;
        gbc1.anchor = GridBagConstraints.WEST;
        gbc1.weightx = 0.0;
        gbc1.insets = new Insets(2, 2, 2, 2);
        UIUtil.gridBagAdd(pathPanel, new Label(Messages.getString("AWTFileSelector.fileName")), gbc1, showButtons ? 1 : GridBagConstraints.RELATIVE); //$NON-NLS-1$
        gbc1.weightx = 1.0;
        UIUtil.gridBagAdd(pathPanel, path, gbc1, showButtons ? GridBagConstraints.RELATIVE : GridBagConstraints.REMAINDER);
        gbc1.weightx = 0.0;
        if(showButtons) {
            go = new ImageButton(null, Messages.getString("AWTFileSelector.go"), "go"); //$NON-NLS-1$ //$NON-NLS-2$
            go.setHoverButton(true);
            go.addActionListener(this);
            go.setToolTipText(Messages.getString("AWTFileSelector.navigateToSelectedFolder")); //$NON-NLS-1$
            UIUtil.gridBagAdd(pathPanel, go, gbc1, GridBagConstraints.REMAINDER);
        }
        UIUtil.gridBagAdd(pathPanel, new Label(Messages.getString("AWTFileSelector.filesOfType")), gbc1, showButtons ? 1 : GridBagConstraints.RELATIVE); //$NON-NLS-1$
        gbc1.weightx = 1.0;
        filterSelect = new Choice();
        rebuildFilterSelect();
        filterSelect.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                refresh();
            }
View Full Code Here


        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

        }
    }

    public Object updateUI(Object com, DomNode element)
    {
        Choice choice = (Choice) com;
        populateItems(choice, element);
        return com;
    }
View Full Code Here

    public void handleEvent(AWTEvent e)
    {
        if (e instanceof ItemEvent)
        {
            Choice c = (Choice) e.getSource();
            ItemEvent itemEvent = (ItemEvent) e;
            Object clicked = itemEvent.getItem();
            int index = 0;
            for (int i = 0; i < c.getItemCount(); i++)
            {
                if (c.getItem(i) == clicked)
                {
                    index = i;
                    break;
                }
            }
View Full Code Here

        {
            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

     * @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

     * @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

        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

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

   */
  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

TOP

Related Classes of java.awt.Choice$ChoiceStateController

Copyright © 2018 www.massapicom. 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.