0
    try{   
    String str = "select * from stocks";
    stmt = conn.prepareStatement(str);
    ResultSet rs = stmt.executeQuery();

    while(rs.next())     
        jcbStock.addItem(rs.getString("stockID"));        
                }catch(Exception e){
                e.printStackTrace();           
        }

I have this code in other class , and i want call it in my main class. Anyone can tell me how to do?

3
Contributors
4
Replies
18
Views
3 Years
Discussion Span
Last Post by stultuske
0
    public combobox(){ 
        JComboBox jcb = new JComboBox();
        try{   
    String str = "select * from stocks";
    stmt = conn.prepareStatement(str);
    ResultSet rs = stmt.executeQuery();

    while(rs.next())     
        jcb.addItem(rs.getString("stockID"));        
                }catch(Exception e){
                e.printStackTrace();           
                }
    }

Is it look like this?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.