Example usage for javax.swing JFrame JFrame

List of usage examples for javax.swing JFrame JFrame

Introduction

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

Prototype

public JFrame() throws HeadlessException 

Source Link

Document

Constructs a new frame that is initially invisible.

Usage

From source file:Main.java

public static void main(String[] args) {
    JFrame aWindow = new JFrame();
    aWindow.setBounds(200, 200, 200, 200);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Cursor cursor = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
    System.out.println(cursor.toString());

    aWindow.setVisible(true);//from   ww  w.  j av a  2s  .com
}

From source file:Main.java

public static void main(String[] args) {
    JFrame aWindow = new JFrame();
    aWindow.setBounds(200, 200, 200, 200);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    aWindow.setCursor(Cursor.getDefaultCursor());
    aWindow.setVisible(true);//from   w  ww.  j av  a  2s  .com

    System.out.println(Cursor.getDefaultCursor().getName());
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLabel label = new JLabel("<html>bold <br> plain</html>");
    frame.add(label);//from  w  ww.  j ava 2  s .  c  om

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(new JSeparator(JSeparator.VERTICAL));

    frame.setSize(300, 200);//w ww.j a  va2s .  c  o  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    String htmlLabel = "<html><sup>HTML</sup> <sub><em>Label</em></sub><br>"
            + "<font color=\"#FF0080\"><u>Multi-line</u></font>";
    JLabel label = new JLabel(htmlLabel);
    frame.add(label);//from ww  w  .j a  v a 2s  .com

    frame.setSize(300, 200);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JSeparator sep = new JSeparator(JSeparator.VERTICAL);
    sep.setOrientation(JSeparator.VERTICAL);
    frame.add(sep);/*from w  w w  .  ja va 2  s  .co  m*/

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:ToolTipDemo.java

License:asdf

public static void main(String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton b = new JButton("Hello, World");
    frame.add(b, "Center");
    b.setToolTipText("asdf");
    frame.setSize(300, 200);// w ww  .  ja va2  s. c om
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    JTextArea ta = new JTextArea(5, 32);
    ta.setText("That's one small step for man...\nOne giant leap for mankind.");

    ta.setSelectionStart(10);//from w w w.  jav a  2 s  . c om

    ta.setSelectionEnd(20);

    f.getContentPane().add(ta);
    f.setSize(100, 100);
    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {

    JFrame frame = new JFrame();
    JLabel label = new JLabel("Label with image in Tooltip!");
    label.setToolTipText("<html><img src=\"" + Main.class.getResource("tooltip.gif") + "\"> Tooltip ");
    label.setHorizontalAlignment(JLabel.CENTER);
    frame.setContentPane(label);//from ww  w .  j a v a 2  s .c o  m
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(100, 100, 200, 100);
    frame.setVisible(true);

}

From source file:ConfirmPopUps.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    int result = JOptionPane.showConfirmDialog(frame, "Continue printing?");
    // JOptionPane.showInternalConfirmDialog(desktop, "Continue printing?");

    System.out.println(JOptionPane.CANCEL_OPTION == result);
}