Friday, November 18, 2011

002. SETTING GRID SIZE FOR NULL LAYOUT

By default the size of gridX dan gridY Null Layout (JPanel) is 10. With that size, I am difficult to locate/size the swing control. So, I thought Netbeans still hard, not like Ms. Visual Basic, Delphi or the other. But, when I can set the size of gridX and gridY, I think... it's cool.

  1. Create file named form.properties,
    In Windows Explorer, right click New - Text Document
    rename a newfile to form.properties.
    To check filetype:
    • In Windows Explorer click menu Tools - Folder Options...
    • In dialog, click tab View, then remove check on Hide extensions for known file types.
    • Click OK.
    • If file name is form.properties.txt, then delete .txt extension , to be form.properties.
  2. Open that file with Notepad.exe;
  3. Then type (italic):
    gridX=5
    gridY=5

    It's mean, we set gridX=5, and gridY=5, or we can set to any size.
  4. Save and close that file.
  5. Open Netbeans;
  6. Click menu Help - About;
  7. In that dialog notice Userdir, for example:
    Userdir: E:\Documents and Settings\nisray\.netbeans\6.9


  8. In Windows Explorer open that location until following folder:
    E:\Documents and Settings\nisray\.netbeans\6.9\config\Preferences\org\netbeans\modules
  9. Copy file form.properties that location;
  10. Close Netbeans, and re-open (restart).
Now, please test with JPanel container. Right click that JPanel, choose Set Layout = Null Layout. Then add JButton control, set the size and location.

___________________
Next blog, we will write about jLabel.