• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding a new row automatically with jTable(maybe?) (WindowBuilder)

 
Derek Welton
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started to learn java and right now I'm working on my final project for the course I'm taking. I decided to make a standalone Budget program. We are required to use window builder in eclipse.

Anyways, its a simple program, main page displays some info, then there is a tab for adding a new transaction(date, category, item, type, amount) with a button that will add that info as a transaction. The last tab will display all the transactions in a list or table(will be hoping to find a way so the user can sort the info as well by column) The display would be something like.... (the ---------- represents a row of info)

Date Category item type amount
-----------------------------------


So when the user adds a transaction, I want it to add a new row to display that info in the GUI. Its very simple display that I want, I just don't know if I should use jTable or another way so that the user can't edit the info when they are viewing all the transaction history, but they can delete it. Any help would be very appreciated!
 
Paul Clapham
Sheriff
Posts: 21588
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Derek, welcome to the Ranch!

You keep using the word "simple" but bear in mind that just because you have a simple problem statement, it doesn't follow that there's a simple solution.

Anyway yes, a JTable would be a good choice for displaying rows of information. However JTable is probably the most complex of the Swing components. I think you're going to need a customized table model so that you can add rows (transactions) to your table; at any rate you should start by going through the JTable tutorial. Here's a link to it: http://docs.oracle.com/javase/tutorial/uiswing/components/table.html

As for WindowBuilder -- I don't know anything about that. However in this case the fact that you have a simple GUI to build probably does translate into a simple process to build it. It's the logic behind the table which is going to be the hard part. Good luck!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic