Netbeans: How to specify the width of JLabel?

Design some HTML that neatly divides the text into two halves - a table with one row and two cells would probably do the trick. Then stick that entire HTML into one label.

Whaaaaaaaaattt?! – James Goodwin Oct 22 at 19:40 @JamesGoodwin Yeees!(That is the most intelligent reply I can muster to your vague, drawn out enquiry.) – Andrew Thompson Oct 22 at 19:45 I don't like it (please ignore that my view), in other hands works, bump +1 – mKorbel Oct 22 at 21:19 +1 for novelty. :-) – trashgod Oct 220 at 1:29.

The default layout of JPanel is Flowlayout, which uses the label's preferred size—just big enough to hold the text. Instead, use new GridLayout(1, 0) to get one row with equal sized columns. Add your label followed by a second, empty label.

Use setOpaque() and setBackground() to see the effect. Several commenters correctly observe that using NetBeans' GUI design tool may be premature. It's a tool, not a panacea.

Start by learning layouts. Paradoxically, one way to learn is to explore layouts in the designer itself. Just right-click on the relevant layout in the Inspector panel and choose Set Layout.

– Jame Oct 23 at 19:40 I've elaborated above. Snide maxim: Using a Smith-Corona doesn't make one a novelist. :-) – trashgod Oct 23 at 20:07.

Take a look at coderanch.com/t/343170/GUI/java/JLabel-d... I think i'll help you.

The answer you linked to is wrong Never-ever use anys of the setXXSize methods. Instead, use a decent LayoutManager. – kleopatra Oct 23 at 9:37 Thank you very much – bilash.

Saha Oct 23 at 9:44.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions