Example usage for javax.swing JFrame pack

List of usage examples for javax.swing JFrame pack

Introduction

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

Prototype

@SuppressWarnings("deprecation")
public void pack() 

Source Link

Document

Causes this Window to be sized to fit the preferred size and layouts of its subcomponents.

Usage

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setDisplayedMnemonicIndex(1);/*  www.  j  a v  a  2  s . c o m*/

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    jb.setBorderPainted(false);//from  w w  w. ja  v a2  s. c  o m

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    System.out.println(jb.getDisabledSelectedIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);//from w w  w.  j  av a 2  s .  c  o  m
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setFocusPainted(false);//from   w  ww.j a va  2 s . com

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    System.out.println(jb.getMnemonic());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);//from   ww w .  ja  va 2s.c  om
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    System.out.println(jb.getRolloverIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/*from w w w .  j a  v  a 2s  .c om*/
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setMnemonic('P');

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/*  w  ww .  ja  v  a  2s .c om*/
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    System.out.println(jb.getDisplayedMnemonicIndex());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);//from w  w  w. j  ava  2 s . com
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    System.out.println(jb.getSelectedIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/*from   w w  w .  jav  a 2 s  .c o  m*/
    f.pack();
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    System.out.println(jb.getRolloverSelectedIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/*from  w  ww  . j  a v a 2 s .c o  m*/
    f.pack();
    f.setVisible(true);
}