I have JLabel in a horizontally multi-valued JPanel. The JLabel machine changes width according to JPanel. If I insert a long line of text (for example, "aaaaaaaaaaaaaaaa"), JLabel does not truncate the text. Instead, the width of the dimensions changes to fit the text, causing an ugly resizing of the JPanel as well. Instead, I want my text to be truncated using elipse (...). The width of the JLabel should not be inherited from the length of the text, but only from the width of the JPanel.
source share