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:org.tinymediamanager.ui.tvshows.TvShowExtendedSearchPanel.java

public TvShowExtendedSearchPanel(TvShowTreeModel model, JTree tree) {
    super();//from  www.j a va  2 s.c  om
    setOpaque(false);
    shadowAlpha = 100;
    arcs = new Dimension(10, 10);

    this.tvShowTreeModel = model;
    this.tree = tree;

    // add a dummy mouse listener to prevent clicking through
    addMouseListener(new MouseAdapter() {
    });

    listCheckListener = new ListCheckListener() {
        @Override
        public void removeCheck(ListEvent event) {
            actionFilter.actionPerformed(new ActionEvent(event.getSource(), 1, "checked"));
        }

        @Override
        public void addCheck(ListEvent event) {
            actionFilter.actionPerformed(new ActionEvent(event.getSource(), 1, "checked"));
        }
    };

    setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.UNRELATED_GAP_ROWSPEC, }));

    JLabel lblFilterBy = new JLabel(BUNDLE.getString("movieextendedsearch.filterby")); //$NON-NLS-1$
    setComponentFont(lblFilterBy);
    add(lblFilterBy, "2, 2, 3, 1");

    cbFilterNewEpisodes = new JCheckBox("");
    cbFilterNewEpisodes.setAction(actionFilter);
    add(cbFilterNewEpisodes, "2, 4");

    JLabel lblNewEpisodes = new JLabel(BUNDLE.getString("movieextendedsearch.newepisodes")); //$NON-NLS-1$
    setComponentFont(lblNewEpisodes);
    add(lblNewEpisodes, "4, 4, right, default");

    cbFilterWatched = new JCheckBox("");
    cbFilterWatched.setAction(actionFilter);
    cbFilterWatched.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterWatched, "2, 5");

    JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$
    setComponentFont(lblWatched);
    add(lblWatched, "4, 5, right, default");

    cbWatched = new SmallComboBox(WatchedFlag.values());
    setComponentFont(cbWatched);
    cbWatched.setAction(actionFilter);
    add(cbWatched, "6, 5, fill, default");

    cbFilterGenres = new JCheckBox("");
    cbFilterGenres.setAction(actionFilter);
    cbFilterGenres.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterGenres, "2, 6");

    JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$
    setComponentFont(lblGenres);
    add(lblGenres, "4, 6, right, default");

    cbGenres = new SmallComboBox(MediaGenres.values());
    setComponentFont(cbGenres);
    cbGenres.setAction(actionFilter);
    add(cbGenres, "6, 6, fill, default");

    cbFilterCast = new JCheckBox("");
    cbFilterCast.setAction(actionFilter);
    cbFilterCast.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterCast, "2, 7");

    JLabel lblCastMember = new JLabel(BUNDLE.getString("movieextendedsearch.cast")); //$NON-NLS-1$
    setComponentFont(lblCastMember);
    add(lblCastMember, "4, 7, right, default");

    tfCastMember = new JTextField();
    setComponentFont(tfCastMember);
    tfCastMember.setBorder(new SmallTextFieldBorder());
    add(tfCastMember, "6, 7, fill, default");
    tfCastMember.setColumns(10);
    tfCastMember.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void changedUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            actionFilter.actionPerformed(null);
        }
    });

    cbFilterTag = new JCheckBox("");
    cbFilterTag.setAction(actionFilter);
    cbFilterTag.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterTag, "2, 8");

    JLabel lblTag = new JLabel(BUNDLE.getString("movieextendedsearch.tag")); //$NON-NLS-1$
    setComponentFont(lblTag);
    add(lblTag, "4, 8, right, default");

    cbTag = new SmallCheckComboBox();
    cbTag.setTextFor(CheckComboBox.NONE, BUNDLE.getString("movieextendedsearch.tags.selected.none")); //$NON-NLS-1$
    cbTag.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("movieextendedsearch.tags.selected.multiple")); //$NON-NLS-1$
    cbTag.setTextFor(CheckComboBox.ALL, BUNDLE.getString("movieextendedsearch.tags.selected.all")); //$NON-NLS-1$
    cbTag.getModel().addListCheckListener(listCheckListener);
    add(cbTag, "6, 8, fill, default");

    cbFilterVideoFormat = new JCheckBox("");
    cbFilterVideoFormat.setUI(CHECKBOX_UI); // $hide$
    cbFilterVideoFormat.setAction(actionFilter);
    add(cbFilterVideoFormat, "2, 9");

    JLabel lblVideoFormat = new JLabel(BUNDLE.getString("metatag.resolution")); //$NON-NLS-1$
    setComponentFont(lblVideoFormat);
    add(lblVideoFormat, "4, 9, right, default");

    cbVideoFormat = new SmallComboBox(getVideoFormats());
    setComponentFont(cbVideoFormat);
    cbVideoFormat.setAction(actionFilter);
    add(cbVideoFormat, "6, 9, fill, default");

    cbFilterVideoCodec = new JCheckBox("");
    cbFilterVideoCodec.setAction(actionFilter);
    cbFilterVideoCodec.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterVideoCodec, "2, 10");

    JLabel lblVideoCodec = new JLabel(BUNDLE.getString("metatag.videocodec")); //$NON-NLS-1$
    setComponentFont(lblVideoCodec);
    add(lblVideoCodec, "4, 10, right, default");

    cbVideoCodec = new SmallComboBox();
    setComponentFont(cbVideoCodec);
    cbVideoCodec.setAction(actionFilter);
    add(cbVideoCodec, "6, 10, fill, default");

    cbFilterAudioCodec = new JCheckBox("");
    cbFilterAudioCodec.setAction(actionFilter);
    cbFilterAudioCodec.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterAudioCodec, "2, 11");

    JLabel lblAudioCodec = new JLabel(BUNDLE.getString("metatag.audiocodec")); //$NON-NLS-1$
    setComponentFont(lblAudioCodec);
    add(lblAudioCodec, "4, 11, right, default");

    cbAudioCodec = new SmallComboBox();
    setComponentFont(cbAudioCodec);
    cbAudioCodec.setAction(actionFilter);
    add(cbAudioCodec, "6, 11, fill, default");

    cbFilterDatasource = new JCheckBox("");
    cbFilterDatasource.setAction(actionFilter);
    cbFilterDatasource.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterDatasource, "2, 12");

    JLabel lblDatasource = new JLabel(BUNDLE.getString("metatag.datasource")); //$NON-NLS-1$
    setComponentFont(lblDatasource);
    add(lblDatasource, "4, 12, right, default");

    cbDatasource = new SmallCheckComboBox();
    cbDatasource.setTextFor(CheckComboBox.NONE, BUNDLE.getString("checkcombobox.selected.none")); //$NON-NLS-1$
    cbDatasource.setTextFor(CheckComboBox.MULTIPLE, BUNDLE.getString("checkcombobox.selected.multiple")); //$NON-NLS-1$
    cbDatasource.setTextFor(CheckComboBox.ALL, BUNDLE.getString("checkcombobox.selected.all")); //$NON-NLS-1$
    cbDatasource.getModel().addListCheckListener(listCheckListener);
    add(cbDatasource, "6, 12, fill, default");

    cbFilterMediaSource = new JCheckBox("");
    cbFilterMediaSource.setAction(actionFilter);
    cbFilterMediaSource.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterMediaSource, "2, 13");

    lblMediaSource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$
    setComponentFont(lblMediaSource);
    add(lblMediaSource, "4, 13, right, default");

    cbMediaSource = new SmallComboBox(MediaSource.values());
    setComponentFont(cbMediaSource);
    cbMediaSource.setAction(actionFilter);
    add(cbMediaSource, "6, 13, fill, default");

    cbFilterMissingMetadata = new JCheckBox("");
    cbFilterMissingMetadata.setAction(actionFilter);
    cbFilterMissingMetadata.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterMissingMetadata, "2, 14");

    JLabel lblMissingMetadata = new JLabel(BUNDLE.getString("movieextendedsearch.missingmetadata")); //$NON-NLS-1$
    setComponentFont(lblMissingMetadata);
    add(lblMissingMetadata, "4, 14, right, default");

    cbFilterMissingArtwork = new JCheckBox("");
    cbFilterMissingArtwork.setAction(actionFilter);
    cbFilterMissingArtwork.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterMissingArtwork, "2, 15");

    JLabel lblMissingArtwork = new JLabel(BUNDLE.getString("movieextendedsearch.missingartwork")); //$NON-NLS-1$
    setComponentFont(lblMissingArtwork);
    add(lblMissingArtwork, "4, 15, right, default");

    cbFilterMissingSubtitles = new JCheckBox("");
    cbFilterMissingSubtitles.setAction(actionFilter);
    cbFilterMissingSubtitles.setUI(CHECKBOX_UI); // $hide$
    add(cbFilterMissingSubtitles, "2, 16");

    JLabel lblMissingSubtitles = new JLabel(BUNDLE.getString("movieextendedsearch.missingsubtitles")); //$NON-NLS-1$
    setComponentFont(lblMissingSubtitles);
    add(lblMissingSubtitles, "4, 16, right, default");
    cbFilterNewEpisodes.setUI(CHECKBOX_UI); // $hide$

    PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getSource() instanceof TvShowSettings && "tvShowDataSource".equals(evt.getPropertyName())) {
                buildAndInstallDatasourceArray();
            }
            if (evt.getSource() instanceof TvShowList && "tag".equals(evt.getPropertyName())) {
                buildAndInstallTagsArray();
            }
            if (evt.getSource() instanceof TvShowList && ("audioCodec".equals(evt.getPropertyName())
                    || "videoCodec".equals(evt.getPropertyName()))) {
                buildAndInstallCodecArray();
            }
        }
    };
    tvShowList.addPropertyChangeListener(propertyChangeListener);
    TvShowModuleManager.SETTINGS.addPropertyChangeListener(propertyChangeListener);

    buildAndInstallDatasourceArray();
    buildAndInstallTagsArray();
    buildAndInstallCodecArray();
}

From source file:org.fhcrc.cpl.viewer.quant.gui.LogRatioHistMouseListener.java

/**
 * When the mouse is let go, save the range and signal the range update listeners
 * @param e/*from w  ww  . jav  a2s .c om*/
 */
public void mouseReleased(MouseEvent e) {
    try {
        if (this.selectedRegion != null)
            drawOrUndrawRegion();

        transformAndSaveSelectedRegion();
        selectedRealXMinValue = (float) super.transformMouseXValue(selectedRegion.getX());
        selectedRealXMaxValue = (float) super.transformMouseXValue(
                selectedRegion.getX() + selectedRegion.getWidth());

        drawOrUndrawRegion();

        this.selectedRegionStart = null;

        for (ActionListener listener : rangeUpdateListeners) {
            listener.actionPerformed(
                    new ActionEvent(this, 0, selectedRealXMinValue + "," + selectedRealXMaxValue));
        }
    } catch (Exception ee) {
    }
}

From source file:com.emr.schemas.ButtonColumn.java

public void actionPerformed(ActionEvent e) {
    int row = table.convertRowIndexToModel(table.getEditingRow());
    fireEditingStopped();/*from  w w w . j a  va 2 s.  c om*/

    //  Invoke the Action

    ActionEvent event = new ActionEvent(table, ActionEvent.ACTION_PERFORMED, "" + row);
    action.actionPerformed(event);
}

From source file:ca.inverse.sogo.admin.SOGoSyncSourceConfigPanel.java

/**
 * /*  w  w  w  . j  a  v a 2 s.  c o m*/
 */
private void init() {
    this.setLayout(null);

    titledBorder1 = new TitledBorder("");

    panelName.setFont(titlePanelFont);
    panelName.setText("Edit SOGo SyncSource");
    panelName.setBounds(new Rectangle(14, 5, 316, 28));
    panelName.setAlignmentX(SwingConstants.CENTER);
    panelName.setBorder(titledBorder1);

    int y = 60;
    int dy = 30;
    sourceURILabel.setText("Source URI: ");
    sourceURILabel.setFont(defaultFont);
    sourceURILabel.setBounds(new Rectangle(14, y, 150, 18));
    sourceURIValue.setFont(defaultFont);
    sourceURIValue.setBounds(new Rectangle(170, y, 350, 18));

    y += dy;
    nameLabel.setText("Name: ");
    nameLabel.setFont(defaultFont);
    nameLabel.setBounds(new Rectangle(14, y, 150, 18));
    nameValue.setFont(defaultFont);
    nameValue.setBounds(new Rectangle(170, y, 350, 18));

    y += dy;
    typeLabel.setText("Supported type: ");
    typeLabel.setFont(defaultFont);
    typeLabel.setBounds(new Rectangle(14, y, 150, 18));
    typeValue.setFont(defaultFont);
    typeValue.setBounds(new Rectangle(170, y, 150, 18));

    y += dy;
    dbURLLabel.setText("Database URL: ");
    dbURLLabel.setFont(defaultFont);
    dbURLLabel.setBounds(new Rectangle(14, y, 150, 18));
    dbURLValue.setFont(defaultFont);
    dbURLValue.setBounds(new Rectangle(170, y, 350, 18));

    y += dy;
    dbUsernameLabel.setText("Database username:");
    dbUsernameLabel.setFont(defaultFont);
    dbUsernameLabel.setBounds(new Rectangle(14, y, 150, 18));
    dbUsernameValue.setFont(defaultFont);
    dbUsernameValue.setBounds(new Rectangle(170, y, 150, 18));

    y += dy;
    dbPasswordLabel.setText("Database password:");
    dbPasswordLabel.setFont(defaultFont);
    dbPasswordLabel.setBounds(new Rectangle(14, y, 150, 18));
    dbPasswordValue.setFont(defaultFont);
    dbPasswordValue.setBounds(new Rectangle(170, y, 150, 18));

    y += dy;
    button.setFont(defaultFont);
    button.setText("Add");
    button.setBounds(170, y, 70, 25);

    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                if (getState() == STATE_INSERT) {
                    SOGoSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(
                            SOGoSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand()));
                } else {
                    SOGoSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(
                            SOGoSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand()));
                }
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage()));
            }
        }
    });

    this.add(panelName, null);
    this.add(nameLabel, null);
    this.add(nameValue, null);
    this.add(typeLabel, null);
    this.add(typeValue, null);
    this.add(sourceURILabel, null);
    this.add(sourceURIValue, null);
    this.add(dbURLLabel);
    this.add(dbURLValue);
    this.add(dbUsernameLabel);
    this.add(dbUsernameValue);
    this.add(dbPasswordLabel);
    this.add(dbPasswordValue);
    this.add(button, null);
}

From source file:com.funambol.admin.settings.panels.EditConsoleAppender.java

/**
 * Create the panel// w  w w.j a  v a 2 s .co  m
 * @throws Exception if error occures during creation of the panel.
 */
private void init() throws Exception {

    final int h = 18;
    final int x1 = 15;
    final int x2 = 150;
    final int w1 = 100;
    final int w2 = 310;

    int y = 40;
    int dy = 25;

    setLayout(null);
    setName(Bundle.getMessage(Bundle.EDIT_CONSOLE_APPENDER_PANEL_NAME));

    panelNameLabel.setText(Bundle.getMessage(Bundle.EDIT_CONSOLE_APPENDER_PANEL_NAME));
    panelNameLabel.setBounds(new Rectangle(14, 5, 245, 28));
    panelNameLabel.setAlignmentX(SwingConstants.CENTER);
    panelNameLabel.setBorder(new TitledBorder(""));

    nameLabel.setText(Bundle.getMessage(Bundle.LABEL_APPENDER_NAME) + " :");
    nameLabel.setBounds(new Rectangle(x1, y, w1, h));
    nameLabel2.setBounds(new Rectangle(x2, y, w2, h));

    y += dy;

    conversionPatternLabel.setText(Bundle.getMessage(Bundle.LABEL_PATTERN_LAYOUT) + " :");
    conversionPatternLabel.setBounds(new Rectangle(x1, y, w1, h));
    conversionPattern.setBounds(new Rectangle(x2, y, w2, h));

    y += dy;
    y += dy;

    confirmButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_SAVE));
    confirmButton.setBounds(new Rectangle(401, y, 60, 25));

    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                EditConsoleAppender.this.actionPerformed(new ActionEvent(EditConsoleAppender.this,
                        ACTION_EVENT_UPDATE, event.getActionCommand()));
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage()));
            }
        }
    });

    add(panelNameLabel, null);
    add(nameLabel, null);
    add(nameLabel2, null);
    add(conversionPatternLabel, null);
    add(conversionPattern, null);
    add(confirmButton, null);

    GuiFactory.setDefaultFont(this);
    panelNameLabel.setFont(GuiFactory.titlePanelFont);

}

From source file:org.fhcrc.cpl.viewer.quant.gui.LogRatioHistMouseListener.java

/**
 * Transform the region into values in units of the chart X axis
 *//*  ww w  .j ava 2s.co  m*/
protected void transformAndSaveSelectedRegion() {
    selectedRealXMinValue = (float) super.transformMouseXValue(selectedRegion.getX());
    selectedRealXMaxValue = (float) super.transformMouseXValue(
            selectedRegion.getX() + selectedRegion.getWidth());

    for (ActionListener listener : rangeUpdateListeners) {
        listener.actionPerformed(new ActionEvent(this, 0, selectedRealXMinValue + "," + selectedRealXMaxValue));
    }
}

From source file:pl.otros.logview.gui.actions.MarkAllFoundAction.java

@Override
public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == 10 && KeyEvent.CTRL_MASK == e.getModifiers()) {
        actionPerformed(new ActionEvent(e.getSource(), e.getID(), ""));
    }//from  ww w .j  a v a2  s  . c  o m

}

From source file:com.funambol.json.admin.NoteSyncSourceAdminPanel.java

/**
 * Create the panel//w  w w. j av  a 2  s .  c  o m
 * @throws Exception if error occures during creation of the panel
 */
private void init() {
    // set layout
    this.setLayout(null);
    // set properties of label, position and border
    //  referred to the title of the panel
    titledBorder = new TitledBorder("");
    panelName.setFont(titlePanelFont);
    panelName.setText(getPanelName());
    panelName.setBounds(new Rectangle(14, 5, 316, 28));
    panelName.setAlignmentX(SwingConstants.CENTER);
    panelName.setBorder(titledBorder);

    final int LABEL_X = 14;
    final int VALUE_X = 170;
    int y = 60;
    final int GAP_X = 150;
    final int GAP_Y = 30;

    sourceUriLabel.setText("Source URI: ");
    sourceUriLabel.setFont(defaultFont);
    sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    sourceUriValue.setFont(defaultFont);
    sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    y += GAP_Y; // New line

    nameLabel.setText("Name: ");
    nameLabel.setFont(defaultFont);
    nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    nameValue.setFont(defaultFont);
    nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));
    y += GAP_Y; // New line

    typeLabel.setText("Client Type: ");
    typeLabel.setFont(defaultFont);
    typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    typeCombo.setFont(defaultFont);
    typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    y += GAP_Y; // New line
    int x = LABEL_X;

    confirmButton.setFont(defaultFont);
    confirmButton.setText("Add");
    confirmButton.setBounds(VALUE_X, y, 70, 25);

    // What happens when the confirmButton is pressed?
    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                if (getState() == STATE_INSERT) {
                    NoteSyncSourceAdminPanel.this.actionPerformed(new ActionEvent(NoteSyncSourceAdminPanel.this,
                            ACTION_EVENT_INSERT, event.getActionCommand()));
                } else {
                    NoteSyncSourceAdminPanel.this.actionPerformed(new ActionEvent(NoteSyncSourceAdminPanel.this,
                            ACTION_EVENT_UPDATE, event.getActionCommand()));
                }
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage(), e));
            }
        }
    });

    // Adds all components to the panel
    this.add(panelName, null);
    this.add(nameLabel, null);
    this.add(sourceUriLabel, null);
    this.add(sourceUriValue, null);
    this.add(nameValue, null);
    this.add(typeLabel, null);
    this.add(typeCombo, null);
    this.add(confirmButton, null);

}

From source file:apidemo.PanScrollZoomDemo.java

/**
 * Creates a new demo instance.//  w  w  w . j ava 2  s . c  om
 * 
 * @param frameTitle  the frame title.
 */
public PanScrollZoomDemo(final String frameTitle) {

    super(frameTitle);

    this.toolBar = createToolbar();
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(this.toolBar, BorderLayout.SOUTH);

    final JFreeChart chart = createChart();

    this.scrollBar.setModel(new DefaultBoundedRangeModel());
    recalcScrollBar(chart.getPlot());

    this.chartPanel = new ChartPanel(chart) {
        public void autoRangeBoth() {
            System.out.println("Use 'Fit all' button");
        }
    };

    chart.addChangeListener(this);

    // enable zoom
    actionPerformed(new ActionEvent(this, 0, ACTION_CMD_ZOOM_BOX));

    // MouseListeners for pan function
    this.chartPanel.addMouseListener(this);
    //        this.chartPanel.addMouseMotionListener(this);

    // remove popup menu to allow panning
    // with right mouse pressed
    this.chartPanel.setPopupMenu(null);

    getContentPane().add(this.chartPanel);
}

From source file:org.pentaho.ui.xul.swing.tags.SwingWindow.java

public void copy() throws XulException {
    TextAction act = new DefaultEditorKit.CopyAction();
    act.actionPerformed(new ActionEvent(this.getManagedObject(), 999, "copy"));

}