List of usage examples for java.util Vector Vector
public Vector()
From source file:Main.java
public static Vector<HashMap> xmlToVector222(InputStream is, String xpath) { try {//from w w w.j a v a 2 s. c om XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); InputSource inputSource = new InputSource(is); NodeList nodes = (NodeList) xPath.evaluate(xpath, inputSource, XPathConstants.NODESET); Vector<HashMap> vector = new Vector<HashMap>(); for (int x = 0; x < nodes.getLength(); x++) { NodeList nodeList = nodes.item(x).getChildNodes(); HashMap hashmap = new HashMap(); for (int y = 0; y < nodeList.getLength(); y++) { Node node = nodeList.item(y); if (!node.getNodeName().equals("#text")) { hashmap.put(node.getNodeName(), node.getTextContent()); } } vector.add(hashmap); } return vector; } catch (Exception ex) { ex.printStackTrace(); return new Vector(); } }
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;// www . j a va 2s. co m comboBox = new JComboBox(model); comboBox.setRenderer(new ItemRenderer()); getContentPane().add(comboBox, BorderLayout.SOUTH); }
From source file:Main.java
/** * param String Documento XML del que queremos obtener la lista de etiquetas * @return Lista de <code>String</code> con todos los nombre de las etiquetas que tiene el documento. * Devuelve una lista vací en elcaso de que el documento no tuviera etiquetas. Si tuviera etiquetas repetidas, * solo devuelve el nombre de la etiqueta una vez. *//*from w ww.j av a 2 s. c om*/ public static List dameListaDeEtiquetas(String documento) { List listaEtiquetas = new Vector(); int posEtiqueta = documento.indexOf('<', 1); while (posEtiqueta != -1) { int finEtiqueta = documento.indexOf('>', posEtiqueta + 1); String etiqueta = documento.substring(posEtiqueta + 1, finEtiqueta); if (!listaEtiquetas.contains(etiqueta) && (etiqueta.indexOf('/') == -1)) listaEtiquetas.add(etiqueta); posEtiqueta = documento.indexOf('<', finEtiqueta); } return listaEtiquetas; }
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 static synchronized Element[] getChildElements(Element element) { if (element == null) { return null; }/*from w w w .jav a 2 s . co m*/ Vector childs = new Vector(); for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) { if (node instanceof Element) { childs.add((Element) node); } } Element[] elmt = new Element[childs.size()]; childs.toArray(elmt); return elmt; }
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:MainClass.java
MainClass() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Vector v = new Vector(); v.add("First item"); v.add("Second item"); v.add("Third item"); v.add("Fourth item"); JPanel p = new JPanel(); p.setPreferredSize(new Dimension(200, 100)); JList jl = new JList(v); jl.setPreferredSize(new Dimension(100, 75)); p.add(new JScrollPane(jl)); getContentPane().add(p);//from w w w . j a v a 2 s.c o m pack(); setVisible(true); }
From source file:Main.java
public static Vector getSignaturesForFile(File originalFile) { File sigDir = getSignatureDirectoryForFile(originalFile); File[] filesAvailable = sigDir.listFiles(); Vector signatureFiles = new Vector(); if (filesAvailable != null) { for (int i = 0; i < filesAvailable.length; i++) { File file = filesAvailable[i]; if (isMatchingSigFile(originalFile, file)) { signatureFiles.add(file); }/*from w w w .j a va 2s. c o m*/ } } return signatureFiles; }
From source file:maltcms.ui.fileHandles.properties.tools.ModelBuilder.java
public static WidgetTableModel getModel(Configuration properties, Object bean) { Vector<String> header = new Vector<>(); header.add("Key"); header.add("Value"); Logger.getLogger(ModelBuilder.class.getName()).log(Level.INFO, "properties: {0}", properties); return new WidgetTableModel(header, PropertyLoader.asHash(properties), bean); }
From source file:Main.java
public static Vector createVector(Object[] array) { return appendInto(new Vector(), array); }