Saturday, May 11, 2013

007. REGISTER LIBRARY(JAR) TO NETBEANS OR PROJECT

 

  • Download daniani.jar (top-right this blog/ Reference (Downloads))
(for sample library)
  • Open Netbeans IDE

  • Add Library to Netbeans
    • Click menu, Tools -> Libraries
    • Click button, New Library...
    • Set Library Name, for example: daniani. Click OK.
    • A new library (daniani) will be shown. On selected library, click Add Jar/Folder... button.
    • Search daniani.jar that we have downloaded, click Add Jar/Folder.
    • The library location will be add to Library Classpath. Click OK.

    Add Library to Project
    • Choose a project
    • Expand the tree, then right click Libraries node, choose Add Library...
    • Choose the library that we have created (for example: daniani). Click Add Library.
    • So, daniani will be added to Libraries node.
    • If needed, add some other libraries to a project

    Using Library (sample)
    • Create new JFrame Frame..., and named=LibraryTest (we asume that we have read and understood 001. THE BEGINNING)


    • Add JButton, then compose it to follow design below
    • Right click JButton, choose: Events -> Action -> actionPerformed
    • Type the script (for the action):
      dnMessageDialog md = new dnMessageDialog("This is a content", "Title", 0);
      md=null;


      And we must: import daniani.control.dnMessageDialog;

      (I created a custom dnMessageDialog, to get a truly Always on Top and able to copy a message such as an error message).

    • Run this file, by pressing Shift+F6, or right click on LibraryTest, choose Run File.
    • I hope working.