There are many controls in the palette tab of NetBeans IDE having specific properties of its own. Those controls can easily be added, resize and delete from the frame, while programming in java. This article have some steps to do these tasks in simple way.
When you can add controls to your frame, you might find strange behavior of IDE regarding component positioning and sizing. (This is because of Free Design layout manager.) In order to have full control on component's positioning and sizing, you need to know about Layout Managers. The layout of components on a frame (or panel) is controlled by a layout manager, which determines the final placement of each component. Layout Managers will be covered in next articles.
Another way of removing a control is:
To resize a control, select it first and then use its sizing handle to resize it. That is, move the mouse pointer over sizing handles. The mouse pointer will change to double-headed arrow (↔). See the fig. Now drag the sizing handle to desired new position and control will be resized.
While adding, laying out and resizing controls on the frame, if you are not happy with the default behavior of rearranging/resizing of the control, then you may done one thing. Before you put any controls on the form, right click your frame in Design View and select Set Layout. From the sub menu that appears, select Absolute Layout.
To draw a control on Frame/Window in NetBeans
- Click the desire control’s icon on the Palette. (Say, for example, we want to draw a label. For this we shall first click at its icon on the palette.)
- Now drag it to desired location in your Frame/Window.
- Se the control that you selected, now appear on your frame/window.
When you can add controls to your frame, you might find strange behavior of IDE regarding component positioning and sizing. (This is because of Free Design layout manager.) In order to have full control on component's positioning and sizing, you need to know about Layout Managers. The layout of components on a frame (or panel) is controlled by a layout manager, which determines the final placement of each component. Layout Managers will be covered in next articles.
To Remove a Control from the Frame/window in NetBeans
- Select the control to be deleted, by clicking it. See, the controls appear selected, notice the rectangular boxes at corners and sides.
- Press Del (or Delete) key. The selected control gets removed.
Another way of removing a control is:
- Select it
- Right-click on it (i.e., after selecting click the right mouse-key).
- A context menu paper. Select delete command from it.
To Move/Resize a control in NetBeans
To move a control you have drawn, click the object in the middle and drag it to the new location. Now release the mouse button.To resize a control, select it first and then use its sizing handle to resize it. That is, move the mouse pointer over sizing handles. The mouse pointer will change to double-headed arrow (↔). See the fig. Now drag the sizing handle to desired new position and control will be resized.
While adding, laying out and resizing controls on the frame, if you are not happy with the default behavior of rearranging/resizing of the control, then you may done one thing. Before you put any controls on the form, right click your frame in Design View and select Set Layout. From the sub menu that appears, select Absolute Layout.
Tidak ada komentar:
Posting Komentar