How to get Netbeans GUI Builder to not auto-generate fully qualified class names for components

StackOverflow https://stackoverflow.com/questions/21360252

سؤال

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 !

هل كانت مفيدة؟

المحلول

"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.

نصائح أخرى

Import your resources.

import javax.swing.*;

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top