jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases 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 Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 151
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: 43377
    
  32
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: 151
Thank you. I got it

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43377
    
  32
Well done Please explain the solution, in case anybody else has a similar problem in the future.
 
 
subject: using database connection in jframes
 
jQuery in Action, 3rd edition