This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes using database connection in jframes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "using database connection in jframes" Watch "using database connection in jframes" New topic
Author

using database connection in jframes

Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
Hi all,

I created a simple UI that takes 2 inputs


and my main is



is their any way by which the jTextField value be used in main..

Thank you in advance


Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
You don't want to use the text field in your main method. You ought to be creating an arithmetic class, which takes the values from the text fields, and does the calculations. That is the "M" part of MVC. The frame and text boxes which display the numbers are the "V" part and the buttons the "C" part.
Obviously your data in the database also form part of the "M". But you appear to be running the two independently of each other. Why?
Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
Thank you. I got it

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
Well done Please explain the solution, in case anybody else has a similar problem in the future.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using database connection in jframes
 
Similar Threads
How do I go about making my own Yahoo Messenger?
how to show database table with webservice?
The method showMessageDialog(Component, Object) in the type JOptionPane is not applic
socket not accepting data 2nd time
how to retrive database table data with webService?