java - How small can that JLabel be? -


I have a JLabel that I want to draw a screen with some conversion applied to the graphics object.

I am trying to make JLABEL as a small waxing based on your text content.

What I'm trying to do is:

  setbound (0, 0, label.getMinus size (width), label.maximum minimum size () Height);  

Occasionally, this yield is elliptical and sometimes now. It really depends on the change (usually arbitrary scaling in an animation) being implemented.

Should I be thinking of "minimum size" with some obvious missing, do I get some round errors that are rolling down,

label. () UI is calculated by the representative and instead of content it is more to do with the layout and its chrome. Maybe you can try computing that the size should be based on text?

Something like this ...

  JLabel label = new jlab ("xx"); Int minWidth = ((int) (label.getFontMetrics (label.getFont ()). GetStringBounds (label.getText), label.getGraphics ()). GetWidth ()) + label.getInsets () .left + label.getInsets ().right);  

and similar to the height.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -