Example usage for java.util Vector addElement

List of usage examples for java.util Vector addElement

Introduction

In this page you can find the example usage for java.util Vector addElement.

Prototype

public synchronized void addElement(E obj) 

Source Link

Document

Adds the specified component to the end of this vector, increasing its size by one.

Usage

From source file:FileUtil.java

public static Vector removeDuplicateDomains(Vector s) {
    int i = 0;//  w  ww  . jav  a 2s. c  o  m
    int j = 0;
    boolean duplicates = false;
    String str1 = "";
    String str2 = "";

    Vector v = new Vector();

    for (i = 0; i < s.size(); i++) {
        duplicates = false;
        for (j = (i + 1); j < s.size(); j++) {
            str1 = "";
            str2 = "";
            str1 = s.elementAt(i).toString().trim();
            str2 = s.elementAt(j).toString().trim();
            if (str1.indexOf('@') > -1) {
                str1 = str1.substring(str1.indexOf('@'));
            }
            if (str2.indexOf('@') > -1) {
                str2 = str2.substring(str2.indexOf('@'));
            }

            if (str1.equalsIgnoreCase(str2)) {
                duplicates = true;
            }

        }
        if (duplicates == false) {
            v.addElement(s.elementAt(i).toString().trim());
        }

    }

    return v;
}

From source file:Main.java

public Main() {
    Vector model = new Vector();
    model.addElement(new Item(new ImageIcon("copy16.gif"), "copy"));
    model.addElement(new Item(new ImageIcon("add16.gif"), "add"));
    model.addElement(new Item(new ImageIcon("about16.gif"), "about"));

    JComboBox comboBox;//w w w. j a  v  a 2 s  .c om

    comboBox = new JComboBox(model);
    comboBox.setRenderer(new ItemRenderer());
    getContentPane().add(comboBox, BorderLayout.SOUTH);
}

From source file:Main.java

public Main() {
    Vector model = new Vector();
    model.addElement(new Item(1, "A"));
    model.addElement(new Item(2, "B"));
    model.addElement(new Item(4, "C"));
    model.addElement(new Item(3, "D"));

    JComboBox comboBox = new JComboBox(model);
    comboBox.setRenderer(new ItemRenderer());
    comboBox.addActionListener(this);
    getContentPane().add(comboBox, BorderLayout.SOUTH);
}

From source file:Main.java

public Main() {
    Vector model = new Vector();
    model.addElement(new Item(1, "A"));
    model.addElement(new Item(2, "B"));
    model.addElement(new Item(3, "C"));
    model.addElement(new Item(4, "D"));

    JComboBox comboBox = new JComboBox(model);
    comboBox.addActionListener(this);
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    getContentPane().add(comboBox, BorderLayout.NORTH);

    comboBox = new JComboBox(model);
    comboBox.setRenderer(new ItemRenderer());
    comboBox.addActionListener(this);
    getContentPane().add(comboBox, BorderLayout.SOUTH);
}

From source file:AllAvailableFontsComboBox.java

public AllAvailableFontsComboBox() {
    add(new JLabel("Fonts"));

    GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String envfonts[] = gEnv.getAvailableFontFamilyNames();
    Vector vector = new Vector();
    for (int i = 1; i < envfonts.length; i++) {
        vector.addElement(envfonts[i]);
    }/*from  ww  w . ja v  a  2  s  .c om*/
    fonts = new JComboBox(vector);
    add(fonts);
}

From source file:com.iucosoft.eavertizare.gui.models.FirmaTableModel.java

public void refreshModel() {
    clearModel();/*from w  ww. j a v  a 2 s .c o  m*/
    List<Firma> listaFirme = firmaDao.findAll();
    List<Client> listaClienti;
    SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy");
    int nr = 1;

    //   rowAllClients();
    for (Firma firma : listaFirme) {

        Vector rowData = new Vector();
        rowData.addElement(nr++);
        rowData.addElement(firma.getNumeFirma());
        rowData.addElement(firma.getAdresaFirma());
        rowData.addElement(firma.getDescriereFirma());
        rowData.addElement(firma.getMesajPentruClienti());
        super.addRow(rowData);
    }
}

From source file:Main.java

public Main() {
    Object[] genealogy = { "A", "B", "C", "D", "E", "F" };
    java.util.Vector v = new java.util.Vector() {
        public String toString() {
            return "DD";
        }/* w w w. j av  a2  s  . c o m*/
    };
    v.addElement("1");
    v.addElement("2");
    v.addElement("3");
    v.addElement("4");
    genealogy[0] = v;
    JTree tree = new JTree(genealogy);
    tree.setRootVisible(true);
    JScrollPane jsp = new JScrollPane(tree);
    getContentPane().add(jsp);
}

From source file:SimpleTreeTest.java

public SimpleTreeTest() {
    Object[] genealogy = { "A", "B", "C", "D", "E", "F" };
    java.util.Vector v = new java.util.Vector() {
        public String toString() {
            return "DD";
        }//w w  w  .  ja v a 2  s . c o m
    };
    v.addElement("1");
    v.addElement("2");
    v.addElement("3");
    v.addElement("4");
    genealogy[0] = v;
    JTree tree = new JTree(genealogy);
    tree.setRootVisible(true);
    JScrollPane jsp = new JScrollPane(tree);
    getContentPane().add(jsp);
}

From source file:Main.java

public Main() {
    JTextField textField = new JTextField("A TextField");
    textField.addFocusListener(this);
    JLabel label = new JLabel("A Label");
    label.addFocusListener(this);
    add(label);/*from   www. ja  v  a2 s .c  o  m*/

    String comboPrefix = "Item #";
    final int numItems = 15;
    Vector vector = new Vector(numItems);
    for (int i = 0; i < numItems; i++) {
        vector.addElement(comboPrefix + i);
    }
    JComboBox comboBox = new JComboBox(vector);
    comboBox.addFocusListener(this);
    add(comboBox);

    JButton button = new JButton("A Button");
    button.addFocusListener(this);
    add(button);

    JList list = new JList(vector);
    list.setSelectedIndex(1);
    list.addFocusListener(this);
    JScrollPane listScrollPane = new JScrollPane(list);

    listScrollPane.getVerticalScrollBar().setFocusable(false);
    listScrollPane.getHorizontalScrollBar().setFocusable(false);
    add(listScrollPane);

    setPreferredSize(new Dimension(450, 450));
}

From source file:Main.java

public Main() {
    JTextField textField = new JTextField("A TextField");
    textField.addFocusListener(this);
    JLabel label = new JLabel("A Label");
    label.addFocusListener(this);
    add(label);//from  w w  w. jav  a  2 s .  co m

    String comboPrefix = "ComboBox Item #";
    final int numItems = 15;
    Vector vector = new Vector(numItems);
    for (int i = 0; i < numItems; i++) {
        vector.addElement(comboPrefix + i);
    }
    JComboBox comboBox = new JComboBox(vector);
    comboBox.addFocusListener(this);
    add(comboBox);

    JButton button = new JButton("A Button");
    button.addFocusListener(this);
    add(button);

    String listPrefix = "List Item #";
    Vector listVector = new Vector(numItems);
    for (int i = 0; i < numItems; i++) {
        listVector.addElement(listPrefix + i);
    }
    JList list = new JList(listVector);
    list.setSelectedIndex(1);
    list.addFocusListener(this);
    JScrollPane listScrollPane = new JScrollPane(list);

    listScrollPane.getVerticalScrollBar().setFocusable(false);
    listScrollPane.getHorizontalScrollBar().setFocusable(false);
    add(listScrollPane);

    setPreferredSize(new Dimension(450, 450));
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}