• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

JAVA Swing GUI Invoice - problem with correct actionPerformed

 
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: 66175
250
  • 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: 507
15
Notepad Java
  • 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: 66175
250
  • 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: 507
15
Notepad Java
  • 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.
 
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!