This week's giveaway is in the Beginning Java forum.
We're giving away four copies of Bad Programming Practices 101 (e-book) and have Karl Beecher on-line!
See this thread for details.
Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JAVA Swing GUI Invoice - problem with correct actionPerformed  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
I am trying to prepare a window program GUI to display invoices from the system add a new invoice (and add invoice items as part of the new invoice), modify the unclosed invoice and view the details of the invoice.
The program should be written in Swing without the use of window editors. (only code). I have problem with buttons to adds new invoice with some positions.

my concept


classes:

public class TestInvoice
https://pastebin.com/gn4MMBuH


public class Invoice
https://pastebin.com/kyZqesQ0


public class InvoiceManager
https://pastebin.com/zLHhxdwr


public class Contractor
https://pastebin.com/f59zzBkk


 
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have problem with buttons to adds new invoice with some positions.

Can you elaborate ?
 
John Joe
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cross-post :  GUI invoice problem
 
Marshal
Posts: 59411
187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome ot the Ranch

Please always tell people on all thee fora involved whenever posting the same question on multiple fora, so as to prevent duplication of effort. Also please give us the full details because many people won't go to PasteBin.
What does your invoice class do? Does it have a public interface that the GUI can access?
 
Rancher
Posts: 506
15
Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have problem with buttons to adds new invoice with some positions.



TestInvoice.java:

Replace:
JList<Invoice> list = new JList<Invoice>();
With:
final JList<Invoice> list2 = new JList<>(new DefaultListModel<Invoice>());

And, add some code to the "save" button's action listener:



Also, I couldn't get your code to compile without changing the import java.awt.List to import java.util.List.

Try this and tell us how this worked.
 
Campbell Ritchie
Marshal
Posts: 59411
187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Prasad Saya wrote:. . . I couldn't get your code to compile without changing the import java.awt.List to import java.util.List. . . .

That's Eclipse. You write List in the code, push ctrl‑space and choose the top option from the dropdown box, and get the wrong List class
 
Prasad Saya
Rancher
Posts: 506
15
Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

Prasad Saya wrote:. . . I couldn't get your code to compile without changing the import java.awt.List to import java.util.List. . . .

That's Eclipse. You write List in the code, push ctrl‑space and choose the top option from the dropdown box, and get the wrong List class



I wasn't using an IDE; just a programming text editor and working from the command prompt.
 
Hang a left on main. Then read this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!