• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

applets in NetBeans

 
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
Darrin
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Build.xml
mainfest.mf
then the nbproject folder and everything else that is created.
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic