Question:
Java Project Using GUI?
Ahmad B
2009-08-05 12:44:45 UTC
I have to create a program that using GUI creates a JFrame within which i can enter information of a book, save it and then be able to go back to it later. The buttons i am required to have are an Add, Delete, Last, previous annd next. The information that i have to create/input for the book are the books name, a code and a price. any help appreciated
Three answers:
Ben
2009-08-05 12:53:53 UTC
To make the GUI, look in javax.swing. That's where you'll find JFrames and JButtons. Add java.awt.event.ActionListeners (you'll have to make classes that implement it) to your buttons. An ActionListener must have a method with the signature "public void actionPerformed(java.awt.event.ActionEvent e)". Use the addActionListener method on your buttons to move back and forth. You'll want to use either a java.util.LinkedList or a java.util.ArrayList to store the list of books. Which one you want depends on how you store the current selection. Create a Book class with all of the items you need.



For more, check the documentation for those classes. I put the link to the API in the sources list.
mill
2016-10-13 04:49:23 UTC
the front end needs to be consumer friendly. think of in terms of types that human beings fill out, or grids the place they are in a position to view the counsel. think of in terms of an AED: upload-Edit-Delete metaphor. present counsel in a manner that human beings can upload, Edit or Delete issues. And, yeah, no way persons are going to "lines of code" to try this. you ought to jot down the code, your end purchasers do no longer understand squat approximately code. they simply opt to fill in notably bins on a notably form (which you will in all probability hate coding... ;-)
alpha_centauri_75
2009-08-05 12:51:27 UTC
Check out MVC (the pattern)

JButton

button.addActionLister(...)

ActionListener

That'll get you started.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...