Change font size of NetBeans IDE controls

It’s a little bit confusing changing the font size of IDE controls and menus. The options dialog has only font size changes for the editor, not for the whole IDE. This is specially helpful on windows with scaled screen resolution on HiDPI displays. The trick is to add an additional parameter to the VM options in the netbeans.conf configuration file. On Windows this is e.g. C:\Program Files\NetBeans 8.2\etc\netbeans.conf, on OS X /Applications/NetBeans/Netbeans 8.2.app/Contents/Resources/etc. Add the parameter –font-size to the line starting with netbeans_default_options. Example:  netbeans_default_options=”–font-size=14 -J-client -J-Xss2m -J-Xms32m” Now the IDE has a font size of 14pt for the IDE.

Read more

ObjectListDataProvider Tutorial

This is a tutorial for using the ObjectListDataProvider in a Visual Web Project. A ObjectListDataProvider is useful if the underlaying data is from a datasource not supported by NetBeans. Some samples for such datasources are a JPA or hibernate connection, other legacy systems such SAP or Lotus Notes and files in various formats. In this tutorial we use a text file with customer records as datasource for our application. Creating the project In the first step you create a normal VWP project named OldpSample: Address POJO For data storage we use a simple POJO object. Right click the oldpsample package[…]

Read more

NetBeans JPA and Hibernate Tutorial

This tutorial illustrates the usage of JPA with Hibernate as the persistence layer for a Java SE application. For this tutorial we use a PostgreSQL database. The installation of PostgreSQL and creation of the test database is not handled in this tutorial. Start NetBeans and create a new Java project. Name your project «JPATutorial» and deselect the «Create Main Class» checkbox. Click on «Finish» and the setup wizard creates your project. Right click the «Source Packages» note in the project explorer and select «New -> Java Package». Name the package «jpatutorial» and click «Finish». Libraries We need some additional libraries[…]

Read more

Fill a treeview programmatically

You must build a collection of TreeNode objects and add this collection to the TreeView control. Each TreeNode object has several properties to set up the visual appearance and functionality. Important TreeNode properties expanded – Shows this node expaned with children ext – Title text of the node target – Target browser window toolTip – Tooltip text to display url – Hyperlink to navigate to action – Name of method to call if user selects this node actionListenerExpression – Expression for action listener method. Adding icon to TreeNode To add a icon to the TreeNode you must first create a[…]

Read more

JAAS with active directory authentication in a web application

This is a sample to use JAAS authentication with a windows active directory server. I use a Sun Java System Application Server, so the steps with other servers could be different. Step 1: Defining LDAP realm In this example you must define a LDAP realm named «ads-realm» with the following parameters: Realm class: com.sun.enterprise.security.auth.realm.ldap.LDAPReam Properties: directory = ldap://ads.host.name:389 base-dn = DC=ads,DC=domain,DC=com search-bind-dn = user search-bind-password = password search-filter = (&(objectClass=user)(sAMAccountName=%s)) group-search-filter = (&(objectClass=group)(member=%d)) jaas-context = ldapRealm You must change directory, base-dn, search-bind-dn and search-bind-password to your active directory configuration. The «search-bind-dn» and «search-bind-password» parameters are needed, because with default settings[…]

Read more