File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Choosing the correct program structure: pl. do advice me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Choosing the correct program structure: pl. do advice me" Watch "Choosing the correct program structure: pl. do advice me" New topic

Choosing the correct program structure: pl. do advice me

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hello world,
I am hoping to write a stock controlling program. In that prorgam I want to to have these functions listed bellow. 1) Bill. (User can specify the quantity and the discount and add that entry to a bill.)
2) Inventory (User can add new items, update the item details and delete item details from the databse.)
3) Supplier (User can add new suppliers, update supplier details and delete supplier details.)
4) User (The administrator can add new users and delete. )
5) Reports (Various reports on the transactions, the items to be reordered etc.)
I am hoping to do the program in 'SWING'. The main window has a menubar and for each function I have mentioned above has seperate Menus. For example there is a 'User' menu which has 'Add User', 'Delete User' as menu items.
As you know,for example when adding a user, details are taken about the user such as the name etc.For this I need a GUI. The problem which I am having is do I need to create seperate classes which creates the GUI for each and every sub function ?.(example: adding a user)
So far what I have thought to have is, a main class for each of the main functions (for example supplier), and use the methods in that class to add, delete etc suppliers, and have different frames to get the GUIs in the main GUI. To make it more clearer this is the program structure what I have in mind.

public class abc {
public static void main(String arg[]) {
JFrame jFrame = new RMain();
class RMain {
* Declare Components for the main gui.
* Declare Components for the Adding of a new user.
* Declare Components for the Deleting of a user.
public RMain() {
class Supplier {
public Supplier() {
class User {
public User() {
program structure.

So is this structure ok?. or other wise do I have to have different classes for let's say 'AddSupplier' class which has the needed GUI components for adding a new Supplier. (I tried this but, I felt restricted when performing actions.)
Could you please advice me on this with your expertise knowledge.
Please if YOU know any online books for 'Good Programming or How to be a good programmer' please do tell me.

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)

Joined: Aug 16, 2003
Posts: 13
Dear u r going in a correct direction and working perfect try to lrn and read JDesktoppane, this might help u in adding, update and delete. do not make seperate class for each thing . ok now for programming go get Java Swing Book Deitel and Deitel both the green book and advance edition. programming can be learned from practice ... well practice practice make man perfect but no body ios perfect why do we need practice.

try to search some project related to u r project....

no GOD except ALLAH...
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Thanks you very much for the advice.
I agree. Here's the link:
subject: Choosing the correct program structure: pl. do advice me
Similar Threads
Beginning GUI programming exercise. Please help to figure out why it does not compile.
Program structure
EJP's @RolesAllowed({""})
Program Structure
Programming Structure.