944,208 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 6508
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Mar 24th, 2007
0

homework(easy): Java GUI/Netbeans using java.util.LinkedList

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
collegestuffs is offline Offline
7 posts
since Mar 2007
Mar 24th, 2007
0

Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList

Why don't you post your project here for us to look at?
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Mar 24th, 2007
0

Re: homework(easy): Java GUI/Netbeans using java.util.LinkedList

Quit. Just quit now.
Reputation Points: 92
Solved Threads: 51
Practically a Posting Shark
Phaelax is offline Offline
856 posts
since Mar 2004
Mar 24th, 2007
0

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
Last edited by collegestuffs; Mar 24th, 2007 at 2:21 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
collegestuffs is offline Offline
7 posts
since Mar 2007
Mar 24th, 2007
0

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?
Last edited by iamthwee; Mar 24th, 2007 at 2:23 pm.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Mar 24th, 2007
0

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....
Last edited by collegestuffs; Mar 24th, 2007 at 2:36 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
collegestuffs is offline Offline
7 posts
since Mar 2007
Mar 24th, 2007
0

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!
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Mar 24th, 2007
0

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 ?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
collegestuffs is offline Offline
7 posts
since Mar 2007
Mar 24th, 2007
0

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:

Java Syntax (Toggle Plain Text)
  1. ///Generated by GuiGenie - Copyright (c) 2004 Mario Awad.
  2. //Home Page <a rel="nofollow" href="http://guigenie.cjb.net" target="_blank">http://guigenie.cjb.net</a> - Check often for new versions!
  3. import java.io.*;
  4. import java.awt.*;
  5. import java.awt.event.*;
  6. import javax.swing.*;
  7. import javax.swing.event.*;
  8. public class stockControlSystem extends JFrame implements ActionListener, WindowListener {
  9.  
  10. private JLabel productIdLabel;
  11. private JTextField productIDField;
  12. private JLabel productTypeLabel;
  13. private JTextField productTypeField;
  14. private JTextField productPriceField;
  15. private JLabel productPriceLabel;
  16. private JLabel quantityInStockLabel;
  17. private JTextField qInStockField;
  18. private JLabel reOrderLabel;
  19. private JTextField reOrderField;
  20. private JLabel reOrderQLabel;
  21. private JTextField reOrderQField;
  22. private JTextField costPriceField;
  23. private JButton firstRecordButton;
  24. private JButton addRecordButton;
  25. private JButton searchButton;
  26. private JButton nextButton;
  27. private JButton clearButton;
  28. private JButton lastRecordButton;
  29. private JButton previousRecordButton;
  30. private JButton deleteRecordButton;
  31. private JLabel costLabel;
  32. private JTextField supplierIdField;
  33. private JLabel jcomp27;
  34. private JLabel supplierIdLabel;
  35. private JLabel menuTitleLabel;
  36. //private JLabel jcomp29;
  37.  
  38. private FileOutputStream fos;
  39. private PrintWriter out;
  40.  
  41. public stockControlSystem(String str) throws IOException{
  42.  
  43.  
  44. super(str);
  45. fos = new FileOutputStream("AccountFile.txt", true);
  46. out = new PrintWriter(new OutputStreamWriter(fos));
  47.  
  48. //construct components
  49. productIdLabel = new JLabel ("Product ID:");
  50. productIDField = new JTextField (5);
  51. productTypeLabel = new JLabel ("Product Type:");
  52. productTypeField = new JTextField (5);
  53. productPriceField = new JTextField (5);
  54. productPriceLabel = new JLabel ("Product Price:");
  55. quantityInStockLabel = new JLabel ("Quantity In Stock:");
  56. qInStockField = new JTextField (5);
  57. reOrderLabel = new JLabel ("Re- Order Level:");
  58. reOrderField = new JTextField (5);
  59. reOrderQLabel = new JLabel ("Re- Order Quantity:");
  60. reOrderQField = new JTextField (5);
  61. costPriceField = new JTextField (5);
  62. firstRecordButton = new JButton ("First Record");
  63. addRecordButton = new JButton ("Add Record");
  64. searchButton = new JButton ("Search Record");
  65. nextButton = new JButton ("Next Record");
  66. clearButton = new JButton ("Clear");
  67. lastRecordButton = new JButton ("Last Record");
  68. previousRecordButton = new JButton ("Previous Record");
  69. deleteRecordButton = new JButton ("Delete Record");
  70. costLabel = new JLabel ("Cost Price:");
  71. supplierIdField = new JTextField (5);
  72. jcomp27 = new JLabel ("newLabel");
  73. supplierIdLabel = new JLabel ("Supplier ID:");
  74. menuTitleLabel = new JLabel (" ");
  75.  
  76.  
  77. setSize(448,519);
  78. //add components
  79. add (productIdLabel);
  80. add (productIDField);
  81. add (productTypeLabel);
  82. add (productTypeField);
  83. add (productPriceField);
  84. add (productPriceLabel);
  85. add (quantityInStockLabel);
  86. add (qInStockField);
  87. add (reOrderLabel);
  88. add (reOrderField);
  89. add (reOrderQLabel);
  90. add (reOrderQField);
  91. add (costPriceField);
  92. add (firstRecordButton);
  93. add (addRecordButton);
  94. add (searchButton);
  95. add (nextButton);
  96. add (clearButton);
  97. add (lastRecordButton);
  98. add (previousRecordButton);
  99. add (deleteRecordButton);
  100. add (costLabel);
  101. add (supplierIdField);
  102. add (jcomp27);
  103. add (supplierIdLabel);
  104. add (menuTitleLabel);
  105. //set component bounds (only needed by Absolute Positioning)
  106. productIdLabel.setBounds (30, 75, 100, 25);
  107. productIDField.setBounds (160, 75, 155, 25);
  108. productTypeLabel.setBounds (30, 110, 100, 25);
  109. productTypeField.setBounds (160, 105, 155, 30);
  110. productPriceField.setBounds (160, 140, 155, 25);
  111. productPriceLabel.setBounds (35, 140, 100, 25);
  112. quantityInStockLabel.setBounds (30, 180, 100, 25);
  113. qInStockField.setBounds (160, 180, 155, 25);
  114. reOrderLabel.setBounds (30, 220, 100, 25);
  115. reOrderField.setBounds (160, 220, 155, 25);
  116. reOrderQLabel.setBounds (25, 250, 120, 35);
  117. reOrderQField.setBounds (160, 255, 155, 25);
  118. costPriceField.setBounds (160, 290, 155, 25);
  119. firstRecordButton.setBounds (15, 370, 115, 50);
  120. addRecordButton.setBounds (135, 405, 160, 30);
  121. searchButton.setBounds (135, 440, 160, 30);
  122. nextButton.setBounds (305, 425, 135, 45);
  123. clearButton.setBounds (330, 75, 100, 25);
  124. lastRecordButton.setBounds (15, 425, 115, 45);
  125. previousRecordButton.setBounds (305, 370, 135, 50);
  126. deleteRecordButton.setBounds (135, 370, 160, 30);
  127. costLabel.setBounds (25, 285, 100, 25);
  128. supplierIdField.setBounds (160, 325, 155, 25);
  129. jcomp27.setBounds (610, 175, 120, 25);
  130. supplierIdLabel.setBounds (25, 320, 100, 25);
  131. menuTitleLabel.setBounds (35, 10, 10, 35);
  132.  
  133.  
  134.  
  135. nextButton.addActionListener(this);
  136. clearButton.addActionListener(this);
  137. previousRecordButton.addActionListener(this);
  138. addRecordButton.addActionListener(this);
  139. deleteRecordButton.addActionListener(this);
  140. searchButton.addActionListener(this);
  141. lastRecordButton.addActionListener(this);
  142. firstRecordButton.addActionListener(this);
  143.  
  144.  
  145. //set window listener listening
  146.  
  147. this.addWindowListener(this);
  148.  
  149.  
  150. setVisible(true);
  151.  
  152. }
  153.  
  154.  
  155. public void windowActivated(WindowEvent e) {}
  156. public void windowClosed(WindowEvent e){}
  157. public void windowClosing(WindowEvent e) {System.exit(0);}
  158. public void windowDeactivated(WindowEvent e) {}
  159. public void windowDeiconified(WindowEvent e) {}
  160. public void windowIconified(WindowEvent e) {}
  161. public void windowOpened(WindowEvent e) {}
  162.  
  163.  
  164.  
  165. public void actionPerformed(ActionEvent e)
  166. {
  167. Object target = e.getSource();
  168.  
  169.  
  170. if (target == addRecordButton)
  171. {
  172. String s1 = productIDField.getText();
  173.  
  174. s1.trim();
  175. out.println(s1);
  176. productIDField.setText("");
  177. }
  178.  
  179. if (target == firstRecordButton)
  180. {
  181. productIDField.setText("");
  182. }
  183. }
  184.  
  185.  
  186. public static void main (String[] args) throws IOException{
  187.  
  188. stockControlSystem F1 = new stockControlSystem("Stock Control Menu");
  189. }
  190. }
Last edited by collegestuffs; Mar 24th, 2007 at 9:20 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
collegestuffs is offline Offline
7 posts
since Mar 2007
Mar 24th, 2007
0

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?

Java Syntax (Toggle Plain Text)
  1. ///Generated by GuiGenie - Copyright (c) 2004 Mario Awad.
  2. //Home Page <a rel="nofollow" href="http://guigenie.cjb.net" target="_blank">http://guigenie.cjb.net</a> - Check often for new versions!
  3. import java.io.*;
  4. import java.awt.*;
  5. import java.awt.event.*;
  6. import javax.swing.*;
  7. import javax.swing.event.*;
  8. public class stockControlSystem extends JFrame implements ActionListener, WindowListener {
  9.  
  10. private JLabel productIdLabel;
  11. private JTextField productIDField;
  12. private JLabel productTypeLabel;
  13. private JTextField productTypeField;
  14. private JTextField productPriceField;
  15. private JLabel productPriceLabel;
  16. private JLabel quantityInStockLabel;
  17. private JTextField qInStockField;
  18. private JLabel reOrderLabel;
  19. private JTextField reOrderField;
  20. private JLabel reOrderQLabel;
  21. private JTextField reOrderQField;
  22. private JTextField costPriceField;
  23. private JButton firstRecordButton;
  24. private JButton addRecordButton;
  25. private JButton searchButton;
  26. private JButton nextButton;
  27. private JButton clearButton;
  28. private JButton lastRecordButton;
  29. private JButton previousRecordButton;
  30. private JButton deleteRecordButton;
  31. private JLabel costLabel;
  32. private JTextField supplierIdField;
  33. private JLabel jcomp27;
  34. private JLabel supplierIdLabel;
  35. private JLabel menuTitleLabel;
  36. //private JLabel jcomp29;
  37.  
  38. private FileOutputStream fos;
  39. private PrintWriter out;
  40.  
  41. public stockControlSystem(String str) throws IOException{
  42.  
  43.  
  44. super(str);
  45. fos = new FileOutputStream("AccountFile.txt", true);
  46. out = new PrintWriter(new OutputStreamWriter(fos));
  47.  
  48. //construct components
  49. productIdLabel = new JLabel ("Product ID:");
  50. productIDField = new JTextField (5);
  51. productTypeLabel = new JLabel ("Product Type:");
  52. productTypeField = new JTextField (5);
  53. productPriceField = new JTextField (5);
  54. productPriceLabel = new JLabel ("Product Price:");
  55. quantityInStockLabel = new JLabel ("Quantity In Stock:");
  56. qInStockField = new JTextField (5);
  57. reOrderLabel = new JLabel ("Re- Order Level:");
  58. reOrderField = new JTextField (5);
  59. reOrderQLabel = new JLabel ("Re- Order Quantity:");
  60. reOrderQField = new JTextField (5);
  61. costPriceField = new JTextField (5);
  62. firstRecordButton = new JButton ("First Record");
  63. addRecordButton = new JButton ("Add Record");
  64. searchButton = new JButton ("Search Record");
  65. nextButton = new JButton ("Next Record");
  66. clearButton = new JButton ("Clear");
  67. lastRecordButton = new JButton ("Last Record");
  68. previousRecordButton = new JButton ("Previous Record");
  69. deleteRecordButton = new JButton ("Delete Record");
  70. costLabel = new JLabel ("Cost Price:");
  71. supplierIdField = new JTextField (5);
  72. jcomp27 = new JLabel ("newLabel");
  73. supplierIdLabel = new JLabel ("Supplier ID:");
  74. menuTitleLabel = new JLabel (" ");
  75. //adjust size and set layout
  76. //setPreferredSize (new Dimension (448, 519));
  77. //setLayout (null);
  78.  
  79. setSize(448,519);
  80. //add components
  81. add (productIdLabel);
  82. add (productIDField);
  83. add (productTypeLabel);
  84. add (productTypeField);
  85. add (productPriceField);
  86. add (productPriceLabel);
  87. add (quantityInStockLabel);
  88. add (qInStockField);
  89. add (reOrderLabel);
  90. add (reOrderField);
  91. add (reOrderQLabel);
  92. add (reOrderQField);
  93. add (costPriceField);
  94. add (firstRecordButton);
  95. add (addRecordButton);
  96. add (searchButton);
  97. add (nextButton);
  98. add (clearButton);
  99. add (lastRecordButton);
  100. add (previousRecordButton);
  101. add (deleteRecordButton);
  102. add (costLabel);
  103. add (supplierIdField);
  104. add (jcomp27);
  105. add (supplierIdLabel);
  106. add (menuTitleLabel);
  107. //set component bounds (only needed by Absolute Positioning)
  108. productIdLabel.setBounds (30, 75, 100, 25);
  109. productIDField.setBounds (160, 75, 155, 25);
  110. productTypeLabel.setBounds (30, 110, 100, 25);
  111. productTypeField.setBounds (160, 105, 155, 30);
  112. productPriceField.setBounds (160, 140, 155, 25);
  113. productPriceLabel.setBounds (35, 140, 100, 25);
  114. quantityInStockLabel.setBounds (30, 180, 100, 25);
  115. qInStockField.setBounds (160, 180, 155, 25);
  116. reOrderLabel.setBounds (30, 220, 100, 25);
  117. reOrderField.setBounds (160, 220, 155, 25);
  118. reOrderQLabel.setBounds (25, 250, 120, 35);
  119. reOrderQField.setBounds (160, 255, 155, 25);
  120. costPriceField.setBounds (160, 290, 155, 25);
  121. firstRecordButton.setBounds (15, 370, 115, 50);
  122. addRecordButton.setBounds (135, 405, 160, 30);
  123. searchButton.setBounds (135, 440, 160, 30);
  124. nextButton.setBounds (305, 425, 135, 45);
  125. clearButton.setBounds (330, 75, 100, 25);
  126. lastRecordButton.setBounds (15, 425, 115, 45);
  127. previousRecordButton.setBounds (305, 370, 135, 50);
  128. deleteRecordButton.setBounds (135, 370, 160, 30);
  129. costLabel.setBounds (25, 285, 100, 25);
  130. supplierIdField.setBounds (160, 325, 155, 25);
  131. jcomp27.setBounds (610, 175, 120, 25);
  132. supplierIdLabel.setBounds (25, 320, 100, 25);
  133. menuTitleLabel.setBounds (35, 10, 10, 35);
  134.  
  135.  
  136.  
  137. nextButton.addActionListener(this);
  138. clearButton.addActionListener(this);
  139. previousRecordButton.addActionListener(this);
  140. addRecordButton.addActionListener(this);
  141. deleteRecordButton.addActionListener(this);
  142. searchButton.addActionListener(this);
  143. lastRecordButton.addActionListener(this);
  144. firstRecordButton.addActionListener(this);
  145.  
  146.  
  147. //set window listener listening w00t
  148.  
  149. this.addWindowListener(this);
  150.  
  151. //setBackGround(Color, white);
  152. setVisible(true);
  153.  
  154. }
  155.  
  156.  
  157. public void windowActivated(WindowEvent e) {}
  158. public void windowClosed(WindowEvent e){}
  159. public void windowClosing(WindowEvent e) {System.exit(0);}
  160. public void windowDeactivated(WindowEvent e) {}
  161. public void windowDeiconified(WindowEvent e) {}
  162. public void windowIconified(WindowEvent e) {}
  163. public void windowOpened(WindowEvent e) {}
  164.  
  165.  
  166.  
  167. public void actionPerformed(ActionEvent e)
  168. {
  169. //Object target = e.getSource();
  170.  
  171.  
  172. if (target == addRecordButton)
  173. {
  174. /*String s1 = productIDField.getText();
  175.  
  176.   s1.trim();
  177.   out.println(s1);*/
  178.  
  179. NodeList L1 = new NodeList();
  180.  
  181. L1.insert(productIDField);
  182. productIDField.setText("");
  183.  
  184. productTypeField.setText(L1.p1);
  185. }
  186.  
  187. if (target == firstRecordButton)
  188. {
  189.  
  190. }
  191. }
  192.  
  193.  
  194. class Node
  195. {
  196. public String productID;
  197. /*
  198.   public String productType;
  199.   public int productPrice;
  200.   public int quantityInStock;
  201.   public int reorderLevel;
  202.   public int reorderQuanitity;
  203.   public int costPrice;
  204.   public int supplierId;*/
  205. public Node next;
  206.  
  207. public Node(int p1)//, String p2, int p3, int p4, int p5, int p6, int p7, int p8)
  208. {
  209. productID = new String (p1);
  210. /*
  211.   productType = new String[p2];
  212.   productPrice = new int[p3];
  213.   quantityInStock = new int[p4];
  214.   reorderLevel = new int[p5];
  215.   reorderQuantity = new int [p6];
  216.   costPrice = new int[p7];
  217.   supplierId = new int [p8];*/
  218.  
  219. }
  220.  
  221. public int readName(){return productID;}
  222. }
  223.  
  224. }
  225. class NodeList
  226. {
  227. private Node head;
  228.  
  229. public NodeList(){head = null;}
  230.  
  231. public void insert(String id)//String pT, int pP, int qIS, int rL, int rQ, int cP, int sId)
  232. {
  233. Node temp = new Node(id);//, pT, pP, qIS, rL, rQ, cP, sId);
  234. temp.next = head;
  235. head = temp;
  236. }
  237.  
  238.  
  239. }
  240. public static void main (String args[]) throws IOException{
  241.  
  242. stockControlSystem F1 = new stockControlSystem("Stock Control Menu");
  243. }
  244. }
Reputation Points: 10
Solved Threads: 0
Newbie Poster
collegestuffs is offline Offline
7 posts
since Mar 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in Java Forum Timeline: I need help
Next Thread in Java Forum Timeline: Detecting model owner from inside model





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC