my dog learned polymorphism
The moose likes IDEs, Version Control and other tools and the fly likes applets in NetBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "applets in NetBeans" Watch "applets in NetBeans" New topic

applets in NetBeans

James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

I have tried and tried to make an applet in notepad that simply has three buttons(clear,red,black) and then have a drawing area. I cannot get it quite right. The suggestions I have got gotten and examples are too vague to be of any help. Can I create an applet in NetBeans? I only want one .java file. Or do I have to have all those other files that are created too? Im wanting to design the GUI in it and then read it to see how it did it. I think I can use this to create my own examples since I have not seen any good ones.

Visit my blog!
Chad Clites
Ranch Hand

Joined: Aug 16, 2005
Posts: 134
Yes you can create an applet in NetBeans.

Help, Help Contents, Search, and then type in 'applet', one of the very first help topics explains exactly how to do it (Creating an Applet). In order to use the gui builder, again go to Help, Help Contents, Search, and type in 'gui builder'. The third or fourth topic down will send you to another link called 'Working With the GUI Builder, and 'Designing Java GUI with GUI Builder'. Those are about as step by step as one can get.

Usually when things are not working like one expects, there are error messages thrown, or something happens that can be described. "I can not get it right" could mean that the GUI is not displaying at all, the buttons are not lining up, nothing happens when the buttons are clicked, there are no labels on the buttons, the background color is wrong, etc. We have no idea what you are seeing.

do I have to have all those other files that are created too

What files would those be?
Darrin Cartwright
Ranch Hand

Joined: Dec 27, 2002
Posts: 107
Hi James,

It rather easy to do in Netbeans. Just create an empty project and select:
File->New->Java GUI Forms->JApplet Form
Give it a name and go!

Hope that helps!

Life is good on the Ponderosa,<br />but mind where you step.
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

I have a contentPane and I can draw lines on it using my mouse, I have three buttons, Clear, Red, Black(they change line color). I was told to clear a screen I should draw a rectangle the size of the applet and fill it with the same color as my background color. This takes away my buttons unti lI mouse over them again. Someone suggested making a Panel off the the content Pane and did not give any more info on how to do that.

The other issus is

if I dont clear out the coordinates after drawing a line then the last line drawn becomes the new color I selected. Id I do clear out the coordinates then if I draw lines too fast some of them start at (0,0). So being able to step through the code and seeing what its doing will help since I have it written in Notepad right now. My main trouble though is understanding how to code the GUI in notepad and how everything works as far as the GUI is concerned. I think using NetBeans I can look at the generated code and see what its doing, kinda like making my own examples.

All those other files refer to
then the nbproject folder and everything else that is created.
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

I have the applet created, but how do I design the GUI for it? I right clicked on the Project name and did, new, JFrame Form and it showed me the GUI editor, but it also created a template for a java progam, not an applet. I looked through the help and that is how it said to do it. Will I have to make it a program and then covert it over to an applet later if I want to use the GUI editor on my applet?
I agree. Here's the link:
subject: applets in NetBeans
It's not a secret anymore!