Example usage for javax.swing JButton JButton

List of usage examples for javax.swing JButton JButton

Introduction

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

Prototype

public JButton(Action a) 

Source Link

Document

Creates a button where properties are taken from the Action supplied.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JButton topComponent = new JButton("top");
    JButton bottomComponent = new JButton("bottom");

    JSplitPane vpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComponent, bottomComponent);

    boolean b = vpane.isContinuousLayout(); // false by default

    // Set the split pane to continuously resize the child components which the divider is dragged
    vpane.setContinuousLayout(true);//from   w  ww. j  a v  a2  s .  com
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JButton leftComponent = new JButton("left");
    JButton rightComponent = new JButton("right");
    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent);
    double weight = pane.getResizeWeight(); // 0.0 by default

    weight = 1D;/*from w  w w. j av a 2s. c  o  m*/
    pane.setResizeWeight(weight);

    weight = .5D;
    pane.setResizeWeight(weight);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JButton leftComponent = new JButton("left");
    JButton rightComponent = new JButton("right");
    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent);

    int loc = pane.getDividerLocation();

    loc = (int) ((pane.getBounds().getWidth() - pane.getDividerSize()) / 2);
    pane.setDividerLocation(loc);//  w  w  w .j a  va 2 s. c  o  m

    double propLoc = .5D;
    pane.setDividerLocation(propLoc);
}

From source file:Main.java

public static void main(final String args[]) {
    JButton button = new JButton("Text Button");
    button.setMnemonic(KeyEvent.VK_B);

    JOptionPane.showMessageDialog(null, button);
}

From source file:Main.java

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

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/*from ww w  . j  a v  a 2  s.co  m*/
    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);/*  www . j a v a2  s.co 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");
    System.out.println(jb.getMnemonic());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/*  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.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 JButton("Press Me");
    System.out.println(jb.getSelectedIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/* ww w.j ava  2 s .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.getRolloverSelectedIcon());

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