// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.awt.BorderLayout;
import java.awt.Font;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;

public class ImageAndText extends JFrame {
    public ImageAndText() {
        setTitle("Image and text");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        getContentPane().setLayout(new BorderLayout());
        JLabel lbl = new JLabel();
        lbl.setIcon(new ImageIcon("/xxxx.jpg"));
        lbl.setText("Test");
        lbl.setHorizontalTextPosition(JLabel.CENTER);
        lbl.setVerticalTextPosition(JLabel.CENTER);
        lbl.setFont(new Font("Dialog", Font.PLAIN, 72));
        getContentPane().add(lbl);
        pack();
    }
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JFrame f = new ImageAndText();
                f.setVisible(true);
            }
        });
    }
}
