List of usage examples for java.util Vector Vector
public Vector()
From source file:Main.java
/** Returns an alphabetically sorted list of the keys. */ public static Vector getSortedKeyList(Hashtable hashtable) { Vector result = new Vector(); Enumeration keys = hashtable.keys(); while (keys.hasMoreElements()) { result.add(keys.nextElement());//from w w w. j a v a 2s. c om } Collections.sort(result, new Comparator() { public int compare(Object a, Object b) { String textA = a.toString(); String textB = b.toString(); return textA.compareToIgnoreCase(textB); } }); return result; }
From source file:Main.java
Main(String title) { super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel jp = new JPanel(); Vector v = new Vector(); v.add("A");/* w w w. j a va 2 s .c o m*/ v.add("B"); v.add("C"); jcb = new JComboBox(v); jcb.setEditable(true); jcb.getActionMap().put("selectNext", new DownAction()); jp.setPreferredSize(new Dimension(200, 35)); jp.add(jcb); getContentPane().add(jp); pack(); setVisible(true); }
From source file:MainClass.java
MainClass(String title) { super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel jp = new JPanel(); Vector v = new Vector(); v.add("A");//from w w w .ja v a2s . c o m v.add("B"); v.add("C"); jcb = new JComboBox(v); jcb.setEditable(true); jcb.getActionMap().put("selectNext", new DownAction()); jp.setPreferredSize(new Dimension(200, 35)); jp.add(jcb); getContentPane().add(jp); pack(); setVisible(true); }
From source file:com.github.tncardoso.kloutapi.KloutParser.java
/** * Parse klout json response.// w w w. j av a 2s . c om * * @param json * content of the klout response * @return list containing klout score pairs * @throws JSONException * @throws KloutException */ public static List<KloutScorePair> klout(String json) throws JSONException, KloutException { JSONObject respJson = new JSONObject(json); int status = respJson.getInt("status"); if (status != 200) { throw new KloutException("Status error: " + status); } List<KloutScorePair> ret = new Vector<KloutScorePair>(); JSONArray usersScore = respJson.getJSONArray("users"); for (int i = 0; i < usersScore.length(); i++) { JSONObject cUser = usersScore.getJSONObject(i); KloutScorePair ksp = new KloutScorePair(cUser.getString("twitter_screen_name"), cUser.getDouble("kscore")); ret.add(ksp); } return ret; }
From source file:ComplexCompany.java
public ComplexCompany(String name) { this.name = name; departments = new Vector(); }
From source file:MainClass.java
MainClass(String title) { super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel jp = new JPanel(); Vector v = new Vector(); v.add("A");//from ww w . j av a 2 s. c o m v.add("B"); v.add("C"); jcb = new JComboBox(v); jcb.setEditable(true); KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, Event.CTRL_MASK); jcb.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, "clearEditor"); jcb.getActionMap().put("clearEditor", new ClearEditorAction()); jp.setPreferredSize(new Dimension(200, 35)); jp.add(jcb); getContentPane().add(jp); pack(); setVisible(true); }
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 w ww . ja va 2 s .c om } fonts = new JComboBox(vector); add(fonts); }
From source file:Main.java
public static Vector createVector(Enumeration e) { Vector result = new Vector(); while (e.hasMoreElements()) result.addElement(e.nextElement()); return result; }
From source file:Main.java
static public Element[] findChildElements(Node first, Node last, String name) { Vector v = new Vector(); while (first != last) { if (first.getNodeType() == Node.ELEMENT_NODE) { if (first.getNodeName().equals(name)) v.addElement(first);//w ww . ja v a 2s . com } first = first.getNextSibling(); } Element array[] = new Element[v.size()]; for (int i = 0; i < array.length; ++i) { array[i] = (Element) v.elementAt(i); } return array; }
From source file:de.fabianonline.telegram_backup.Utils.java
static Vector<String> getAccounts() { Vector<String> accounts = new Vector<String>(); File folder = new File(Config.FILE_BASE); File[] files = folder.listFiles(); if (files != null) for (File f : files) { if (f.isDirectory() && f.getName().startsWith("+")) { accounts.add(f.getName()); }/*from ww w . j a v a 2 s .c om*/ } return accounts; }