DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   homework(easy): Java GUI/Netbeans using java.util.LinkedList (http://www.daniweb.com/forums/thread73258.html)

collegestuffs Mar 24th, 2007 1:27 pm
homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
Hello i have an important homework assignment which is due up on mon 26th and i need a competent java programmer with netbeans expirence. Problem is as follows:

It's a small project and i have basically designed all the forms and buttons needed etc. Now i need someone to link my buttons to classes that use the java.util.LinkedList / Iratator / Serializable functions to just store basic infomations from text fields into a linked list and then into a user specified text file, where i can then search, add, delete etc ..

Its worth about 10% of my final grade, and due on monday so contact me asap ill pay 200$

collegestuffs@safe-mail.net

iamthwee Mar 24th, 2007 1:29 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
Why don't you post your project here for us to look at?

Phaelax Mar 24th, 2007 1:30 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
Quit. Just quit now.

collegestuffs Mar 24th, 2007 2:19 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
I am familar with creating this type of application without a GUI builder.. homework spec doesnt insist on a GUI builder, but i feel netbeans adds more functionalitys quicker and im sure id get higher grades .

As the netbeans generated code can be quite long i put the netbeans generated code onto this paste bin: http://rafb.net/p/ho7SKr98.html

iamthwee Mar 24th, 2007 2:22 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
Ok so what's the actual problem? You don't know how to use netbeans?

collegestuffs Mar 24th, 2007 2:33 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
well this is the first time i have attempted to make a gui with so many menus and a login system with netbeans, and also i am unlear on how to use the:

java.Util.LinkedList for the linked list as i have only used my own code to initate the nodes etc, why re-invent the wheel? :)

and a way to save the list using
serializable (?) or bufferered reader

and then doing searches on it for specific records, maybe implement a grep util i have code for,

all the time i just really need like 10 JTextFields and 6 buttons working it....

iamthwee Mar 24th, 2007 2:49 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
Ok so you've never used a GUI builder and your project is due monday. Oh dear.

Good luck though!

collegestuffs Mar 24th, 2007 3:03 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
well i can maybe forget the gui builder and use the classes outside it, but how would i create nodes using the new java.util.LinkedList and present them in a form to save to a text file and manipulate them ?

collegestuffs Mar 24th, 2007 9:17 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
i managed to knock up a GUI with GUIGenie and it compiles fine in JCreator. now i need someone to help me implement the java.Util.LinkedList and other classes so i can save/read/delete from the linked list !
code is as below:

///Generated by GuiGenie - Copyright (c) 2004 Mario Awad.
//Home Page http://guigenie.cjb.net - Check often for new versions!
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class stockControlSystem extends JFrame implements ActionListener, WindowListener {
 
    private JLabel productIdLabel;
    private JTextField productIDField;
    private JLabel productTypeLabel;
    private JTextField productTypeField;
    private JTextField productPriceField;
    private JLabel productPriceLabel;
    private JLabel quantityInStockLabel;
    private JTextField qInStockField;
    private JLabel reOrderLabel;
    private JTextField reOrderField;
    private JLabel reOrderQLabel;
    private JTextField reOrderQField;
    private JTextField costPriceField;
    private JButton firstRecordButton;
    private JButton addRecordButton;
    private JButton searchButton;
    private JButton nextButton;
    private JButton clearButton;
    private JButton lastRecordButton;
    private JButton previousRecordButton;
    private JButton deleteRecordButton;
    private JLabel costLabel;
    private JTextField supplierIdField;
    private JLabel jcomp27;
    private JLabel supplierIdLabel;
    private JLabel menuTitleLabel;
    //private JLabel jcomp29;
 
    private FileOutputStream fos;
 private PrintWriter out;
 
    public stockControlSystem(String str) throws IOException{
 
 
    super(str);
    fos = new FileOutputStream("AccountFile.txt", true);
    out = new PrintWriter(new OutputStreamWriter(fos));
 
        //construct components
        productIdLabel = new JLabel ("Product ID:");
        productIDField = new JTextField (5);
        productTypeLabel = new JLabel ("Product Type:");
        productTypeField = new JTextField (5);
        productPriceField = new JTextField (5);
        productPriceLabel = new JLabel ("Product Price:");
        quantityInStockLabel = new JLabel ("Quantity In Stock:");
        qInStockField = new JTextField (5);
        reOrderLabel = new JLabel ("Re- Order Level:");
        reOrderField = new JTextField (5);
        reOrderQLabel = new JLabel ("Re- Order Quantity:");
        reOrderQField = new JTextField (5);
        costPriceField = new JTextField (5);
        firstRecordButton = new JButton ("First Record");
        addRecordButton = new JButton ("Add Record");
        searchButton = new JButton ("Search Record");
        nextButton = new JButton ("Next Record");
        clearButton = new JButton ("Clear");
        lastRecordButton = new JButton ("Last Record");
        previousRecordButton = new JButton ("Previous Record");
        deleteRecordButton = new JButton ("Delete Record");
        costLabel = new JLabel ("Cost Price:");
        supplierIdField = new JTextField (5);
        jcomp27 = new JLabel ("newLabel");
        supplierIdLabel = new JLabel ("Supplier ID:");
        menuTitleLabel = new JLabel (" ");
 
 
        setSize(448,519);
        //add components
        add (productIdLabel);
        add (productIDField);
        add (productTypeLabel);
        add (productTypeField);
        add (productPriceField);
        add (productPriceLabel);
        add (quantityInStockLabel);
        add (qInStockField);
        add (reOrderLabel);
        add (reOrderField);
        add (reOrderQLabel);
        add (reOrderQField);
        add (costPriceField);
        add (firstRecordButton);
        add (addRecordButton);
        add (searchButton);
        add (nextButton);
        add (clearButton);
        add (lastRecordButton);
        add (previousRecordButton);
        add (deleteRecordButton);
        add (costLabel);
        add (supplierIdField);
        add (jcomp27);
        add (supplierIdLabel);
        add (menuTitleLabel);
        //set component bounds (only needed by Absolute Positioning)
        productIdLabel.setBounds (30, 75, 100, 25);
        productIDField.setBounds (160, 75, 155, 25);
        productTypeLabel.setBounds (30, 110, 100, 25);
        productTypeField.setBounds (160, 105, 155, 30);
        productPriceField.setBounds (160, 140, 155, 25);
        productPriceLabel.setBounds (35, 140, 100, 25);
        quantityInStockLabel.setBounds (30, 180, 100, 25);
        qInStockField.setBounds (160, 180, 155, 25);
        reOrderLabel.setBounds (30, 220, 100, 25);
        reOrderField.setBounds (160, 220, 155, 25);
        reOrderQLabel.setBounds (25, 250, 120, 35);
        reOrderQField.setBounds (160, 255, 155, 25);
        costPriceField.setBounds (160, 290, 155, 25);
        firstRecordButton.setBounds (15, 370, 115, 50);
        addRecordButton.setBounds (135, 405, 160, 30);
        searchButton.setBounds (135, 440, 160, 30);
        nextButton.setBounds (305, 425, 135, 45);
        clearButton.setBounds (330, 75, 100, 25);
        lastRecordButton.setBounds (15, 425, 115, 45);
        previousRecordButton.setBounds (305, 370, 135, 50);
        deleteRecordButton.setBounds (135, 370, 160, 30);
        costLabel.setBounds (25, 285, 100, 25);
        supplierIdField.setBounds (160, 325, 155, 25);
        jcomp27.setBounds (610, 175, 120, 25);
        supplierIdLabel.setBounds (25, 320, 100, 25);
        menuTitleLabel.setBounds (35, 10, 10, 35);
 
 
 
        nextButton.addActionListener(this);
    clearButton.addActionListener(this);
  previousRecordButton.addActionListener(this);
  addRecordButton.addActionListener(this);
  deleteRecordButton.addActionListener(this);
  searchButton.addActionListener(this);
  lastRecordButton.addActionListener(this);
  firstRecordButton.addActionListener(this);
 
 
    //set window listener listening
 
  this.addWindowListener(this);
 
 
  setVisible(true);
 
    }
 
 
    public void windowActivated(WindowEvent e) {}
 public void windowClosed(WindowEvent e){}
 public void windowClosing(WindowEvent e) {System.exit(0);}
 public void windowDeactivated(WindowEvent e) {}
 public void windowDeiconified(WindowEvent e) {}
 public void windowIconified(WindowEvent e) {}
 public void windowOpened(WindowEvent e) {}
 
 
 
 public void actionPerformed(ActionEvent e)
    {
    Object target = e.getSource();
 
 
    if (target == addRecordButton)
    {
      String s1 = productIDField.getText();
 
      s1.trim();
      out.println(s1);
      productIDField.setText("");
    }
 
    if (target == firstRecordButton)
    {
      productIDField.setText("");
    }
    }
 
 
    public static void main (String[] args) throws IOException{
 
        stockControlSystem F1 = new stockControlSystem("Stock Control Menu");
    }
}

collegestuffs Mar 24th, 2007 11:59 pm
Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList
 
i have continued with the code above and have tried to implement the linked list re-inventing the wheel ... any ideas guys to make the list work and print into the textfields?

///Generated by GuiGenie - Copyright (c) 2004 Mario Awad.
//Home Page http://guigenie.cjb.net - Check often for new versions!
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class stockControlSystem extends JFrame implements ActionListener, WindowListener {

    private JLabel productIdLabel;
    private JTextField productIDField;
    private JLabel productTypeLabel;
    private JTextField productTypeField;
    private JTextField productPriceField;
    private JLabel productPriceLabel;
    private JLabel quantityInStockLabel;
    private JTextField qInStockField;
    private JLabel reOrderLabel;
    private JTextField reOrderField;
    private JLabel reOrderQLabel;
    private JTextField reOrderQField;
    private JTextField costPriceField;
    private JButton firstRecordButton;
    private JButton addRecordButton;
    private JButton searchButton;
    private JButton nextButton;
    private JButton clearButton;
    private JButton lastRecordButton;
    private JButton previousRecordButton;
    private JButton deleteRecordButton;
    private JLabel costLabel;
    private JTextField supplierIdField;
    private JLabel jcomp27;
    private JLabel supplierIdLabel;
    private JLabel menuTitleLabel;
    //private JLabel jcomp29;
   
    private FileOutputStream fos;
 private PrintWriter out;

    public stockControlSystem(String str) throws IOException{
   
   
    super(str);
    fos = new FileOutputStream("AccountFile.txt", true);
    out = new PrintWriter(new OutputStreamWriter(fos));
   
        //construct components
        productIdLabel = new JLabel ("Product ID:");
        productIDField = new JTextField (5);
        productTypeLabel = new JLabel ("Product Type:");
        productTypeField = new JTextField (5);
        productPriceField = new JTextField (5);
        productPriceLabel = new JLabel ("Product Price:");
        quantityInStockLabel = new JLabel ("Quantity In Stock:");
        qInStockField = new JTextField (5);
        reOrderLabel = new JLabel ("Re- Order Level:");
        reOrderField = new JTextField (5);
        reOrderQLabel = new JLabel ("Re- Order Quantity:");
        reOrderQField = new JTextField (5);
        costPriceField = new JTextField (5);
        firstRecordButton = new JButton ("First Record");
        addRecordButton = new JButton ("Add Record");
        searchButton = new JButton ("Search Record");
        nextButton = new JButton ("Next Record");
        clearButton = new JButton ("Clear");
        lastRecordButton = new JButton ("Last Record");
        previousRecordButton = new JButton ("Previous Record");
        deleteRecordButton = new JButton ("Delete Record");
        costLabel = new JLabel ("Cost Price:");
        supplierIdField = new JTextField (5);
        jcomp27 = new JLabel ("newLabel");
        supplierIdLabel = new JLabel ("Supplier ID:");
        menuTitleLabel = new JLabel (" ");
        //adjust size and set layout
        //setPreferredSize (new Dimension (448, 519));
        //setLayout (null);
       
        setSize(448,519);
        //add components
        add (productIdLabel);
        add (productIDField);
        add (productTypeLabel);
        add (productTypeField);
        add (productPriceField);
        add (productPriceLabel);
        add (quantityInStockLabel);
        add (qInStockField);
        add (reOrderLabel);
        add (reOrderField);
        add (reOrderQLabel);
        add (reOrderQField);
        add (costPriceField);
        add (firstRecordButton);
        add (addRecordButton);
        add (searchButton);
        add (nextButton);
        add (clearButton);
        add (lastRecordButton);
        add (previousRecordButton);
        add (deleteRecordButton);
        add (costLabel);
        add (supplierIdField);
        add (jcomp27);
        add (supplierIdLabel);
        add (menuTitleLabel);
        //set component bounds (only needed by Absolute Positioning)
        productIdLabel.setBounds (30, 75, 100, 25);
        productIDField.setBounds (160, 75, 155, 25);
        productTypeLabel.setBounds (30, 110, 100, 25);
        productTypeField.setBounds (160, 105, 155, 30);
        productPriceField.setBounds (160, 140, 155, 25);
        productPriceLabel.setBounds (35, 140, 100, 25);
        quantityInStockLabel.setBounds (30, 180, 100, 25);
        qInStockField.setBounds (160, 180, 155, 25);
        reOrderLabel.setBounds (30, 220, 100, 25);
        reOrderField.setBounds (160, 220, 155, 25);
        reOrderQLabel.setBounds (25, 250, 120, 35);
        reOrderQField.setBounds (160, 255, 155, 25);
        costPriceField.setBounds (160, 290, 155, 25);
        firstRecordButton.setBounds (15, 370, 115, 50);
        addRecordButton.setBounds (135, 405, 160, 30);
        searchButton.setBounds (135, 440, 160, 30);
        nextButton.setBounds (305, 425, 135, 45);
        clearButton.setBounds (330, 75, 100, 25);
        lastRecordButton.setBounds (15, 425, 115, 45);
        previousRecordButton.setBounds (305, 370, 135, 50);
        deleteRecordButton.setBounds (135, 370, 160, 30);
        costLabel.setBounds (25, 285, 100, 25);
        supplierIdField.setBounds (160, 325, 155, 25);
        jcomp27.setBounds (610, 175, 120, 25);
        supplierIdLabel.setBounds (25, 320, 100, 25);
        menuTitleLabel.setBounds (35, 10, 10, 35);
       
       
             
        nextButton.addActionListener(this);
    clearButton.addActionListener(this);
  previousRecordButton.addActionListener(this);
  addRecordButton.addActionListener(this);
  deleteRecordButton.addActionListener(this);
  searchButton.addActionListener(this);
  lastRecordButton.addActionListener(this);
  firstRecordButton.addActionListener(this);
 
 
    //set window listener listening w00t
 
  this.addWindowListener(this);
 
      //setBackGround(Color, white);
  setVisible(true);
 
    }
   
       
    public void windowActivated(WindowEvent e) {}
 public void windowClosed(WindowEvent e){}
 public void windowClosing(WindowEvent e) {System.exit(0);}
 public void windowDeactivated(WindowEvent e) {}
 public void windowDeiconified(WindowEvent e) {}
 public void windowIconified(WindowEvent e) {}
 public void windowOpened(WindowEvent e) {}
 
   
   
 public void actionPerformed(ActionEvent e)
    {
    //Object target = e.getSource();
   
   
    if (target == addRecordButton)
    {
      /*String s1 = productIDField.getText();
     
      s1.trim();
      out.println(s1);*/
     
      NodeList L1 = new NodeList();
     
      L1.insert(productIDField);
      productIDField.setText("");
     
      productTypeField.setText(L1.p1);
    }
   
    if (target == firstRecordButton)
    {
     
    }
    }
   
   
    class Node
    {
    public String productID;
    /*
    public String productType;
    public int productPrice;
    public int quantityInStock;
    public int reorderLevel;
    public int reorderQuanitity;
    public int costPrice;
    public int supplierId;*/
    public Node next;
   
    public Node(int p1)//, String p2, int p3, int p4, int p5, int p6, int p7, int p8)
    {
      productID = new String (p1);
      /*
      productType = new String[p2];
      productPrice = new int[p3];
      quantityInStock = new int[p4];
      reorderLevel = new int[p5];
      reorderQuantity = new int [p6];
      costPrice = new int[p7];
      supplierId = new int [p8];*/
   
    }
   
    public int readName(){return productID;}
    }
   
    }
 class NodeList
 {
  private Node head;
 
  public NodeList(){head = null;}
 
  public void insert(String id)//String pT, int pP, int qIS, int rL, int rQ, int cP, int sId)
  {
  Node temp = new Node(id);//, pT, pP, qIS, rL, rQ, cP, sId);
  temp.next = head;
  head = temp;
  }
 
 
 }
    public static void main (String args[]) throws IOException{
       
        stockControlSystem F1 = new stockControlSystem("Stock Control Menu");
    }
}


All times are GMT -4. The time now is 8:53 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC