![]() |
|||||||||
|
|||||||||
|
NetBeans 5.0/5.5 Tips for a
Newbie
Add a 3rd Party Jar or Folder of Class Files (Library) Right-click the project you wish to add the library to. Select Properties and then click on Libraries and choose the Add JAR/Folder button. From here you simply browse to the jar or folder and NetBeans takes care of the rest. You do not need to modify any classpath info manually!
Netbeans GUI Design Layout Always group related components into their own JPanel. If some component is causing problems with layout it needs to go into its own JPanel container to relieve the surrounding components from trying to align with it. If your JFrame/JDialog is not resizable you need to make all the major containers inside of it Auto Resizing. If you do not, the JPanels will not line up or resize properly at runtime. When you move stuff around you need to re-check the Auto Resize and Anchor properties. Right-click on the component in design view and select Anchor or Auto Resizing and choose the appropriate settings. The components/widgets inside of your JPanels can have different resizing values as they require.
Multiple ActionPerformed Methods If you accidentally generate multiple ActionPerformed methods for the same component you can delete the extra method by clicking on the component, move over to the Properties Window and click on Events. Scroll down to the event your are concerned with and click the little ellipse box next to the value field. This will display a list of the methods that are existent. Simply choose one and select Remove. Sometimes when you change the variable name of a component NetBeans will generate another ActionPerformed method using the new variable name. This can be very confusing for a newbie as the build process will generate errors after this happens.
(Dist)ribution NetBeans puts your final built project into a folder called dist. The build folder contains the individual compiled class files. Make sure you clean out any unused libraries from the lib folder under dist. This is what the Clean and Build Main Project option does on the Build menu. When you remove libraries NetBeans doesn't clean them out unless you tell it to. The same goes if you used a .jar that included JavaDoc and then you want to deploy the .jar without JavaDoc. If you remove the large JavaDoc jar and add the one without JavaDoc you must do a Clean Build or delete the old jar yourself. Always check the lib folder before deploying. NoClassDefFoundError In Netbeans 5.5 I have experienced this. I thought it was me and spent hours trying to figure out what was wrong. All the sudden my project would run from the Netbeans IDE but it wouldn't run from the command line. I noticed Netbeans was not building out my lib folder and the manifest had no classpath information. I found this comment in the Netbeans forum and by a stoke of chance I read this and it led me to the solution. When you have projects with inter-related dependencies you will need to Build-->Clean and Build Main Project occasionally to clear up this problem. I never did this because I had tons of test data in my dist folder and didn't want it "Cleaned". Only wasted 5 hours on this.
|
|
||||||||
| more to come... | |||||||||