Sunday Apr 01, 2007

Grizzly 1.5 Architecture Review

It has been quite a little while since I have posted a blog entry.  That usually means I have some high(er) priority tasks I've been working on.

So, what have I been up to lately?    Project Grizzly

Jeanfrancois did an architecture review / concept review of Grizzly 1.5 last Thursday.  Next week we will be doing code review of Grizzly 1.5 so Grizzly 1.5 can be officially released.

In its initial days, Grizzly started as an HTTP web connector for GlassFish's web container.  Grizzly's performance as an http web connector has been so impressive it made sense to remove the http protocol specific elements from the Grizzly HTTP web connector.  That work has lead to Grizzly 1.5. With Grizzly 1.5 one can add his or her own protocol and realize the high performance available in the Grizzly HTTP web connector.  Of course, Grizzly 1.5 is open source and you can use it too.

Jeanfrancois and I will be presenting Grizzly to our friends in Brazil at FISL 2007 Conference, Porto Alegre this month. I do not know which date of the conference we will be presenting as of yet.

At JavaOne Jeanfrancois, Scott Oaks, Alan Bateman and I will be presenting many of the tips and tricks to effectively using Java NIO in a session titled, Tricks and Tips with NIO, Using the Grizzly Framework. Hope to see you there!

Powered by ScribeFire.

Saturday Jan 20, 2007

Been tagged and I am late

My good friend Gregg Sporar tagged me about 2 weeks ago.

So, why so late in responding to the tag ? (And it has been ages since I have had a blog entry :-( )

I have been chasing down a very nasty race condition bug that would not rear its head in a debugger or with any amount of instrumentation added to the code. And, it would only occur with at least 20 or more threads, (under heavy load). Yesterday I finally got it isolated and fixed. So, now is a good time to respond to Gregg's tag.

Here is five things many people do not know about me:

1.) I am child #12 in a family that has 13 kids. :-0 That's right! I have 6 brothers and 6 sisters.

2.) I graduated from high school with 43 other students.

3.) When I went to college, (I went to college at Iowa State), I was accepted there "conditionally". In other words, Iowa State put me on acedemic probation before I started my first semester. That's because my high school class ranking was 29 out of 44 and my ACT score was not high enough to get automatically accepted. But, the rest of the story is ... at Iowa State I graduate 2nd in my class with honors and distinction. Quite a change, huh?

4.) I have one boy that is 21 and a senior in college, (guess where? why of course Iowa State!). And, I have another boy that just turned 13 months. That's not a typo, I said 13 months.

5.) Outside of work, I have a rather "interesting" hobby. Many folks who read this blog may not know or understand what it is ... it is called "tractor pulling". I have a tractor that I take to competitions all over the midwest (US). If you don't understand what tractor pulling is about, you compete against others with their tractors to see who can pull the most weight down a 300 foot (~100 meter) track. Whoever can pull it the furthest is declared the winner. The tractor I have can from the factory with about 70 horsepower. After I made a few modifications, it now makes about 1500 horsepower! Perhaps you can understand my interest in performance? Why a tractor? I grew up on a farm and always enjoyed being around tractors. I also enjoyed the task of rebuilding the engines, (we had old used tractors).

There you have it ... five things few people know about me.

Now I'd like to hear 5 things about Brian Doherty, Dave Dagastine, Scott Oaks, Jeanfrancois Arcand and Ken Cavanaugh.

Sunday Sep 17, 2006

How to find & install FindBugs plug-in for NetBeans

There has been some discussions at Sun on using FindBugs, the static analysis tool, to help isolate potential bugs before they are committed to a builds.

Thought I would share how get and install the FindBug plug-in for NetBeans.

The instructions below are for NetBeans IDE 5.5. They should work for NetBeans 5.0 also.

1. Launch NetBeans.
2. Select Tools > Options from the main menu.
3. Click on the "Advanced Options" button in the lower left.
4. Expand the node "IDE Configuration > System.
5. Right click on "Autoupdate Types" and select "New > General Update Center".
6. In the "Name:" field enter "FindBugs Update Center" and click on the Finish Button.
7. Back on the Advanced Options dialog, expand "IDE Configuration > System > Autoupdate Types" and you will see a new update center type for the name you just entered in #6.
8. Select the label on the left hand side called "FindBugs Update Center". On the right hand side, enter the following URL for the "Server URL" entry:
\*\* NOTE: Use "https", not "http".
9. Make sure the "Enabled" box is checked.
10. Click on the "Close" button to exit the Advanced Options dialog.
11. Select Tools > Update Center from the main menu.
12. You'll now see "FindBugs Update Center" as one of the Update Centers to connect too.
13. If you are behind a firewall and need to configure a proxy, click on the "Proxy Configuration" button. Set your proxy configuration as needed.
14. Click the "Next" button to connect to the Update Center(s).
15. In the Update Center dialog, scroll down in the "Available Updates and New Modules" and look for the "FindBugs Update Center".
16. Under the "Software Quality" folder, select "FindBugs NetBeans Integration" and click on the "Add > " button.
17. Click on the "Next" button on the "Update Center" dialog.
18. Accept the licenses.
19. NetBeans will then prepare to install the FindBugs plug-in. Press the "Next" button when the pre-installation completes.
20. On the "Update Center" dialog, be sure to select the check boxes on the left hand side under the "Include" column. NetBeans may ask you if you want install a "unsigned module". If it asks you this question, answer "Yes to All" or "Yes".
21. Check the "Include" box for each module, (all of them).
22. After you have checked the "Include" button on all modules, click on the "Finish" button.
23. Now NetBeans will install the FindBugs plug-in.
24. When it is finished you will see a "FindBugs" icon in the toolbar.
25. When you have a project open, you can click on FindBugs to execute the FindBugs static analyzer. In the Output Window you will see what it has detected as potential bugs.


Wednesday Apr 19, 2006

How to kill NetBeans performance

There are several things you can do that will have a \*huge\* impact on NetBeans IDE performance and responsiveness.

The single biggest thing you can do is to make sure your "userdir" is not on a remote file system, (i.e. NFS, samba drive, etc).

What is "userdir" ?

It is a directory where NetBeans IDE stores its meta-data. One of the critical pieces of meta-data stored there is the information used for those productivity enhancing features we all enjoy such as code completion.

By default NetBeans IDE creates "userdir" in your home directory as a ".netbeans" directory with an appended NetBeans IDE version number. Hence, if you are on Linux or Unix, "userdir" is $HOME/.netbeans/. If you are Windows, this directory is usually "C:\\Documents And Settings\\< your user name>\\.netbeans\\. The value used for $HOME is the value returned from the Java system property user.home.

If your home directory happens to be a remote file system ... well, we all know performance of a remote file system is not nearly as good as local file systems. And, if your remote file system's responsiveness is like some that I have seen ... it will kill the responsiveness of your NetBeans IDE.

The good news is you can change the location of "userdir". You can specify a "userdir" on the command line when you start NetBeans IDE such as:

$ netbeans --userdir /local/file/system/netbeans/userdir/5.0

Or, you can edit the netbeans.conf file and change the "userdir" location to a local file system. The netbeans.conf file is in < netbeans install dir>/etc.

To make editing of the netbeans.conf easier, Claudio Miranda created nice plugin. Claudio would be glad to share his plug-in. Just drop him a note. Or, perhaps we can convince Claudio to contribute it to the many plug-ins showing up on

For additional responsiveness, you should also consider using a JDK that is on a local file system too. Code completion in NetBeans IDE uses the JDK's for displaying Java doc information, (a nice way to ensure you have the latest Java doc for the JDK).

Putting NetBeans projects on local file systems helps too.

Edgar Silva and Marlon Luz, NetBeans at FISL Conference

For those who are at FISL Conference in Porto Alegre, Brazil, stop by and catch the NetBeans presentations by community members Edgar Silva and Marlon Luz's. They are giving presentations on NetBeans IDE 5.0 and using NetBeans Mobility Pack to develop Java ME apps.

More information on the presentations can be found here:

Monday Apr 03, 2006

NetBeans and Looking Glass

What does NetBeans and Looking Glass have to do with each other?

About 9 months ago I started showing NetBeans IDE building and running the popular Looking Glass Java 3D desktop. The demo has always been quite popular. But, there have been a few folks who have been critical of the demo. I will spare them the embarrassment of calling them out explicitly. As I recall, one blogger complained that he did not understand why Looking Glass had presence at last year's NetBeans Day San Francisco. Perhaps that was an innocent question. Or, perhaps he did not see or understand the connection? Another blogger complained he did not understand what Looking Glass had to do with NetBeans and Java development or what it had to do with making him a more productive Java programmer.

Perhaps the screen shot of NetBeans below will answer their questions?

What is it?

It is the Looking Glass 3D window manager running inside NetBeans IDE as a plug-in. What you are looking at is what is called the 'spring test' Looking Glass example application.

What does this mean?

It means any Looking Glass application and visualization is possible in the NetBeans IDE and the NetBeans Platform. Think of the possibilities!

Imagine being able to debug an application in three dimensions, being able to view multiple threads and their relationship with each other as a program is executing with the current executing thread rotating to the foreground. Imagine looking at UML diagrams in 3D and being able to rotate them so you can better understand. I have seen many UML diagrams that are impossible to understand in 2D.

3D visualizations would likely be useful for education too. Imagine if the first time you were exposed to recursion you could have seen a 3D visualization of what was happening in a recursive method.

Think of the rich client applications you could build on top of the NetBeans Platform too.

Friday Mar 10, 2006

another record Java benchmark

For those of you that know me quite well, know that I am a Java performance junkie at heart. And, know I just recently moved back to working on Java / JVM performance.

I haven't blogged about anything for quite some time. But, with Sun announcing a new world record benchmark I couldn't resist. What I think is more impressive, as it is quoted in today's press release, "The latest in a series of leading performance records, testing results were conducted on the Java(TM) Platform, Standard Edition 5.0_06 with Java HotSpot (TM) Virtual Machine technology (2), the 14th world-record benchmark on the UltraSPARC IV+ processor-based platforms in just six months since launch."

I think that speaks volumes as to the improvements Sun has been making to the Hotspot JVM, i.e. (it's not just a one off world record, it's one of many in series over the past 6 months). I think with that kind of track record over the past six months, you can expect to continue to hear more and similar announcements in the futures.

Sunday Jan 08, 2006

Two of Kind Java Duke

On a recent trip to Brazil I was given a very unique and special gift by Marcelo Sousa. It is a Java Duke key chain which was created by his girlfriend. Here is a picture of it:

I understand from Marcelo there are only two such Java Duke key chains. Hence, the title of this blog.

I feel very honored to have been given one of these truly unique Java Dukes. I love it!

I hope to see Marcelo at JavaOne 2006 where he has promised to ask me about it. Right Marcelo ;-)

Muito obrigado Marcelo!

Saturday Jan 07, 2006

NetBeans and Maven2, awesome combination

I got an e-mail from a good friend of mine Edgar Silva. I met Edgar on my first visit to Brazil back in April 2005. On my recent visit to Brazil, Edgar gave me the "pop star" tour of his home town of Belém, (a wonderful place to visit).

Edgar is the creator / author of GreenBox IDE. You can see a recent video / flash clip of it here. GreenBox IDE is built on NetBeans IDE. But, GreenBox is not the topic of this blog.

Edgar sent me a link to his blog on using NetBeans and Maven2. In Edgar's blog he shows how easy it is to integrate Maven2 and NetBeans.

Try out for yourself. I did. It's easy and it's awesome!

Obrigado Edgar!

Monday Dec 26, 2005

Matisse Generated UI integrated with NetBeans as plugin

NetBeans Matisse, NetBeans plug-ins and NetBeans Rich Client Platform are gaining a lot of interest, (and use). Thought I would take the opportunity to tie these together. In this blog I show how to integrate a NetBeans Matisse generated user interface into NetBeans as a NetBeans plugin.

I welcome you to follow along and go through the steps with me to see how easy it is. I think you will agree NetBeans Matisse and NetBeans plugin creation ease of development is second to none. I think your reaction will be like mine ... you will want to try it out too.

For this blog, I am going to use a NetBeans project I started that has a Matisse created UI in it which you can download and use yourself. I started this NetBeans project so you too could go through the exercise of creating the same NetBeans plug-in in a matter minutes. Click here to download a zipped version of my NetBeans Spell Check Plugin project. Using this NetBeans project will save you a little time creating a UI. I could have told you to create the UI yourself. But, that's not the point of this blog. I want you to see how easy it is to create a plug-in for NetBeans that uses a NetBeans Matisse created UI. But, if you are interested, you could re-create the UI I am using here in your own NetBeans project. FWIW, it took me less than 10 minutes to create that UI with Matisse.

The UI I created in the Spell Check Plugin NetBeans project is the UI you see if you run the Mozilla mailer's or Thunderbird's spell checker. Here's a screen shot of the UI I created using Matisse.

Now, on to how to take a Mozilla-like UI I created with NetBeans Matisse and integrate it into a NetBeans plug-in.

On to the fun :-)

Download the zipped Spell Check Plugin project. Extract the zip file to a location on your disk. The zipped file will extract into a directory structure called "SpellCheckPlugin".

Start NetBeans IDE 5.0 (Beta 2) or later. If you don't have a copy available, go download a version from

Open the "SpellCheckPlugin" NetBeans project.

After you open the "SpellCheckPlugin" NetBeans project, expand the "SpellCheckPlugin" project so that you can see the source file name and package names.

If you'd like to refactor the package name, go ahead. Just right click on the package name in the projects window in select Refactor | Rename. If you refactor the name of the source class, you will need to update a couple lines of code later. I think it will be obvious what you'll need to modify a little later. ;-)

Load the source file in the NetBeans editor. You will see a Matisse UI I created that looks like the Mozilla spell checker. Here's a screen shot of what you will see:

If you press the button on the NetBeans Matisse GUI designer you can see a preview of the form. Go ahead and do so to see how the form looks on your system. Although it may not be obvious, all NetBeans Matisse generated UIs automatically adjust to the target platform's look and feel guidelines. For example, if you have just opened this project on Windows, you would never know that I created the UI on Linux.

Suppose what I want to do with this UI is add it to the NetBeans IDE so I can see it from an Edit | Spell Check menu item. I can do that by creating an "action" in NetBeans in a NetBeans module plugin project. Hence, to create an action in the "SpellCheckPlugin" project, right click on the "SpellCheckPlugin" project and select "New | Action". This launches the "New Action Wizard" in NetBeans.

On the first page of the Action wizard, accept the "Always Enabled" (use CallableSystemAction) default and press the "Next" button. On the next page of the new Action wizard, GUI Registration screen, specify:

Category: Edit
This is the category where you want the action to be displayed in the Keymap section of the NetBeans IDE Options Window.
Global Menu Item:
Menu: Edit
Position: <eparator>-HERE-<separator> ( Right after the Find Previous-HERE-<separator> )
This is where the action will be displayed as a menu item.

To add a separator before and/or after the menu item, check the appropriate box. For this example, I put a separator before and after the new menu item.

For this example, I won't use the Global Toolbar Button or Global Keyboard Shortcut. I would use these if I wanted to add this action to a toolbar and assign an icon to it. Feel free to add a Global Toolbar Button and Global Keyboard Shortcut if like. You can also click on Help for additional information.

Press the "Next" button to go to the "Name, Icon, and Location" page of the Action wizard. On this page, specify:

Class Name: CheckSpellingAction
The name given to the Action class which will be generated by NetBeans.
Display Name: Spell Check
The text shown on the Edit menu, i.e. Edit | Spell Check

For this example I will leave the Icon as none. But, if I wanted an icon to be displayed on the Edit | Spell Check menu item, I could add one here. If you are following along and would like to add an icon, go ahead and add one.

Accept the defaults for Project and Package.

Press the "Finish" button.

After pressing the "Finish" button, the NetBeans IDE will generate a source file and place it in the NetBeans editor.

There's just 7 lines of code to write in Go the source file and add the following lines of code to the performAction() method:

Frame aFrame = WindowManager.getDefault().getMainWindow();
JDialog aJDialog = new JDialog(aFrame);
aJDialog.add(new CheckSpellingUI());
aJDialog.setTitle("Check Spelling");

Inserting the above code will generate a couple errors in the NetBeans editor. Both of these can be fixed by using Fix Imports (Alt-Shift-F). But, before doing Fix Imports, we need to tell NetBeans where to find the WindowManager class. You may have notice the WindowManager in the 7 lines code and recognized it is not part of the Swing API. The WindowManager class is part of the NetBeans API. The JDialog is part of Swing which is included in the JDK.

To tell NetBeans where to find the WindowManager class, we need to add the library that contains that class to this project. To do that, right click on the "SpellCheckPlugin" project name in the Projects window and select "Properties".

Select the "Libraries" category from the "Categories" on the left hand side of the Project Properties window. Then, click on the "Add" button in "Module Dependencies". This will launch a dialog where you can enter the class name "WindowManager". As you begin to type "WindowManager" in the "Filter" text field, you will see NetBeans is filtering the module API names, (see screen shot below where I have typed 'WindowM').

Press the OK button when the "Window System API" is shown as the selected module.

Your "SpellCheckPlugin" project properties window should look like the following:

Press the OK button on the project properties page.

Click in the editor window and press Alt-Shift-F to Fix Imports. The NetBeans IDE will ask you specify the class name to use for Frame. Select the java.awt.Frame as that package/class name and press "OK".

The errors in the NetBeans editor will go away after performing Fix Imports.

You are now ready to run the project. Select Run | Project, or press F6. This will build the project, create a new NetBeans plug-in, launch a second copy of NetBeans IDE with the new NetBeans plug-in installed and loaded in it.

When the second copy of the NetBeans IDE is launched, select the "Edit | Check Spelling" menu item to display the Matisse generated form you previewed at the beginning of this blog.

Click on the 'X' in the upper right corner of the display Check Spelling UI to kill the window. Sorry, I didn't implement the close window action in the Matisse generated Check Spelling UI. That's an exercise for you ;-)

How's that for creating a NetBeans plug-in by writing just seven lines of code? It also gives you a good feel of how quickly and easily you can build practical, compelling and usable NetBeans plug-ins.


Thursday Dec 15, 2005

Quickly jump to a method

In my last blog you saw how you can quickly navigate between files in the NetBeans IDE. To continue my blog theme of being more productive with NetBeans, today I was gonna show you how to quickly navigate to a method.

It seems my colleague, Gregg Sporar, has beat me to it.

That's ok. Gregg's excellent at sharing his favorite NetBeans IDE "productivity enhancers".

Go check out Gregg's blog and see how to quickly navigate to methods in NetBeans


Tuesday Dec 13, 2005

Quickly Navigating between files in NetBeans

Been a few days since I started the "increasing Java developer productivity with NetBeans" series.

I suspect there are some new NetBeans users who want to know how to quickly navigate between files they have open in the NetBeans IDE editor, especially when they have many files open, or the file name lengths are pretty long and the file name tabs at the top of the editor window quickly use up the available space.

This blog describes ways to quickly navigate between open files in the NetBeans IDE.

There are a couple options to quickly navigate between files. If you're a point and click kinda user, you can select "Window | Documents" from the NetBeans IDE main menu. If you're a key stroke kinda user, you can press "Shift-F4". In either case you're presented with a list of documents/files you have open in the editor. Here's a screen shot of that dialog.

Once you have this dialog in front of you, again if you are point and click kinda user, you can click on the file you want to view in the editor. If you are a key stroke kinda user, just start typing the name of the file you want to load in the editor. NetBeans will automatically pop-up a quick search dialog and begin to match a file name with the string you have entered. For example, I have a file named loaded in the NetBeans editor and I want to quickly navigate to a file named I can bring up the Documents dialog with Shift-F4 and begin typing 'Co' and the file named is immediately selected. You can see this in the screen shot below:

As soon as the file you want to navigate too is selected, you can press <Enter> to view it in the editor.

If you do not want to use the Documents dialog above, you can also move back forth between open files that pressing <Alt-right-arrow> and <Alt-left-arrow>. This too is a rapid way of migrating between files in the editor.


Thursday Dec 08, 2005

Creating NetBeans Plug-ins, by Edgar Silva

I just got a note from my good friend Edgar Silva who has put together a nice little flash demo illustrating how easy it is to create a NetBeans plugin. Edgar uses Matisse to create a simple timesheet user interface and incorporates that into NetBeans as a plug-in.

You catch the demo here.


NetBeans IDE: Adding/Changing JVM command line args

I had a question on how to add/change JVM command line args show up in my inbox from a good friend I met in Brazil, Keuller Magalhaes.

Somehow have the feeling there are other NetBeans users who have had the same question.

You can indeed set your favorite JVM command line args to use with NetBeans. Here's how to do it.

1. Go to the directory where you installed NetBeans IDE. I have NetBeans IDE 5.0 Beta2 installed at /opt/netbeans-5.0beta2
2. In that directory, go to the 'etc' directory. In my installation, that path would be, /opt/netbeans-5.0beta2/etc.
3. In that 'etc' directory, there is a file called 'netbeans.conf'.

Open that netbeans.conf file and you'll see something that looks like:

# ${HOME} will be replaced by JVM user.home system property

# options used by netbeans launcher by default, can be overridden by explicit
# command line switches
netbeans_default_options="-J-Xms32m -J-Xmx128m -J-XX:PermSize=32m -J-XX:MaxPermSize=96m -J-ea -J-Dapple.laf.useScreenMenuBar=true"

# default location of J2SE JDK, can be overridden by using --jdkhome <dir> switch

# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)

You'll see there's a line for 'netbeans_default_options'. You can add or change your favorite JVM options there. For instance, here is the set of command line options I usually use:

netbeans_default_options="-J-Xms128m -J-Xmx384m -J-XX:NewRatio=20 -J-XX:+UseConcMarkSweepGC -J-XX:+UseParNewGC -J-XX:+CMSPermGenSweepingEnabled -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenPrecleaningEnabled -J-XX:PermSize=64m -J-XX:MaxPermSize=96m -J-Dswing.aatext=true"

Here's an explanation of the command line switches I use:
-J-Xms128m -> initial Java heap size
-J-Xmx384m -> max Java heap size
-J-XX:NewRatio=20 -> Ratio of old generation to young generation space
-J-XX:+UseConcMarkSweepGC -> use the concurrent old generation garbage collector
-J-XX:+UseParNewGC -> use the parallel young generation garbage collector
-J-XX:+CMSPermGenSweepingEnabled -> enable concurrent gc in permanent generation
-J-XX:+CMSClassUnloadingEnabled -> enable class unloading in permanent generation with the concurrent gc collector
-J-XX:+CMSPermGenPrecleaningEnabled -> enable pre-cleaning when using concurrent gc collector in permanent generation
-J-XX:PermSize=64m -> initial size of permanent generation space set to 64m
-J-XX:MaxPermSize=96m -> max size of permanent generation space set to 96m
-J-Dswing.aatext=true -> use font anti-aliasing

\* Keep in mind that I am running on a machine with 1G of RAM. However, these settings should work fine on a machine with 512m. Just keep an eye on swapping activity. If you can keep your system from swapping, you're responsiveness will be much better.

Also notice there is '-J' in front of the JVM command line args and in front of the system property '-Dswing.aatext=true'.

Wouldn't it be great to have a NetBeans plug-in that would let you edit this file from within the NetBeans IDE? That might be a great idea for a NetBeans plug-in for Desafio NetBeans!

Thanks for the question Keuller!

Wednesday Dec 07, 2005

Encapsulating Fields, aka generating Getters / Setters

Thought I would start a little blog series talking about some of the code generation features of the NetBeans IDE which should make NetBeans users more productive. It's likely that many of our NetBeans IDE users already know about some of these features. However, there's likely some new developers coming into the NetBeans community who are not aware of some of these capabilities.

To start things off, I thought I would look at a commonly overlooked code generation capability of encapsulating fields, or often times called getters and setters.

Both of these terms refer to the common workflow of taking a class variable, usually scoped with private access, and adding a method, usually scoped with public access, to 'set' or 'get' the value of a class variable.

Yeah, I know this probably is not ground shaking news to many developers. But, it may clear up any confusion as to the terms "encapsulate fields" versus "getters/setters".

In NetBeans IDE 5.0, there are a couple ways to encapsulate fields, or generate getters/setters.

One way is to use Refactor | Encapsulate Fields which can be selected from the context sensitive menu when you right click inside the NetBeans IDE editor or you can select Refactor | Encapsulate Fields from the main menu. Once you have selected Refactor | Encapsulate Fields, you can:
- specify which fields you would like to have getters and setters generated for
- specify field visibility
- specify accessor visibility
- whether to use the generated getter/setter when the field is accessible

Here's the UI presented when you select Refactor | Encapsulate Fields:

A second way to encapsulate fields or generate getters / setters is in the developer workflow where you declare class variable and would like to encapsulate that variable with a getter and/or setter.

Here's the typical workflow. Declare a class variable, after you press ';' to terminate the line and hit <Enter> to go to the next line, press <Control-Spacebar>. The NetBeans IDE will give you a set of options which will include a choice to generate a getter and setter for the class variable you just entered.

Here's a screenshot where I had just entered 'Menu itsMenu; <Enter> <Control-Spacebar>' in the NetBeans IDE editor:

As you can see, NetBeans IDE has given me a choice to create a getter or setter for the class variable I just created.





Top Tags
« June 2016