This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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: 44545
    
  34
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: 44545
    
  34
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
 
It's not a secret anymore!