Example usage for java.awt.event ActionEvent ActionEvent

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

Introduction

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

Prototype

public ActionEvent(Object source, int id, String command) 

Source Link

Document

Constructs an ActionEvent object.

Usage

From source file:ColorMenu.java

public void doSelection() {
    fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, getActionCommand()));
}

From source file:org.panbox.desktop.common.gui.PairNewDeviceDialog.java

public PairNewDeviceDialog(JFrame parent, PanboxClient client, PairingInformation pInfo) {
    super(parent, true);
    initComponents();//w  ww  .  ja v a  2 s .  c  o  m

    this.client = client;
    this.pInfo = pInfo;

    pairingModeSelectionComboBoxActionPerformed(new ActionEvent(this, 0, "init"));

    setVisible(true);
}

From source file:com.anrisoftware.prefdialog.miscswing.lists.ActionList.java

private void fireAction() {
    actionListeners.fire().actionPerformed(new ActionEvent(list, ACTION_PERFORMED, command));
}

From source file:net.sf.jabref.gui.entryeditor.SimpleUrlDragDrop.java

@Override
public void drop(DropTargetDropEvent event) {
    Transferable tsf = event.getTransferable();
    event.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
    //try with an URL
    DataFlavor dataFlavor = null;
    try {//from w  ww.  j a va2s. c om
        dataFlavor = new DataFlavor("application/x-java-url; class=java.net.URL");
    } catch (ClassNotFoundException e) {
        LOGGER.warn("Could not find DropTargetDropEvent class", e);
    }
    try {
        URL url = (URL) tsf.getTransferData(dataFlavor);
        //insert URL
        editor.setText(url.toString());
        storeFieldAction.actionPerformed(new ActionEvent(editor, 0, ""));
    } catch (UnsupportedFlavorException nfe) {
        // if not an URL
        JOptionPane.showMessageDialog((Component) editor, Localization.lang("Operation not supported"),
                Localization.lang("Drag and Drop Error"), JOptionPane.ERROR_MESSAGE);
        LOGGER.warn("Could not perform drage and drop", nfe);
    } catch (IOException ioex) {
        LOGGER.warn("Could not perform drage and drop", ioex);
    }
}

From source file:org.photovault.swingui.tag.TagEditor2.java

private void fireActionEvent(String command) {
    ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, command);
    for (ActionListener l : actionListeners) {
        l.actionPerformed(e);//from  w w  w .j a v a  2  s  .co  m
    }
}

From source file:com.limegroup.gnutella.gui.tables.ActionIconAndNameEditor.java

protected void component_mousePressed(MouseEvent e) {
    if (action != null) {
        try {// w  w  w.  j  a  va 2  s  .  c  o  m
            action.actionPerformed(new ActionEvent(e.getSource(), e.getID(), ""));
        } catch (Throwable e1) {
            LOG.error("Error performing action", e1);
        }
    }
}

From source file:com.microsoft.alm.plugin.idea.common.ui.controls.HelpPanel.java

private void onPopupCommandEvent(final String command) {
    hideToolTip(true);//from w  w w .  j  a v a2 s  . c  o  m
    for (final ActionListener listener : listeners) {
        listener.actionPerformed(new ActionEvent(this, 0, command));
    }
}

From source file:org.piraso.ui.api.views.BaseEntryViewTopComponent.java

@Override
protected void refreshView() {
    synchronized (getTreeLock()) {
        clear();//from w  ww .  j a v a  2 s .c  o m
        components = new ArrayList<EntryTabView>();

        if (currentEntry != null) {
            components.add(new EntryTabView(new BaseMessageView(currentEntry)));
            components.addAll(EntryTabViewProviderManager.INSTANCE.getTabView(BaseEntryViewTopComponent.class,
                    currentEntry));
        }

        if (CollectionUtils.isNotEmpty(components)) {
            toolbar2.removeAll();
            toolbar.removeAll();

            if (components.size() > 1) {
                buttons = new JToggleButton[components.size()];

                ActionListener initialViewAction = null;
                for (int i = 0; i < components.size(); i++) {
                    EntryTabView view = components.get(i);
                    buttons[i] = new JToggleButton(view.getTitle());

                    buttonGroup1.add(buttons[i]);

                    ActionListener buttonListener = new SwitchEntryView(view, toolbar);
                    buttons[i].addActionListener(buttonListener);

                    if (initialViewAction == null) {
                        initialViewAction = buttonListener;
                        buttons[i].setSelected(true);
                    } else if (selectedTabTitle != null && selectedTabTitle.equals(view.getTitle())) {
                        initialViewAction = buttonListener;
                        buttons[i].setSelected(true);
                    }

                    toolbar.add(buttons[i]);
                }

                toolbar.add(jSeparator1);

                // fire initial action
                if (initialViewAction != null) {
                    initialViewAction.actionPerformed(new ActionEvent(this, 1, "initial"));
                }
                toolbar.setVisible(true);
                toolbar2.setVisible(false);
            } else {
                SwitchEntryView action = new SwitchEntryView(components.iterator().next(), toolbar2);
                action.actionPerformed(null);

                toolbar2.setVisible(true);
                toolbar.setVisible(false);
            }
        }
    }
}

From source file:net.sf.jabref.external.ExternalFilePanel.java

public ExternalFilePanel(final JabRefFrame frame, final MetaData metaData, final EntryEditor entryEditor,
        final String fieldName, final OpenFileFilter off, final FieldEditor editor) {

    this.frame = frame;
    this.metaData = metaData;
    this.off = off;
    this.entryEditor = entryEditor;

    setLayout(new GridLayout(2, 2));

    JButton browseBut = new JButton(Localization.lang("Browse"));
    JButton download = new JButton(Localization.lang("Download"));
    JButton auto = new JButton(Localization.lang("Auto"));
    JButton xmp = new JButton(Localization.lang("Write XMP"));
    xmp.setToolTipText(Localization.lang("Write BibtexEntry as XMP-metadata to PDF."));

    browseBut.addActionListener(new ActionListener() {

        @Override//from w  w w .j av  a  2 s .  c  o  m
        public void actionPerformed(ActionEvent e) {
            browseFile(fieldName, editor);
            // editor.setText(chosenValue);
            entryEditor.storeFieldAction.actionPerformed(new ActionEvent(editor, 0, ""));
        }
    });

    download.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            downLoadFile(fieldName, editor, frame);
        }
    });

    auto.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JabRefExecutorService.INSTANCE.execute(autoSetFile(fieldName, editor));
        }
    });
    xmp.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            pushXMP(fieldName, editor);
        }
    });

    add(browseBut);
    add(download);
    add(auto);
    add(xmp);

    // Add drag and drop support to the field
    if (editor != null) {
        ((JComponent) editor).setDropTarget(new DropTarget((Component) editor, DnDConstants.ACTION_NONE,
                new UrlDragDrop(entryEditor, frame, editor)));
    }
}

From source file:de.tor.tribes.ui.components.TimerPanel.java

private void fireRemoveTimerEvent(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fireRemoveTimerEvent
    listener.actionPerformed(new ActionEvent(this, 0, "RemoveTimer"));
}