Retrieve object from a Java Swing component
By : malk kjp
Date : March 29 2020, 07:55 AM
To fix the issue you can do I figured out all I needed to do was store new tab objects in an ArrayList derp. for your attempts though guys!
|
how to take an input of date using java swing text box and store in mysql database?
By : Ajay
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , What I Want to Do ? , (As discussed in comments...) You have two problems: code :
catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (ParseException e) {
throw new DataValidationException(
"Error parsing date: " + textField_5.getText(), e);
}
|
Where does Java copy and store objects when .add'ing them to a Swing component?
By : NicoleHepburn
Date : March 29 2020, 07:55 AM
Any of those help A JPanel inherits from java.awt.Container, which maintains an internal list of client components (your JButtons in this case). You can find this list in the source code of Container: code :
/**
* The components in this container.
* @see #add
* @see #getComponents
*/
private java.util.List<Component> component = new java.util.ArrayList<Component>();
|
How to retrieve radiogroup data from database in JAVA? M Using Java Swing & SQLite
By : user2285710
Date : March 29 2020, 07:55 AM
it fixes the issue If you are doing a string compare, should you be using the following; code :
db_gender.equals("Male")
|
Store database into an array using java swing
By : A. Roy
Date : March 29 2020, 07:55 AM
should help you out Here is a simple way if you want to pass the First and Last Name of the logged on user to the MainWindow. First, modify your query to get Last and First name when you verify if user exists in your database : code :
String sql = "select FName, LName from tblCustomer where username = '" +username+"'and password = '"+password+"'" ;
rs = st.executeQuery(sql);
int count = 0;
String lastName ='';
String firstName = '';
while(rs.next())
{
count ++;
//get last name and first name when connected
lastName = rs.getString("LName");
firstName = rs.getString("FName");
}
if(count == 1)
{
setVisible(false);
new MainWindow( firstName+" "+lastName);//<--pass it here to the mainWindow
}
public class MainWindow extends JFrame {
private String whosLoggedOn;
MainWindow(String whosLoggedOn) {
this.whosLoggedOn = whosLoggedOn;
//------ other stuff--------
//Create text based label
JLabel lblMessage = new JLabel(this.whosLoggedOnis+ " is currently logged on.");
//------ other stuff--------
}
}
public class MainWindow extends JFrame {
MainWindow(ResultSet tblCustomer, ResultSet tblAccount ) {
//use them as you want here
//for example to get last and first name :
String lastName = tblCustomer.getString("LName");
String firstName = tblCustomer.getString("FName");
//Create text based label
JLabel lblMessage = new JLabel(lastName +" "+ firstName" is currently logged on.");
//------ other stuff--------
}
}
|