Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Displaying database result, In Java!

views
     
TSfelixwhoals
post Feb 2 2006, 12:50 AM, updated 20y ago

Casual
***
Junior Member
455 posts

Joined: Oct 2005
From: Birmingham, UK


Hey guys, this is pretty simple:

rs = stmt.executeQuery("SELECT * FROM Customers") ;
printResultSet(System.out, rs) ;
rs.close() ;

When I put this, my java program display all it all on the screen (command line)
I'm not sure how to put them into GUI but is there anyway I could use message box to display that result?

I tried to do JOptionPane.showMessageDialog(null, rs); but i can't display the results.. any ideas?

TSfelixwhoals
post Feb 2 2006, 07:57 AM

Casual
***
Junior Member
455 posts

Joined: Oct 2005
From: Birmingham, UK


I'm just a beginner in this GUI stuff... If anyone suggesting me to use GUIs.. how shall I put it in there? Any source code that I can copy? I've searched from google and yahoo but I just can't think of how to put that 'rs' into the GUI itself.. can someone help me? I have used this Jframe:

WindowUtilities.setNativeLookAndFeel();
JFrame f = new JFrame("This is a test");
f.setSize(400, 150);
Container content = f.getContentPane();
content.setBackground(Color.white);
content.setLayout(new FlowLayout());
content.add(new JButton("Button 1"));
f.addWindowListener(new ExitListener());
f.setVisible(true);

This adds Button to it, is there anyway I could add that rs into it?

 

Change to:
| Lo-Fi Version
0.0190sec    1.26    6 queries    GZIP Disabled
Time is now: 23rd December 2025 - 10:36 PM