Jorge Gutierrez wrote:Would you happen to know how to get my output to display in a text area in the GUI?
Knute Snortum wrote:I don't know anything about Netbeans Gui Builder, but from what I see on the web, it just creates a shell that you have to fill in. In some ways this is bad for beginners because they won't know what's happening "under the hood".
But let's look at the code. At the bottom all the GUI objects are declared. What does this mean regarding their scope? Another way to say this is, Will you be able to "see" jTextArea1 in inventory.runGame()? If not, we need to pass a reference to that method. See if you can do that first.
And I probably steared you the wrong way with JTextArea. That's way more than you need. Probably just a JLabel is all you need.
Jorge Gutierrez wrote:
I was under the impression from my class text that you could only pass by value in Java.
Jorge Gutierrez wrote:So I did some research and apparently with the GUI builder and using a jLabel like you stated, I am supposed to create an event handler. So, I came up with this:
But, as far as I can tell it doesnt do anything. At this point Im oretty confused
Agree. This how to write guide for documentation suggests documentation is not written for beginners.
Knute Snortum wrote: . . . the standard documentation isn't very beginner friendly.
The Java® language is really easy (or was until the reintroduced generics). It is programming itself which is difficult. Very difficult.
And programming is hard! . . .
Jorge Gutierrez wrote:I don't want you guys to think I'm not trying; I spend hours reading the text we are provided with, I look at online tutorials, but they explain everything in a way that only someone who already has experience coding would understand.
For the most part, my assignments are: Do this and this and this, read this chapter if you have questions. Ive been able to complete most of the assignments and I think that I understand Java at a very basic level, but sometimes just the small examples I get on this site help me put the pieces together.
I have never even seen setText in my course yet, so I honestly have no idea how to implement it. I understand the basic structure is going to look like:
And I understand that I have to do something in the () after setText to link it to my runGame method, but Im not sure how exactly to go about this. Also, when I do this:
I get: "method runGame in class IT215Inventory cannot be applied to given types;
required: no arguments
reason: actual and formal argument lists differ in length"
The weird thing is that now, when I click "Run" on my GUI, I was expecting it to just output everything with the word Results but it actually doesnt output anything, it just stays blank.
Modify the Inventory Program by adding a button to the GUI that allows the user to move to the first item, the previous item, the next item, and the last item in the inventory. If the first item is displayed and the user clicks on the Previous button, the last item should display. If the last item is displayed and the user clicks on the Next button, the first item should display.
Add a company logo to the GUI using Java graphics classes.