How to show JLabel ellipsis in MigLayout?
java, layout, miglayout, swing
Solution
A JLabel has a minimum size that is roughly (or exactly, don't remember) the same as its preferred size. MigLayout only shrinks a component down to its min. So you have to add a component constraint that allows sizing smaller than its minSize:
content.add(label, "wmin 10lp");
Problem
Using the default layout manager, the JLabel shows its ellipsis when the frame is resized. As illustrated by: ``` public static void main(String[] args) { final JFrame jFrame = new JFrame("JLabel, show me your ellipsis!"); jFrame.getContentPane().add(new JLabel("Sure darling! Shrink me and I'll show you")); jFrame.pack(); jFrame.setVisible(true); } ``` However, MigLayout does not display such behaviour! ``` public static void main(String[] args) { final JFrame jFrame = new JFrame("JLabel, show me your ellipsis!"); jFrame.getContentPane().setLayout(new MigLayout()); jFrame.getContentPane().add(new JLabel("Nope! I just do not know you well enough!")); jFrame.pack(); jFrame.setVisible(true); } ``` I tried all the layout/component constraint I could think of. Does anybody know if such thing is even possible in Mig?