Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39331

Re: JLabel Text Cutoff

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: JLabel Text Cutoff
Date 2020-03-04 13:25 -0500
Organization A noiseless patient Spider
Message-ID <r3orq6$s67$1@dont-email.me> (permalink)
References <c906ffa0-dddc-452b-8a59-afa3ace910d3@googlegroups.com>

Show all headers | View raw


On 3/4/2020 1:06 PM, Eric Douglas wrote:
> Is there an easy way to show text on a JLabel cutoff from the left?
> I've tried every method and parameter I can think of but when the text runs out of the control it just wants to cut it off from the right.

     Haven't tried it myself, but have you looked at
setHorizontalTextPosition()?  Also, try setComponentOrientation().

     If those don't work out and you really need the effect,
you could (I guess) get the label's Font and FontMetrics,
measure the as-rendered width of the string, and set the
label's text to as much of the tail as will fit.  (If I
were doing this a lot, I'd subclass JLabel.)

-- 
esosman@comcast-dot-net.invalid
Three hundred twenty-two days to go.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

JLabel Text Cutoff Eric Douglas <e.d.programmer@gmail.com> - 2020-03-04 10:06 -0800
  Re: JLabel Text Cutoff Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2020-03-04 19:23 +0100
    Re: JLabel Text Cutoff Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2020-03-04 19:23 +0100
    Re: JLabel Text Cutoff Eric Douglas <e.d.programmer@gmail.com> - 2020-03-04 12:15 -0800
      Re: JLabel Text Cutoff Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2020-03-04 21:39 +0100
        Re: JLabel Text Cutoff Eric Douglas <e.d.programmer@gmail.com> - 2020-03-04 12:59 -0800
          Re: JLabel Text Cutoff Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2020-03-04 22:26 +0100
  Re: JLabel Text Cutoff Eric Sosman <esosman@comcast-dot-net.invalid> - 2020-03-04 13:25 -0500

csiph-web