import javax.imageio.*; import java.awt.image.*; import java.awt.event.*; import java.awt.*; import java.security.NoSuchAlgorithmException; import java.security.MessageDigest; import java.lang.reflect.*; import java.net.*; import java.io.*; import javax.swing.text.*; import javax.swing.event.*; import javax.swing.*; import java.util.concurrent.*; import java.util.regex.*; import java.util.List; import java.util.zip.*; import java.util.*; public class main { static String html = "\n Bold and italic.\n "; public static void main(String[] args) throws Exception { makeFrame(new JLabel(html.trim())); // trim is important! } static void makeFrame(Component content) { JFrame frame = new JFrame("JavaX"); frame.getContentPane().add(content); frame.setBounds(300, 100, 500, 400); frame.setVisible(true); exitOnFrameClose(frame); } static void exitOnFrameClose(JFrame frame) { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }