Example usage for javax.swing JFrame setVisible

List of usage examples for javax.swing JFrame setVisible

Introduction

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

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Window depending on the value of parameter b .

Usage

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed X"), "none");

    JFrame f = new JFrame();
    f.add(component);/* www.  j a  v a  2  s  .c om*/

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("typed $"), "actionName");

    JFrame f = new JFrame();
    f.add(component);/* w w w . j ava 2 s  .c  o m*/

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] a) {
    JFrame f = new JFrame();
    f.add(new Main());
    f.setSize(300, 300);// w  ww  . j  a v a2s  . com
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(new Character(' '), 0),
            "actionName");

    JFrame f = new JFrame();
    f.add(component);/*from  w  w  w . j  a v  a 2 s . co  m*/

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) {
    JTextField component = new JTextField(10);

    component.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("shift pressed SPACE"),
            "actionName");

    JFrame f = new JFrame();
    f.add(component);//from w  w w . j  av a  2s.c om

    f.setSize(300, 300);

    f.setVisible(true);

}

From source file:Main.java

public static void main(String args[]) {
    JTable table = new JTable(22, 5);
    table.setPreferredScrollableViewportSize(new Dimension(400, 300));
    final JScrollPane scrollPane = new JScrollPane(table);
    JButton cornerButton = new JButton("#");
    scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER, cornerButton);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    JFrame frame = new JFrame();
    frame.add(scrollPane);//w  w w  . j a  v a  2s. c  o m
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTextField component = new JTextField();
    component.addFocusListener(new MyFocusListener());
    JFrame f = new JFrame();

    f.add(component);/*from  w  w  w.  j a v  a  2s.c om*/
    f.setSize(300, 300);
    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTextField component = new JTextField();
    component.addMouseMotionListener(new MyMouseMotionListener());
    JFrame f = new JFrame();

    f.add(component);/*from  w  ww .j  av  a 2  s .  co  m*/
    f.setSize(300, 300);
    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTextField component = new JTextField();
    component.addKeyListener(new MyKeyListener());

    JFrame f = new JFrame();

    f.add(component);/* w w  w .  j  a va  2s. c  o m*/
    f.setSize(300, 300);
    f.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {

    JFrame frame = new JFrame();
    frame.setLayout(new FlowLayout());
    frame.setVisible(true);

    JButton button1 = new JButton("");
    JButton button2 = new JButton("");

    frame.getContentPane().add(button1);
    frame.getContentPane().add(button2);

    button1.addActionListener(e -> {/*  w  w w . j  a  v a2 s. c  o  m*/
        System.out.println("Lambda");
    });

    button2.addActionListener(Main::doSomething);

}