Example usage for javax.swing JButton addActionListener

List of usage examples for javax.swing JButton addActionListener

Introduction

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

Prototype

public void addActionListener(ActionListener l) 

Source Link

Document

Adds an ActionListener to the button.

Usage

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);/*ww w. j a  v  a  2 s. c o m*/
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    System.out.println(card.getLayoutAlignmentY(this));
}

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);//ww  w  . j  a  va 2s  .c  o m
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    card.first(this);
}

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);/*from   ww  w.  jav a 2  s.c  o m*/
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    System.out.println(card.maximumLayoutSize(this));
}

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);/* w w w. ja  v a  2 s . co m*/
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    System.out.println(card.toString());
}

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);/*from  w ww. j a v a  2  s. c o m*/
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    card.previous(this);
}

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);/*from   www  .  j a v  a2 s .  c o m*/
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    card.layoutContainer(this);
}

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);/*w  w w  .ja v  a2s  . c  o  m*/
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    System.out.println(card.minimumLayoutSize(this));
}

From source file:Main.java

public TestPane() {
    setLayout(new BorderLayout());
    tree = new JTree();
    File rootFile = new File(".");
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(rootFile);
    model = new DefaultTreeModel(root);

    tree.setModel(model);/*from  w ww .j  ava2 s  .com*/
    tree.setRootVisible(true);
    tree.setShowsRootHandles(true);

    add(new JScrollPane(tree));

    JButton load = new JButton("Load");
    add(load, BorderLayout.SOUTH);

    load.addActionListener(e -> {
        DefaultMutableTreeNode r = (DefaultMutableTreeNode) model.getRoot();
        root.removeAllChildren();
        model.reload();
        File f = (File) r.getUserObject();
        addFiles(f, model, r);
        tree.expandPath(new TreePath(r));
    });
}

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);/*from   w w  w. jav a  2s .  c  o m*/
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    card.invalidateLayout(this);
}

From source file:Main.java

public CardLayoutPanel() {
    setLayout(card);//  ww w. j  av a2 s  .c  o m
    JButton button;
    for (int i = 1; i <= 6; i++) {
        add(button = new JButton("Press " + i), "Card" + i);
        button.addActionListener(this);
    }
    card.next(this);
}