Suppose I have some data in a data base and I am retrieving that using query.
Example:
SELECT * FROM acsuserdetail where "+useranme+"= '"+arg+"' "
System.out.print(" FirstName = " + rs.getString("FirstName"));
This will return two result i.e.:
FirstName = Anurag
FirstName = Arvind
But when I am showing this data in UI in a JFrame
then it is opening two frames having two details and if more details are there then that number of frame will open. This may be because the data which is coming from database are coming one by one not in single shot. I want all information to consolidate in a single frame. Code for UI is:-
public UIForShowingData(String data) {
frame = new JFrame("Showing Data");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setVisible(true);
frame.setSize(300, 300);
button = new JButton("OK");
frame.setLayout(null);
button.setBounds(250, 250, 40, 50);
frame.add(button);
System.out.println(data.length());
tx = new JTextField(data);
frame.add(tx);
tx.setBounds(50, 50, 40, 50);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
frame.dispose();
}
});
}