The default Netbeans Platform Application generated by the Netbeans IDE wizard has the Save, Undo and Redo button showing up in the toolbar by default.
Since my applications doesn’t have anything to save I decided to hide those buttons.
I turns out that remove them is really simple, I knew that I had to fiddle with the layer.xml file and hide something but I didn’t know exactly what. At the end I found the solution buried in this A NetBeans Platform Sample and Tutorial.
If you don’t want to edit the layer.xml by hand go to the Important Files / XML Layer / <this layer in context> / Toolbars and delete File and UndoRedo there. That will turn the element into hidden elements.
If you run into this problem it means that you’re probably using the XBeeShield. Maybe you didn’t notice but if you take a look to the Arduino XBee Shield schematics you’ll find out that DIO7 (CTS – Clear to Send) on the XBee is wired to RST in the Arduino. And that’s why you get the Arduino reset.
Even if you set DIO7 configuration to 0 – DISABLED (using X-CTU) the DIO7 will be set to HIGH then XBee enters sleep (This is stated in the “End Device Sleep Configuration”/“XBee End Device Configuration” chapter of the XBee Manual) .
So I guess that if you really want to send the XBee to sleep you need to cut the connection between DIO7 and RST in the Arduino, by either cutting the pcb trace or cutting the pin in XBee or XBee Shield. Good luck with that.
If you manage to do it please post in the comments your experiences or write something in this Arduino forum thread Arduino forum thread
Just open the Netbeans Template Manager by clicking Tools ⇒ Templates.
Click on the Default License and press the Duplicate button. Then select the newly created “license-default_1.txt” and rename it to “license-gplv3.txt” (the name it’s important copy exactly the same name). Then click on “Open in Editor” button and replace the contents of the license file with the following:
< #if licenseFirst??>
${licenseFirst}
${licensePrefix}${nameAndExt}
${licensePrefix}
${licensePrefix}Copyright (c) ${date?date?string("yyyy")} ${user}.
${licensePrefix}
${licensePrefix}This file is part of ${program}.
${licensePrefix}
${licensePrefix}${program} is free software: you can redistribute it and/or modify
${licensePrefix}it under the terms of the GNU General Public License as published by
${licensePrefix}the Free Software Foundation, either version 3 of the License, or
${licensePrefix}(at your option) any later version.
${licensePrefix}
${licensePrefix}${program} is distributed in the hope that it will be useful,
${licensePrefix}but WITHOUT ANY WARRANTY; without even the implied warranty of
${licensePrefix}MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
${licensePrefix}GNU General Public License for more details.
${licensePrefix}
${licensePrefix}You should have received a copy of the GNU General Public License
${licensePrefix}along with ${program}. If not, see <http ://www.gnu.org/licenses/>.
< #if licenseLast??>
${licenseLast}
This template that you just created makes use of two user variables (user and program) that you have to define in Netbeans Template Manager ⇒ User Configuration Properties ⇒ User.properties
the User.properties should look like
#
# Here, or in other properties files in this directory, you can define
# various properties that you want to make available to the template
# processor while creating various templates.
#
# uncomment the next line and specify your user name to be used in new templates
user=Ruben Laguna <ruben .laguna at gmail.com>
program=XBeeApplication
As Michal Hlavac has pointed out in the comments you could use ${project.displayName} instead of ${program}. This variable is automatically set by netbeans. So you don’t need to edit User.properties every time you switch projects But I should point out that I tried it with Netbeans Platform Application project and it doesn’t work for me and I even reported it to Netbeans Issuezilla.
Then the next step is to define that you want to use GPLv3 for your project. Just add the following line to you project.properties file
project.license=gplv3
Now just select New ⇒ Java Class to create a new class and you’ll get the GPLv3 license at the top of the file with the proper copyright line and customized to your application name.
<span class='line'>/*
</span><span class='line'> * NewClass.java
</span><span class='line'> *
</span><span class='line'> * Copyright (c) 2009 Ruben Laguna <ruben .laguna at gmail.com>.
</span><span class='line'> *
</span><span class='line'> * This file is part of XBeeApplication.
</span><span class='line'> *
</span><span class='line'> * XBeeApplication is free software: you can redistribute it and/or modify
</span><span class='line'> * it under the terms of the GNU General Public License as published by
</span><span class='line'> * the Free Software Foundation, either version 3 of the License, or
</span><span class='line'> * (at your option) any later version.
</span><span class='line'> *
</span><span class='line'> * XBeeApplication is distributed in the hope that it will be useful,
</span><span class='line'> * but WITHOUT ANY WARRANTY; without even the implied warranty of
</span><span class='line'> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
</span><span class='line'> * GNU General Public License for more details.
</span><span class='line'> *
</span><span class='line'> * You should have received a copy of the GNU General Public License
</span><span class='line'> * along with XBeeApplication. If not, see <http ://www.gnu.org/licenses/>.
</span><span class='line'> */</span>
Basic stuff: how to communicate / interact bewteen two TopComponent in Netbeans. LIke a updating a JTable inside a TopComponent from a JButton in another TopComponent. The key is in the TopComponent.findInstance method as explained by Geertjan in p. Simple Interactions Between NetBeans TopComponents.
Today I experienced a strange problem. Or I thought it was strange . I just checkout a my project from Subversion into Netbeans and it didn’t work!. How come? I have another working copy that works just ok. So I check the logs in $app/build/testuserdir/var/log/messages.log and I found
INFO [org.netbeans.core.windows.persistence]: [PersistenceManager.getTopComponentForID] Problem when deserializing TopComponent for tcID:'XBeeTopComponent'. Reason: com/rapplogic/xbee/api/XBeeException
java.lang.NoClassDefFoundError: com/rapplogic/xbee/api/XBeeException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
at java.lang.Class.getMethod0(Class.java:2642)
at java.lang.Class.getMethod(Class.java:1579)
at org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.createFromMethod(XMLSettingsSupport.java:664)
at org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.instanceCreate(XMLSettingsSupport.java:581)
at org.netbeans.modules.settings.convertors.SerialDataConvertor$SettingsInstance.instanceCreate(SerialDataConvertor.java:420)
[catch] at org.netbeans.core.windows.persistence.PersistenceManager.getTopComponentPersistentForID(PersistenceManager.java:531)
at org.netbeans.core.windows.persistence.PersistenceManager.getTopComponentForID(PersistenceManager.java:641)
at org.netbeans.core.windows.PersistenceHandler.getTopComponentForID(PersistenceHandler.java:422)
at org.netbeans.core.windows.PersistenceHandler.load(PersistenceHandler.java:162)
at org.netbeans.core.windows.WindowSystemImpl.load(WindowSystemImpl.java:69)
at org.netbeans.core.NonGui$2.run(NonGui.java:178)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
NoClassDefDFoundError. ok. It was working before but I can take look. Guess what I changed the name of the jar that contains that class, long time ago but it didn’t show up until now when I started from a clean directory. I found that in the Library Wrapper Module project..xml still contains the old name
that runtime-relative-path should be xbee-api-0.5.1.jar.
I changed to the proper filename and it worked. I can’t remember if I edited project.xml by hand before and that’s why I got it “corrupted” or if I managed to “leave” the file in a inconsistent state by using some wizard but I’m glad to have found it out so quickly.
Note to myself: create a new working directory regularly so I find out this kind of issues.
In my case the problem was that some program overwrote the registry entry HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/BrowserJavaVersion with the old value 1.6.0_01. When I set it back to 1.6.0_06 everything worked fine again.
Amazing, the swedish apple store dont sell the old Apple Lanyard Headphones, the ones that fits in both Apple 1st generation and 3rd generation.
And I cannot buy it from the US Apple store either, they just don’t let you to do so. So at the end I reverted to EBay and I found a nice offer from buyitloveit.com($12 + $6.5 shipping). That’s halft the price listed on the Apple Store ($39.00) and they are new not used. The ebay description said that the packaging was damaged but the only thing I could find was a sticky mark on the top of package. And it only took one week to deliver from UK to Sweden. Nice.
It seems that it cannot find the inner class ResolvableHelper inside the TopComponent. (throws a NoClassDefFoundException, see the messages.log for details ). It’s funny though, because it works perfectly in Windows XP and Vista, I thought this stuff was platform independent.