Karue Benson Karue
Karue Benson Karue

Reputation: 1026

How Can I Center JLabel using NetBeans Gui Builder?

After long time i have decided to switch back to Java NetBeans Gui builder. I want to create Management System and keep it professional in terms of User Interface. However am having problem centering the JLabel. My Label takes the full width of the panel and panel is resizable. I want my Label to be resizable and to be centered no matter the size my window. Is this possible? Please I don't want hard coding am using netbeans Gui builder. How can I achieve this? For your information my reputations are too low to post images so nothing to show right now.....

Upvotes: 1

Views: 5635

Answers (1)

WillShackleford
WillShackleford

Reputation: 7018

This seemed to work for me.

  1. Drag a panel into your design
  2. Right-click the panel and check the menu checkboxes : Auto Resizing-> Horizontal , and Auto Resizing -> Vertical
  3. Drag a label as the only component
  4. Select the panel. Right-click -> Set Layout -> Border Layout
  5. Select the label. Right-click -> Properties
  6. Choose Center for the both horizontalAlignment and verticalAlignment.

Upvotes: 4

Related Questions