-1

how can i use shorter code like eclipse in netbeans while using GUI Builder? for example

Jbutton btnCalculate = new javax.swing.JButton();

is generated automatically but i want shorter code like in eclipse

Jbutton btnCalculate = new JButton();

While creating a button !

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
dip
  • 3,548
  • 3
  • 24
  • 36

2 Answers2

5

"how can i use shorter code like eclipse in netbeans while using swing designer? "

  1. Go to Tools -> Options
  2. Click Java Button
  3. Click GUI Builder tab
  4. De-select Generate Fully Qualified Name of Classes

As you Drag and Drop components, imports will be added for you.

Also, if you want to hand code a component that has not been imported yet, just hit Shift + Ctrl + I to resolve all imports.

There is also a per-form option: select the root node in Inspector window and see Generate Full Classnames property in Properties window.

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
  • thanks @peterSmith it worked ! and the changes will work for only on new GUI elements created ! – dip Jan 26 '14 at 06:29
2

Import your resources.

import javax.swing.*;

And note that in the second example, btnCalculate is never declared, like in the first.

Matt Clark
  • 27,671
  • 19
  • 68
  • 123
  • yea i got it ! automated generator generated codes like in first code ! and i tried to add import line but it says unused import! – dip Jan 26 '14 at 05:58