Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package name1;
- import javax.swing.*;
- import javax.swing.JOptionPane;
- public class Name1 {
- static String LABEL_TEXT = JOptionPane.showInputDialog("Enter your name.");
- JFrame frame;
- JPanel contentPane;
- JLabel label;
- public Name1(){
- frame = new JFrame("Name");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- contentPane = new JPanel();
- label = new JLabel(LABEL_TEXT);
- contentPane.add(label);
- frame.setContentPane(contentPane);
- frame.pack();
- frame.setVisible(true);
- }
- private static void runGUI() {
- JFrame.setDefaultLookAndFeelDecorated(true);
- Name1 name = new Name1();
- }
- public static void main(String[] args) {
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- runGUI();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement