views:

39

answers:

1

Hi

Is there a possible way to override the paintComponent() method in the auto-generated GUI code in NetBeans? I managed to manually draw a graph without using the drag-and-drop components, and I need to make adjustments (e.g. adding radio button group) which I find really time consuming and tedious work. I created a GUI using the NetBean's drag-and-drop components, but I cannot edit them. Is it possible?

Pls give me a solution. Greatly apprecite any insight Many thanks in advance

+1  A: 

You can override the code used to create a component that you drag-and-drop onto a form in the NetBeans Swing UI 'builder'.

You can do the following:

  1. Select a component from the palette.
  2. Place the component.
  3. right click on the component and select the 'Customize code' item.
  4. Edit the code in the dialog that is displayed.

alt text

There is another way to customize the code, that is a bit more complex, that you may find useful.

When you drag-and-drop a component that you wish to customize, look at the Properties panel on the right-hand side of the layout editor. You can customize code by altering the Code properties, like "Custom Creation Code".

alt text

There is more info about this method in this answer: http://stackoverflow.com/questions/2438221/how-to-modify-add-code-to-the-initcomponents-method-in-java-on-net-beans/2439285#2439285

vkraemer