package test; import javax.swing.*; import java.awt.*; public class HelloWorldSwing { private static final String STR = "Hello World [6923] prh tk rn ck"; private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("HelloWorldSwing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Add the ubiquitous "Hello World" label. JLabel label = new JLabel(STR); label.setFont(label.getFont()); Container contentPane = frame.getContentPane(); contentPane.add(label, BorderLayout.NORTH); //Add bold label. JLabel boldLabel = new JLabel(STR); Font f = boldLabel.getFont(); boldLabel.setFont(f.deriveFont(f.getStyle() | Font.BOLD)); contentPane.add(boldLabel, BorderLayout.SOUTH); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. UIManager.put("swing.boldMetal", Boolean.FALSE); javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }