Apparently I've been given up on, on another programming help type forum, so trying a new one. I'll be asking quite a lot of questions as I don't learn so well on my own and I'm in Java class, I'm slowly grasping it all but still struggling (especially when we're expected to do things in an assignment that haven't been covered in class at all, those are always fun)
Anyway, I'm meant to be creating an applet with Gridlayout manager as per the assignment instructions, however all I can find are how to make buttons, there doesn't seem to be any instruction on creating text input boxes or text labels for said input boxes....
Currently I've gotten this far:
I'm frustrated and annoyed, my book doesn't cover the above mentioned bits either, only buttons, and I've tried to to google gridLayout stuff for java, but can only seem to come up with creating button examples. I don't know if I'm just researching the wrong things in google or what, I've come across some code that maybe might be what I'm looking for, but without an example of the applet, I can't exactly tell what the code says as I've never used it before. And this has been my woosah, rub my earlobe moment. Thanks for the help in advance.
I'm not looking for the code to be written for me or anything obviously, but to be at least pointed in the right direction or pointers or anything would be much appreciated.
I will provide some links, but, before that, I will provide some intro to GUI programming in Java.
The API to build GUI in Java is called Swing. You should first learn normal GUI programming i.e to build a GUI and run it as a standalone application. The components of Swing (like JButton that you have used and other components) and layout managers (like GridLayout) are common for a standalone GUI application and an applet. Note that an applet runs from within a browser. Without understanding the basic parts of GUI, you will find it very difficult to develop applets and hence my advice to being with standalone applications.
You can start reading about swing components from the tutorial and specifically about text compoenents here
Thank you very much for your time and those links. I ended up asking the teacher for a little help, applets don't seem to be something you can exactly learn on your own, there are so many different types. I was making progress though! So that's something.
However upon asking the teacher about things he changed the assignment due to the lecture for applets being next week (assignment is due this Saturday, so that really wasn't going to work out for a lot of people). Anyway, I've got most of my code written, however. I'm trying to use a non-static method in my main method. My assignment deals with inheritance, and I'm basically trying to call my methods in main in order to run them.... so here's what I've gotten so far.
basically the problem is with the computePrice() methods in both the Order, and ShippedOrder classes. computePrice() method in Order, is supposed to be overridden by the computePrice() in ShippedOrder, basically adding $4.00 to the total. However if I make the computePrice() method in Order non-static, the UseOrder class can't use it but ShippedOrder class can, and if I make it static UseOrder class can use it, but ShippedOrder can't.
Quite a conundrum for me. I did read something about creating a new instance of the method perhaps? But dealing with inheritance I'm not quite sure how to go about doing such a thing. Thank you in advance for your help.
Let me tell you something about applets: When Java was first invented, back in the last century, people thought that applets were going to be a big deal, and that was why Java existed, so that people could write applets. And so books which were supposed to teach you Java were written so that applets were covered right at the beginning of the book.
But it didn't turn out that way. Applets turned out to be a minor feature. And the idea of learning applets up front fell flat, because not only do you need to learn about Java programming, you also need to learn about setting up a web site to support the applet. Of course the books just taught you about the Java part and assumed you already had website configuration expertise.
So nowadays if you have a book which teaches you Java, you won't find applets covered until about Chapter 19, back with all of the other miscellaneous things which didn't fit in the main part of the book.
And that tells you something about the course you're taking -- if it's covering applets near the beginning of the course, then it's quite out of date. Not that you can do anything about that, since you're already signed up for the course. I'm just saying.
Joined: Oct 30, 2012
Well, I mean technically there is only 6 weeks left of the semester, so I guess we're learning applets in the middle of the last half of the semester.