Example usage for javax.swing JFrame setTitle

List of usage examples for javax.swing JFrame setTitle

Introduction

In this page you can find the example usage for javax.swing JFrame setTitle.

Prototype

public void setTitle(String title) 

Source Link

Document

Sets the title for this frame to the specified string.

Usage

From source file:JFramePack.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame();
    frame.setTitle("My First Swing Application");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel("Welcome");
    frame.add(label);/*ww  w  . java2s  .co m*/
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame();
    frame.setTitle("JLabel Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel("First Name");
    label.setFont(new Font("Courier New", Font.ITALIC, 12));
    label.setForeground(Color.GRAY);

    frame.add(label);//from  w  w w.  ja  v  a2 s  .  c  om
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame();
    frame.setTitle("JLabel Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ImageIcon imageIcon = new ImageIcon("yourFile.gif");

    JLabel label = new JLabel("Mixed", imageIcon, SwingConstants.RIGHT);

    frame.add(label);/*ww w.  j av a 2s.c  om*/
    frame.pack();
    frame.setVisible(true);
}

From source file:SimpleDnD.java

public static void main(String[] args) {
    JTextField field = new JTextField(10);
    JButton button = new JButton("Button");
    JFrame f = new JFrame();
    f.setTitle("Simple Drag & Drop");

    f.setLayout(new FlowLayout());
    f.add(button);// w  ww.j a v  a 2s .c  o m
    f.add(field);

    field.setDragEnabled(true);
    button.setTransferHandler(new TransferHandler("text"));

    f.setSize(330, 150);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:NotHelloWorldPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("NotHelloWorld");
    frame.setSize(300, 200);// ww w .j a  v a  2 s  . co  m
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    Container contentPane = frame.getContentPane();
    contentPane.add(new NotHelloWorldPanel());

    frame.show();
}

From source file:JDK6TextComponentDemo.java

public static void main(String[] args) throws Exception {
    final JTextArea textArea = new JTextArea();
    textArea.setText("text");
    JScrollPane jScrollPane = new JScrollPane(textArea);
    final MessageFormat header = new MessageFormat("My Header");
    final MessageFormat footer = new MessageFormat("My Footer");

    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(jScrollPane, BorderLayout.CENTER);

    JFrame frame = new JFrame();
    frame.setTitle("Text-component Printing Demo");
    frame.setSize(400, 200);/*w  w  w. j  av a 2s . com*/
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setContentPane(contentPane);
    frame.setVisible(true);
    textArea.print(header, footer, true, null, null, true);

}

From source file:DrawRectPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("DrawRect");
    frame.setSize(300, 200);//  w ww  .  ja  v a  2  s  .  c o m
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    Container contentPane = frame.getContentPane();
    contentPane.add(new DrawRectPanel());

    frame.show();
}

From source file:XORPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("XOR");
    frame.setSize(300, 200);//from ww w  .ja va 2  s .c  om
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    Container contentPane = frame.getContentPane();
    contentPane.add(new XORPanel());

    frame.show();
}

From source file:DrawPolyPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("DrawPoly");
    frame.setSize(350, 250);//from  ww w  .  j a v  a2  s.  co m
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    Container contentPane = frame.getContentPane();
    contentPane.add(new DrawPolyPanel());

    frame.show();
}

From source file:FillRectPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("FillRect");
    frame.setSize(300, 200);//  w w w  .j a  v a 2 s .  c  o m
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    Container contentPane = frame.getContentPane();
    contentPane.add(new FillRectPanel());

    frame.show();
}