
The value of the alignment argument must be one of FlowLayout.LEFT, FlowLayout.RIGHT, FlowLayout.CENTER, FlowLayout.LEADING, or FlowLayout.TRAILING. Since the NullPointerException is a runtime exception, it doesnt need to be caught and handled explicitly in application code. Constructs a new FlowLayout with the specified alignment and a default 5-unit horizontal and vertical gap. I would like to fix the NPE, but just I am not able.Įxception in thread "main" Īnd this is the calculator, I started to modify a bit to play with the code, thanks. You get NullPointerExceptions and if you follow the exception trace I believe you will find that one of those lines is the guilty one: Icon bug1 new ImageIcon( getClass().getResource( 'bug1.gif' )) Icon bug2 new ImageIcon( getClass().getResource( 'bug2. The is a runtime exception in Java that occurs when a variable is accessed which is not pointing to any object and refers to nothing or null. Some days ago, i saw a nice example of calculator on these pages, after I imported on Eclipse I understood, that what i needed was a nice tutorial to understand it better, so I found one really cool,
