Example usage for java.awt.event ActionEvent getSource

List of usage examples for java.awt.event ActionEvent getSource

Introduction

In this page you can find the example usage for java.awt.event ActionEvent getSource.

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:SplashScreen.java

/**
 * Open the splash screen and keep it open for the specified duration
 * or until close() is called explicitly.
 *///from   w  ww.  jav  a2  s  .c o m
public void open(int nMilliseconds) {
    if (image_ == null)
        return;

    Timer timer = new Timer(Integer.MAX_VALUE, new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            ((Timer) event.getSource()).stop();
            close();
        };
    });

    timer.setInitialDelay(nMilliseconds);
    timer.start();

    setBounds(x_, y_, width_, height_);
    setVisible(true);
}

From source file:org.encog.workbench.tabs.visualize.weights.AnalyzeWeightsTab.java

public void actionPerformed(ActionEvent e) {
    if (e.getSource() == this.buttonClose) {
        this.dispose();
    }//from w  w w  .j  a  va2s .  co  m

}

From source file:com.quiltplayer.controller.ImageController.java

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals(EVENT_CHANGE_COVER)) {
        final Album album = (Album) e.getSource();

        int imageCount = e.getID();

        // This should be set as primary
        LocalImage toFrontImage = album.getImages().get(imageCount);
        album.changeFrontImage(album, toFrontImage);

        frame.updateUI();/* www  .ja v a2  s. c  o  m*/
    }
}

From source file:be.tutul.naheulcraft.launcher.auth.LogInForm.java

public void actionPerformed(ActionEvent e) {
    if ((e.getSource() == this.usernameField) || (e.getSource() == this.passwordField))
        tryLogIn();/*from  w  w w. j a v  a2s . c  o m*/
}

From source file:com.stefanbrenner.droplet.ui.AddDeviceDialog.java

@Override
public void actionPerformed(final ActionEvent event) {
    Object source = event.getSource();
    if (ObjectUtils.equals(btnValve, source)) {
        droplet.addDevice(new Valve());
    } else if (ObjectUtils.equals(btnFlash, source)) {
        droplet.addDevice(new Flash());
    } else if (ObjectUtils.equals(btnCamera, source)) {
        droplet.addDevice(new Camera());
    } else if (ObjectUtils.equals(btnButton, source)) {
        droplet.addDevice(new Button());
    } else if (ObjectUtils.equals(btnClose, source)) {
        setVisible(false);/*from  ww w .  ja v  a  2 s .  co m*/
    }
}

From source file:SimpleSwitch.java

/**
 * Process the AWT events and perform the appropriate actions. If the exit
 * button has been pressed, quit the application, if the box button has been
 * pressed, select the box child of the switch and if its the cone button
 * select the cone child.//from  w  ww. ja  va 2 s .c  o m
 * 
 * @param e
 *            ActionEvent that is to be processed.
 */
public void actionPerformed(ActionEvent e) {
    if (e.getSource() == exitButton) {
        dispose();
        System.exit(0);
    } else if (e.getSource() == boxButton) {
        firstSwitch.setWhichChild(0);
    } else if (e.getSource() == coneButton) {
        firstSwitch.setWhichChild(1);
    }
}

From source file:kuvalataaja.user_interface.GUI.java

@Override
public void actionPerformed(ActionEvent ae) {
    if (ae.getSource() == runButton) {
        runTheProgram();/* w  w  w  . j a  va  2  s .  c  om*/
        textArea.setText("All done! Run again or exit?");
    } else {
        openTutorial();
    }
    //        else if (ae.getSource() == testButton) {
    //            runTest();
    //        }
}

From source file:TArea.java

public void actionPerformed(ActionEvent e) {
    JRadioButton temp = (JRadioButton) e.getSource();

    if (temp.equals(addButton)) {
        canvas.area1 = new Area(canvas.gp);
        canvas.area1.add(canvas.area2);/*from www  .  j a  va 2s.  c  om*/
        canvas.drawFlag = false;
        canvas.fillFlag = true;
        canvas.repaint();
    } else if (temp.equals(subtractButton)) {
        canvas.area1 = new Area(canvas.gp);
        canvas.area1.subtract(canvas.area2);
        canvas.drawFlag = false;
        canvas.fillFlag = true;
        canvas.repaint();
    } else if (temp.equals(intersectButton)) {
        canvas.area1 = new Area(canvas.gp);
        canvas.area1.intersect(canvas.area2);
        canvas.drawFlag = false;
        canvas.fillFlag = true;
        canvas.repaint();
    } else if (temp.equals(exclusiveORButton)) {
        canvas.area1 = new Area(canvas.gp);
        canvas.area1.exclusiveOr(canvas.area2);
        canvas.drawFlag = false;
        canvas.fillFlag = true;
        canvas.repaint();
    } else if (temp.equals(resetButton)) {
        if (canvas.drawFlag == false) {
            canvas.area1 = new Area(canvas.gp);
            canvas.drawFlag = true;
            canvas.fillFlag = false;
            canvas.repaint();
        }
    }
}

From source file:cl.almejo.vsim.gui.actions.preferences.ColorPreferences.java

private JComboBox<String> createSchemeCombobox() {
    JComboBox<String> _comboBox = new JComboBox<String>(ColorScheme.getNames());
    _comboBox.addActionListener(new ActionListener() {
        @Override/*from ww w  . j  a v  a 2  s  .  co  m*/
        public void actionPerformed(ActionEvent e) {
            JComboBox combobox = (JComboBox) e.getSource();
            ColorScheme.setCurrent((String) combobox.getSelectedItem());
        }
    });
    _comboBox.setSelectedItem("default");
    return _comboBox;
}

From source file:com.db2eshop.gui.dialog.ConfirmCancelDialog.java

/** {@inheritDoc} */
@Override//www.  j a  va2  s  .  c  o m
public void actionPerformed(ActionEvent e) {
    if (confirmButton.equals(e.getSource())) {
        try {
            onConfirm();
            this.setVisible(false);
        } catch (Exception exception) {
            onError(exception);
        }
    } else if (cancelButton.equals(e.getSource())) {
        try {
            onCancel();
            this.setVisible(false);
        } catch (Exception exception) {
            onError(exception);
        }
    }
}