Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- ps1 = povezava.prepareStatement("SELECT * FROM mydb.Drzava");
- ResultSet rs = ps1.executeQuery();
- while (rs.next()) {
- String imeDrzave = rs.getString("Kratica");
- int a = IsciDrzava1.getItemCount();
- int stevec = 0;
- for (int i = 0; i < a; i++) {
- IsciDrzava1.setSelectedIndex(i);
- if (imeDrzave.equals(IsciDrzava1.getSelectedItem().toString()))
- stevec++;
- }
- if (stevec == 0)
- IsciDrzava1.addItem(imeDrzave);
- }
- IsciDrzava1.setSelectedIndex(0);
- if (!IsciDrzava1.getItemAt(1).equals("SLO")) IsciDrzava1.removeItemAt(1);
- }
- catch (Exception e) {
- System.err.println(e);
- Status1.setText("Ni držav.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement