🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16288

Re: JLabel wordwrap

#16288
From: peter theophanous
Date: Fri, 05 Mar 1999 00:00
35 lines
1675 bytes
JTextArea in the swing allows line wraping.
Here is some sample code.  hope it helps.

    JTextArea tblDescr = new JTextArea();
       ......
    tblDescr.setText("  table Description");
    tblDescr.setSelectedTextColor(new Color(255, 255, 204));
    hdrPanel.add(tblDescr, new XYConstraints(3, 46, 840, 32));
    tblDescr.setLineWrap(true);
    tblDescr.setRequestFocusEnabled(false);
    tblDescr.setText(getdisplaytext(query));
    tblDescr.setBackground(Color.lightGray);
    tblDescr.setFont(new Font("Courier", 1, 12));
    tblDescr.setEditable(false);


Nicolas Koulouris wrote:
> 
> Hello!
> 
> My question is pretty simple, i'm a Java beginner and enthusiast!
> 
> How can I get a long string to fit in the designed space of a JLabel? I
> could not find the right property. Or maybe another component allows
> it..
> 
> Thanks!
> --
> > Nicolas Koulouris, Quebec
> ****************************************
> * Computer science student             *
> * Etudiant en informatique             *
> ****************************************
> * mailto:nicolaskou@videotron.ca       *
> ****************************************
Technical Details
Message-ID: <36DFFA68.15AFBC9F@us.ibm.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36D5E434.8D123441@videotron.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,c5bd5b7969d1cde8
X-Google-Attributes: gidf74b3,public
From: peter theophanous <peterth@us.ibm.com>
Subject: Re: JLabel wordwrap
Date: 1999/03/05
Message-ID: <36DFFA68.15AFBC9F@us.ibm.com>
X-Deja-AN: 451590815
Content-Transfer-Encoding: 7bit
References: <36D5E434.8D123441@videotron.ca>
Content-Type: text/plain; charset=us-ascii
Organization: IBM Global Network
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language