Dan D'Apice

Greenhorn
+ Follow
since Sep 26, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dan D'Apice

kemal,
Thanks for dealing with me all this time. Your input has been invaluable, however, I am furious right now and am throwing in the towel. I only have this week and one more week left to my Java class. I just can't get my head wrapped around this language. If anybody is thinking about going to University of Phoenix to learn Java, DON'T....they're terrible!! Good luck to everyone here, I'm done....thanks to everyone for the help....
11 years ago
Thanks Kemal,
LOL, that was an OOPS on my part. Now that that's fixed, I just got smacked with a mega-error! I realize it's based off of me trying to incorporate a 3 item jComboBox into the mix, but this is what I got in the output....


I realize I missed quite a bit (as the error list shows), but if there is a quick explanation to this, it would help me filter out what I missed or did wrong...
11 years ago
Hello All,
OK, this is a continuation from my previous post. What I am trying to do is get the data (Item Name, Item Number, etc.) to display in my GUI's appropriate text fields (Item Number, Item Name, etc.). What I have for code so far is:




What I get in the output is:
Exception in thread "main" java.lang.NullPointerException
at inventory.InventoryGUI.<init>(InventoryGUI.java:17)
at inventory.InventoryGUI.main(Inventory.java: 18)

I assume that the jCombobox1 is not getting the data from the inventory array list I created. Or, I am completely wrong again. Sorry if I missed a couple of lines that needed "shortening". I tried a couple of suggestions from the original post, but every one generates errors. Any help is much appreciated.
11 years ago
Hey Kemal,
Sorry I didn't respond earlier, I had some personal things to take care of yesterday. Anyway, thanks for that last posting. I'm going to give that a shot and see how it works out. Wish me luck....lol...I'm gunna need it....
11 years ago
OK, I've got to go back to the drawing board here. I'm going to go read some of my book(s) I have and see if I can come up with something. I'll check back here afterward. Thanks everyone for the help so far...
11 years ago
Kemal,
I actually took out the JComboBox and text to keep things simple (I hope). What I want to do is just populate the text fields of the GUI with their respected data. E.G. itemNumber would be placed in the Item Number text field, itemName would go in the Item Name text field, etc. After that, I need to display the total value of the item (inventory * price each) and display that in the Value of Item Stock text field. Finally I need to calculate and display the total for the entire inventory (all three of the array list) and display that in the Value of Entire Inventory text field. I understand how to set up listeners for each text field, but getting that data to the text field is where I am stumbling. You may have explained it in the last post, but I am not sure if I have to create another constructor and array list to bring the data over to the GUI or not.
11 years ago
Thanks again, Winston. I actually made a note to post ~80 characters per line in the future. Now, if I can just figure out how to get my array list incorporated into the GUI, I should be good. I'm not focusing on the drop box right now, just trying to get an instance of my array list into their respected text boxes...
11 years ago
OK, post has been re-edited. I put comments where the code was describing what I did. Hope that works. If not, let me know and I will try to adjust it.
11 years ago
Ok, sorry about that Winston. Not sure how I'm going to minimize the code without making it non-readable. I'll see what I can do.
11 years ago
Hello All,
I hope the title wasn't too confusing. First I will start with this week's requirements, then the code I have so far. Again I am just looking to get pointed in the right direction.

Requirements for Week 7:
• Modify the Inventory Program to use a GUI by either
1. Adding a new class that extends JFrame (example in Chapter 11), or
2. By creating a new JDeskTop Application project.

• Use an ArrayList or other automatically resizable collection instead of an Array to store your products.

• The GUI should display the information of the first product in your collection, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product.

• In addition, the GUI should display the value of the entire inventory. Since this requires a loop of your collection, out this functionality in a separate method of your GUI class. This will allow you to call it only when updating the total is required.

• At this point, all your main method should do is create an instance of your GUI class, set the Window size, setDefaultCloseOperation to EXIT_ON_CLOSE, start the GUI by calling it’s show method and get out of the way. (Desktop app will do this for you).

• The Collection of products now belongs to the GUI class as a class level variable. This will allow all methods in the GUI class to have access to it.

• If you use the Desktop Application, it will create a read-only method named initComponents. As you drag components to the screen, initialization code for them will be added to this method. The method is then called from your GUI constructor. Things you add manually, like your collection cannot go in this method. You need to initialize them in the constructor yourself.

Do not use a series of pop-up dialog boxes. A GUI is a single screen that gives you access to all of the applications functionality. Pop-ups can be used for prompts, and when needed to collect specific data. But if you need values for 4 variables, use a single pop-up with four fields, not one popup per variable.

Post a zipped copy of the entire project.

I know, quite a bit to do here!






The last piece of coding is the source created from using Netbeans 7.2 GUI builder. From here, I am unable to figure out how to get 1 instance (I can remove the Item select box and text if it will make life easier) of the data stored in the Inventory program to display in the GUI, let alone even run the GUI. Any help would be greatly appreciated.
11 years ago
I figured it out: I was running 32 bit Java JRE and 64 bit Netbeans. Running 32 /32 now and the dialog box pops up as normal. Yet another rookie mistake. At least it works now....
11 years ago
EDIT:
Hey Kemal,
Sorry for any confusion. When I run the code the output window says run: then the next line says BUILD SUCCESSFUL (total time: 0 seconds) I've tried undocking the window, but that didn't do anything. I get no dialog box or display saying "welcome to Java".
11 years ago
Hello All,
Well, in my wonderful journey through Java, I am now at the GUI / graphics phase. I type in the following code, but it runs in the command window and no message dialog / dialog box pops up (like it says it's supposed to). I tried doing a search online for dialog boxs / message dialogs without success. Is there a setting in Java or Netbeans I am missing? I am running Java JDK 7 update 7 and Netbeans 7.2
11 years ago
Thanks again, everyone. I apologize for not incorporating the information you all gave me at first. I am going to take what great information has be given to me here and mull it over again and sort out this last hurdle of my program. I promise I wont ask any more questions about this application... :-D
11 years ago
Kemal,
I had a feeling it was something simple I wasn't seeing (again). Thanks again for the assist. Here is what the output looks like:

Now if I can just trim that output to only 2 places after the decimal point to represent a dollars and cents format. Any ideas or suggestions would be appreciated...
11 years ago