Package java.awt

Examples of java.awt.Choice$State


   *  
   * @return java.awt.Choice 
   */
  private Choice getChoice3() {
    if (choice3 == null) {
      choice3 = new Choice();
      choice3.setBounds(new Rectangle(450, 160, 100, 25));
      choice3.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent e) {
                  if (choice3.getSelectedIndex() == 0)
                  {
View Full Code Here


   *  
   * @return java.awt.Choice 
   */
  private Choice getChoice4() {
    if (choice4 == null) {
      choice4 = new Choice();
      choice4.setBounds(new Rectangle(450, 190, 100, 25));
      choice4.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent e) {
                  if (choice4.getSelectedIndex() == 0)
                  {
View Full Code Here

//choice by user name

    private Choice getNameChoice() {
          if (NameChoice == null) {
              NameChoice = new Choice();
              NameChoice.setBounds(new Rectangle(350, 120, 100, 25));
             
              NameChoice.insert("None", 0);
              NameChoice.insert("a", 1);
              NameChoice.insert("b", 2);
View Full Code Here

  //choice by Privilage

    private Choice getPrivilageChoice() {
           if (PrivilageChoice == null) {
               PrivilageChoice = new Choice();
               PrivilageChoice.setBounds(new Rectangle(460, 120, 100, 25));

               PrivilageChoice.insert("None",0);
               PrivilageChoice.insert("0",1);
               PrivilageChoice.insert("1",2);
View Full Code Here

   
   
    private Choice getChangePrivilegeChoice() //choice to change user privilege
    {
          if (changePrivilegeChoice == null) {
            changePrivilegeChoice = new Choice();
            changePrivilegeChoice.setBounds(new Rectangle(725, 150, 50, 14));
             
            changePrivilegeChoice.insert("0", 0);
            changePrivilegeChoice.insert("1", 1);
            changePrivilegeChoice.insert("2", 2);
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

        p.addKeyListener(this);
        p.setBackground(SystemColor.control);
        p.add(createLabel("Type:"));

        Choice types = new Choice();

        types.addItemListener(this);
        types.addKeyListener(this);

        for (int i = 0; i < sJDBCTypes.length; i++) {
            types.add(sJDBCTypes[i][0]);
        }

        p.add(types);
        p.add(createLabel("Driver:"));
View Full Code Here

        pEntry.add(new Label("Search table"), c);

        c.gridx = 1;

        // get all table names and show a drop down list of them in cTables
        cTables = new Choice();

        for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
            cTables.addItem((String) e.nextElement());
        }
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

       
        final ArrayList<SyberiadaZdarzenie> listaZdarzen = XMLParser.getXMLParser().getAllZdarzenie();
       
        Collections.sort(listaZdarzen);
       
        final Choice listaRozwijalna = new Choice();
       
        for (int i = 0; i < listaZdarzen.size(); i++) {
            SyberiadaZdarzenie zdarzenie = listaZdarzen.get(i);
            listaRozwijalna.add(zdarzenie.getId()+"");
        }
       
        panel.add(listaRozwijalna);
       
        MaskFormatter f = new MaskFormatter("****");
        final JFormattedTextField idField = new JFormattedTextField(f);
        idField.setColumns(4);
       
        panel.add(idField);
       
        JButton noweZdarzenie = new JButton("Nowe");
        panel.add(noweZdarzenie);
       
        JButton zapiszZdarzenie = new JButton("Zapisz");
        panel.add(zapiszZdarzenie);
       
        JButton nowaOpcja = new JButton("+Opcja");
        panel.add(nowaOpcja);
       
        this.add(panel, BorderLayout.PAGE_START);
       
        final JTextArea tresc = new JTextArea();
        JScrollPane scroll = new JScrollPane(tresc);
       
        tresc.setLineWrap(true);
        this.add(scroll, BorderLayout.CENTER);
       
        final JPanel dolPanel = new JPanel();
        dolPanel.setLayout(new GridLayout(0,1));
        this.add(dolPanel, BorderLayout.PAGE_END);
       
        this.validate();
        this.repaint();
       
        listaRozwijalna.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                idField.setText(listaRozwijalna.getSelectedItem());
                String trescZdarzenia = listaZdarzen.get(listaRozwijalna.getSelectedIndex()).getZdarzenieText();
                trescZdarzenia = clearText(trescZdarzenia);
                tresc.setText(trescZdarzenia);
               
                ArrayList<SyberiadaOpcja> opcje = listaZdarzen.get(listaRozwijalna.getSelectedIndex()).getListaOpcji();
               
                dolPanel.removeAll();
               
                for (int i = 0; i < opcje.size(); i++) {
                    SyberiadaOpcja opcja = opcje.get(i);
                   
                    JPanel panel = new JPanel();
                    panel.setLayout(new BorderLayout());
                   
                    String opcjaText = opcja.getOpcjatext();
                    JTextField opcjaField = new JTextField();
                    opcjaField.setText(opcjaText);
                    panel.add(opcjaField, BorderLayout.CENTER);
                   
                    int opcjaIdText = opcja.getOpcjaDo();
                    MaskFormatter f;
                    try {
                        f = new MaskFormatter("****");
                        final JFormattedTextField opcjaId = new JFormattedTextField(f);
                        opcjaId.setColumns(4);
                        opcjaId.setText(opcjaIdText+"");
                        panel.add(opcjaId, BorderLayout.LINE_END);
                    } catch (ParseException ex) {
                        Logger.getLogger(Frame.class.getName()).log(Level.SEVERE, null, ex);
                    }
                   
                    dolPanel.add(panel);
                }
                validate();
                repaint();
            }
        });
       
        noweZdarzenie.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int max = 0;
                for (int i = 0; i < listaRozwijalna.getItemCount(); i++) {
                    if (max<Integer.parseInt(listaRozwijalna.getItem(i))) {
                        max = Integer.parseInt(listaRozwijalna.getItem(i));
                    }
                }
                SyberiadaOpcja newOpcja = new SyberiadaOpcja("",0);
                ArrayList<SyberiadaOpcja> listaOpcji = new ArrayList<SyberiadaOpcja>();
                listaOpcji.add(newOpcja);
               
                max++;
               
                SyberiadaZdarzenie noweZdarzenie = new SyberiadaZdarzenie("", listaOpcji, max);
                listaZdarzen.add(noweZdarzenie);
               
                listaRozwijalna.removeAll();
               
                Collections.sort(listaZdarzen);
                for (int i = 0; i < listaZdarzen.size(); i++) {
                    SyberiadaZdarzenie zdarzenie = listaZdarzen.get(i);
                    listaRozwijalna.add(zdarzenie.getId() + "");
                }
            }
        });
       
         zapiszZdarzenie.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int selectedID = listaRozwijalna.getSelectedIndex();
                SyberiadaZdarzenie zdarzenieDoZmiany = listaZdarzen.get(selectedID);
                String noweIdStr = idField.getText().replaceAll("[\\D]", "");
                zdarzenieDoZmiany.setId(Integer.parseInt(noweIdStr));
               
                String text = tresc.getText();
                text = text.replaceAll("\n", "<br/>");
                text = text.replaceAll("\t", "&nbsp");
                zdarzenieDoZmiany.setZdarzenieText(text);

                ArrayList<SyberiadaOpcja> opcje = new ArrayList<SyberiadaOpcja>();
               
                for (int i = 0; i < dolPanel.getComponentCount(); i++) {
                    JPanel panel = (JPanel) dolPanel.getComponent(i);
                    String trescOpcji = ((JTextField)panel.getComponent(0)).getText();
                    if (trescOpcji.equalsIgnoreCase("")) {
                       
                    } else {
                        String trescDo = ((JFormattedTextField)panel.getComponent(1)).getText();
                        System.out.println(trescDo);
                        String doKad = ((JFormattedTextField)panel.getComponent(1)).getText().replaceAll("[\\D]", "");
                        int doKadInt = Integer.parseInt(doKad);
                        SyberiadaOpcja nowaOpcja  = new SyberiadaOpcja(trescOpcji, doKadInt);
                        opcje.add(nowaOpcja);
                    }
                }
                zdarzenieDoZmiany.setListaOpcji(opcje);
               
                listaRozwijalna.removeAll();
                Collections.sort(listaZdarzen);
                for (int i = 0; i < listaZdarzen.size(); i++) {
                    SyberiadaZdarzenie zdarzenie = listaZdarzen.get(i);
                    listaRozwijalna.add(zdarzenie.getId() + "");
                }
                listaRozwijalna.select(selectedID);
                try {
                    XMLParser.getXMLParser().saveXML(listaZdarzen);
                } catch (ParserConfigurationException ex) {
                    Logger.getLogger(Frame.class.getName()).log(Level.SEVERE, null, ex);
                } catch (TransformerConfigurationException ex) {
View Full Code Here

TOP

Related Classes of java.awt.Choice$State

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.