Surround the string with <html></html>
and break the lines with <br/>
.
JLabel l = new JLabel("<html>Hello World!<br/>blahblahblah</html>", SwingConstants.CENTER);
More Related Contents:
- make a JLabel wrap it’s text by setting a max width
- Java: Linebreaks in JLabels?
- Better AI for Tic & Toe [closed]
- Netbeans GUI editor generating its own incomprehensible code
- Java and GUI – Where do ActionListeners belong according to MVC pattern?
- Difference between validate(), revalidate() and invalidate() in Swing GUI
- java – How would I dynamically add swing component to gui on click?
- How returns XxxSize from JComponent(s) added to the JLabel
- Multiline text in JLabel
- Adding JPanels from other classes to the cardLayout
- Can I have a textfield inside a label?
- How to define multiple JButton actions from a different class
- Does adding a JLabel to a JPanel “hide” the JPanel?
- Drag and Drop custom object from JList into JLabel
- set and disable icons of JToggleButton
- Swing vs JavaFx for desktop applications [closed]
- List of Java Swing UI properties? [closed]
- Center JDialog over parent
- How to make Circle image Label in Java?
- Color fading algorithm?
- How do I set a JLabel’s background color?
- Moving JLabel to other JLabels – GUI
- JPanel Padding in Java
- Java rotating non-square JPanel component
- How can I make this JButton visible? When I have progressive scan background JWindow()?
- How to create JList with icon and text?
- How to right-justify icon in a JLabel?
- How do I refresh a GUI in Java?
- Customize JOptionPane Dialog
- Can I add a component to a specific grid cell when a GridLayout is used?