Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using database connection in jframes

 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48453
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. I got it

 
Campbell Ritchie
Sheriff
Posts: 48453
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done Please explain the solution, in case anybody else has a similar problem in the future.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic