message/dialog box
Is it true that message/dialog boxes in java can only be associated with a frame window?
basically trying to catch an SQLException from a database, and when it does I want a little pop up window coming up to say Invalid Data Entry or something...
is not not possible to do this in one line of code? thanks
yeah, sorry about that...being an absolute idiot! lets put it down to lack of sleep! in the mean time then - how about this...
trying to get a vector to list me some project names by a combo box. they are called from a sql server database! this is my attempt - really cant see the problem though - any ideas?
Vector projNames = inProjectList.getProjectList();
projNames.addElement("All");
projName = new JComboBox();
projName.setSelectedItem("All");
projName.setBounds(400, 175, 150, 25);
projName.addActionListener(this);
projName.setBorder(paneltitled);
project_panel.add(projName);
public Vector getProjectList()throws SQLException{
Vector projName = new Vector();
Statement stmt5 = con.createStatement();
ResultSet rs5 = stmt5.executeQuery("select Project_Name from BMS_Project");
while(rs5.next()){
projName.add(rs5.getString("Project_Name"));
}
stmt5.close();
return projName;
}
the second set of code is in a class called ProjectList...the first is on my form where the combo box is...i use netbeans and it highlights the top line of the first set of instructions and says...
cannot find symbol
symbol : class Vector
location @ class Menu
any suggestions would be great, thanks
Well if you must use Vector you'll need to import it with this code at the top of your "Menu" class.import java.util.Vector;
But these days you'd be better to use ArrayList which has largely replaced Vector in Java coding (except where thread synchronization is required).
It was just some old stuff I was re-visiting and trying to get to work elsewhere...Imported as said, realised and action listener was needed to...The program compiles and runs but when clicking the combo box it drops down, but is empty...This is my action listener code but cant make out what is wrong?
else if (source == projName){
String sSelectedProject = (String)projName.getSelectedItem();
if (sSelectedProject.equals("All")){
currentProject = inProjectList.getFirstProject();
setProjectTextFields();
}
else{
currentProject = inProjectList.findProject(sSelectedProject);
setProjectTextFields();
}
}