Results 1 to 4 of 4
Thread: Help me
- 08-04-2011, 07:52 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 7
- Rep Power
- 0
Help me
i get username from database to combobox.now combobox shows username.i need to select one item in combobox and need to code for that....here i am type one message and select one item from combobox and send message to selected item that in combobox.....so plz suggests me as u as possible.....thank uuuuu......
- 08-04-2011, 08:54 AM #2
What's a combobox? There's no class by that name in the standard JDK.
Recommended reading: Write Well (edit: and the rest of that page).....so plz suggests me as u as possible.....thank uuuuu.....
db
- 08-04-2011, 03:27 PM #3
Member
- Join Date
- Jul 2011
- Posts
- 7
- Rep Power
- 0
combobox is not a class....that is one swing component.here i used in netbean.you can see the combobox in palette.....that palette in netbeans6.9
- 08-07-2011, 08:36 AM #4
Member
- Join Date
- Aug 2011
- Posts
- 7
- Rep Power
- 0
Java Code:try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Master","sa",""); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select *from UsernameTable"); while(rs.next()) { String p=rs.getString(1); System.out.println(p); jComboBox1.addItem(p); } } catch (Exception e) { e.printStackTrace(); }
Java Code:private void jComboBox1_actionPerformed(ActionEvent e) { System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called."); Object o = jComboBox1.getSelectedItem(); x=(String)o; System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected."); }


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks