Skip to content

Instantly share code, notes, and snippets.

@TheIndifferent
Created June 20, 2016 13:25
Show Gist options
  • Save TheIndifferent/847b702d762e6b26903d2f485032edd2 to your computer and use it in GitHub Desktop.
Save TheIndifferent/847b702d762e6b26903d2f485032edd2 to your computer and use it in GitHub Desktop.
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
public class MinimalLabel implements Runnable {
public static void main(String[] args) {
SwingUtilities.invokeLater(new MinimalLabel());
}
@Override
public void run() {
JLabel label = new JLabel("the quick brown fox jumps over the lazy dog");
label.setFont(new Font("DejaVu Sans Mono", Font.PLAIN, 12));
JPanel contentPane = new JPanel(new GridLayout(1, 1));
contentPane.setBorder(new EmptyBorder(10, 10, 10, 10));
contentPane.add(label);
JFrame frame = new JFrame("minimal label");
frame.setContentPane(contentPane);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment