I need a simple programs
Hi everybody :) .
My java knowledge is almost null. For now, I need to know how to create combobox, text fields and buttons. I've been reading some java tutos about this but the examples they show aren't that simple and is difficult for me to learn that way.
I want simple examples, like one simple combobox with like 3 options, so I can learn where I change the combobox options names and the title of the combobox.
First message :)
Are you using an IDE to create your java code? When starting out with Java a few years ago, I found that the netbeans GUI editor was really easy to use and created pretty good code at a drag and drop style. You could use that then to re-create what you want and look at the code the IDE generates.
Good tutorial - Lesson: Learning Swing with the NetBeans IDE (The Java™ Tutorials > Creating a GUI with JFC/Swing)
If you want to manually code it all in, have a look at
Java Swing Introduction to Swing Tutorial
make sure you have the javadoc files though, best thing you can do when in doubt is look up the javadoc. Looking up that will tell you how to do
All you need to worry about after that is the positioning, which, in all honesty is the harder part to get your head round. Have a look at the tutorials, they will definitely help you out.
JComboBox myBox = new JComboBox(String ["Cow","Pig","Sheep","Deer"]);
thanks. Unfortunely, I'm using JCreator and that's all I can use for now.
could somebody post the source code of a simple combobox (without images and stuff)?. I still haven't really got how the animals combobox on sun page works, so I wanna try a more simple combobox.
Simple examples of text fields and buttons would be good to :)