Search in sources :

Example 26 with ChangeEvent

use of javax.swing.event.ChangeEvent in project gradle by gradle.

the class MainGradlePanel method setupUI.

private void setupUI() {
    setLayout(new BorderLayout());
    tabbedPane = new JTabbedPane();
    add(tabbedPane, BorderLayout.CENTER);
    addTabs();
    restoreLastTab();
    //add a listener so we can store the current tab when it changes.
    tabbedPane.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            int selection = tabbedPane.getSelectedIndex();
            if (selection >= 0 && selection < gradleTabs.size()) {
                SettingsNode rootNode = settings.addChildIfNotPresent(MAIN_PANEL);
                rootNode.setValueOfChild(CURRENT_TAB, gradleTabs.get(selection).getName());
            }
        }
    });
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) SettingsNode(org.gradle.gradleplugin.foundation.settings.SettingsNode) ChangeListener(javax.swing.event.ChangeListener)

Example 27 with ChangeEvent

use of javax.swing.event.ChangeEvent in project zaproxy by zaproxy.

the class OptionsViewPanel method getFontSize.

private ZapNumberSpinner getFontSize() {
    if (fontSize == null) {
        fontSize = new ZapNumberSpinner(-1, 8, 100);
        if (!FontUtils.canChangeSize()) {
            fontSize.setEnabled(false);
        }
        fontSize.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                // Show what the default font will look like
                setExampleFont();
            }
        });
    }
    return fontSize;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ZapNumberSpinner(org.zaproxy.zap.utils.ZapNumberSpinner) ChangeListener(javax.swing.event.ChangeListener)

Example 28 with ChangeEvent

use of javax.swing.event.ChangeEvent in project libresonic by Libresonic.

the class PlayerTest method createGUI.

private void createGUI() {
    JFrame frame = new JFrame();
    JButton startButton = new JButton("Start");
    JButton stopButton = new JButton("Stop");
    JButton resetButton = new JButton("Reset");
    final JSlider gainSlider = new JSlider(0, 1000);
    startButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            createPlayer();
            player.play();
        }
    });
    stopButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            player.pause();
        }
    });
    resetButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            player.close();
            createPlayer();
        }
    });
    gainSlider.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            float gain = (float) gainSlider.getValue() / 1000.0F;
            player.setGain(gain);
        }
    });
    frame.setLayout(new FlowLayout());
    frame.add(startButton);
    frame.add(stopButton);
    frame.add(resetButton);
    frame.add(gainSlider);
    frame.pack();
    frame.setVisible(true);
}
Also used : ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ActionEvent(java.awt.event.ActionEvent) ChangeListener(javax.swing.event.ChangeListener)

Example 29 with ChangeEvent

use of javax.swing.event.ChangeEvent in project pcgen by PCGen.

the class ExperienceAdjusterView method initComponents.

/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    jPanel5 = new javax.swing.JPanel();
    panelChar = new javax.swing.JPanel();
    characterList = new javax.swing.JList();
    spCharLabel = new javax.swing.JLabel();
    jPanel1 = new javax.swing.JPanel();
    jLabel4 = new javax.swing.JLabel();
    enemyList = new javax.swing.JList();
    jPanel6 = new javax.swing.JPanel();
    jPanel7 = new javax.swing.JPanel();
    jLabel7 = new javax.swing.JLabel();
    experienceToAdd = new javax.swing.JTextField(6);
    addExperienceToCharButton = new javax.swing.JButton();
    jPanel8 = new javax.swing.JPanel();
    jLabel5 = new javax.swing.JLabel();
    experienceFromCombat = new javax.swing.JLabel();
    experienceMultNameLabel = new javax.swing.JLabel();
    experienceMultSlider = new javax.swing.JSlider();
    addExperienceToPartyButton = new javax.swing.JButton();
    experienceMultLabel = new javax.swing.JLabel();
    adjustCRButton = new javax.swing.JButton();
    addEnemyButton = new javax.swing.JButton();
    removeEnemyButton = new javax.swing.JButton();
    scrollPaneChar = new JScrollPane(characterList);
    scrollPaneEnemy = new JScrollPane(enemyList);
    setLayout(new GridLayout(0, 1));
    //$NON-NLS-1$
    jPanel5.setBorder(new TitledBorder(LanguageBundle.getString("in_plugin_xp_char")));
    jPanel5.setLayout(new java.awt.GridLayout(1, 0));
    panelChar.setLayout(new java.awt.BorderLayout());
    //$NON-NLS-1$
    spCharLabel.setText(LanguageBundle.getString("in_plugin_xp_nameLvlXp"));
    panelChar.add(spCharLabel, BorderLayout.NORTH);
    panelChar.add(scrollPaneChar, java.awt.BorderLayout.CENTER);
    jPanel5.add(panelChar);
    jPanel1.setLayout(new java.awt.BorderLayout());
    //$NON-NLS-1$
    jLabel4.setText(LanguageBundle.getString("in_plugin_xp_nameCr"));
    jPanel1.add(jLabel4, java.awt.BorderLayout.NORTH);
    jPanel1.add(scrollPaneEnemy, java.awt.BorderLayout.CENTER);
    add(jPanel5);
    jPanel6.setLayout(new java.awt.GridLayout(1, 0));
    //$NON-NLS-1$
    jPanel6.setBorder(new TitledBorder(LanguageBundle.getString("in_plugin_xp_enemies")));
    jPanel6.add(jPanel1);
    jPanel7.setLayout(new java.awt.GridBagLayout());
    // the button is after to allow the use of Tab after entering a value then pressing the button
    //$NON-NLS-1$
    jLabel7.setText(LanguageBundle.getString("in_plugin_xp_xpTo"));
    //$NON-NLS-1$
    addExperienceToCharButton.setText(LanguageBundle.getString("in_plugin_xp_selectedChar"));
    addExperienceToCharButton.setEnabled(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    //$NON-NLS-1$
    jPanel7.add(new JLabel(LanguageBundle.getString("in_plugin_xp_add")), gridBagConstraints);
    jPanel7.add(experienceToAdd, gridBagConstraints);
    jPanel7.add(jLabel7, gridBagConstraints);
    jPanel7.add(addExperienceToCharButton, gridBagConstraints);
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    // add an empty horizontal glue like panel
    jPanel7.add(new JPanel(), gridBagConstraints);
    // Updates the button if there is a selected character
    characterList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                addExperienceToCharButton.setEnabled(!characterList.isSelectionEmpty());
            }
        }
    });
    jPanel7.setBorder(BorderFactory.createEmptyBorder(0, BORDER_SIZE, 0, 0));
    jPanel5.add(jPanel7);
    jPanel8.setLayout(new java.awt.GridBagLayout());
    //$NON-NLS-1$
    jLabel5.setText(LanguageBundle.getString("in_plugin_xp_xpFromCombat"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = 2;
    jPanel8.add(jLabel5, gridBagConstraints);
    experienceFromCombat.setText(Integer.toString(0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel8.add(experienceFromCombat, gridBagConstraints);
    //$NON-NLS-1$
    experienceMultNameLabel.setText(LanguageBundle.getString("in_plugin_xp_normal"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel8.add(experienceMultNameLabel, gridBagConstraints);
    experienceMultSlider.setMaximum(10);
    experienceMultSlider.setMinimum(-5);
    experienceMultSlider.setValue(0);
    // TODO the false value (the slider's) should not be visible, only the real one should
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel8.add(experienceMultSlider, gridBagConstraints);
    experienceMultSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            double realValue = getSliderRealValue();
            if (CoreUtility.doublesEqual(realValue, 0.5)) {
                getExperienceMultNameLabel().setText(//$NON-NLS-1$
                LanguageBundle.getString("in_plugin_xp_half"));
            } else if (realValue <= 0.7) {
                getExperienceMultNameLabel().setText(//$NON-NLS-1$
                LanguageBundle.getString("in_plugin_xp_easier"));
            } else if ((realValue > 0.7) && (realValue < 1.5)) {
                getExperienceMultNameLabel().setText(//$NON-NLS-1$
                LanguageBundle.getString("in_plugin_xp_normal"));
            } else if (realValue >= 1.5) {
                getExperienceMultNameLabel().setText(//$NON-NLS-1$
                LanguageBundle.getString("in_plugin_xp_harder"));
            }
            if (CoreUtility.doublesEqual(realValue, 2)) {
                getExperienceMultNameLabel().setText(//$NON-NLS-1$
                LanguageBundle.getString("in_plugin_xp_twice"));
            }
            getExperienceMultLabel().setText(LanguageBundle.getPrettyMultiplier(realValue));
            model.setMultiplier(realValue);
        }
    });
    //$NON-NLS-1$
    addExperienceToPartyButton.setText(LanguageBundle.getString("in_plugin_xp_addXpToParty"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel8.add(addExperienceToPartyButton, gridBagConstraints);
    experienceMultLabel.setText(LanguageBundle.getPrettyMultiplier(1.0d));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel8.add(experienceMultLabel, gridBagConstraints);
    //$NON-NLS-1$
    adjustCRButton.setText(LanguageBundle.getString("in_plugin_xp_adjustCr"));
    adjustCRButton.setEnabled(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel8.add(adjustCRButton, gridBagConstraints);
    //$NON-NLS-1$
    addEnemyButton.setText(LanguageBundle.getString("in_plugin_xp_addEnemy"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel8.add(addEnemyButton, gridBagConstraints);
    //$NON-NLS-1$
    removeEnemyButton.setText(LanguageBundle.getString("in_plugin_xp_removeEnemy"));
    removeEnemyButton.setEnabled(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.insets = new java.awt.Insets(12, BORDER_SIZE, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    jPanel8.add(removeEnemyButton, gridBagConstraints);
    // Update buttons on selection change
    enemyList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                adjustCRButton.setEnabled(!enemyList.isSelectionEmpty());
                removeEnemyButton.setEnabled(!enemyList.isSelectionEmpty());
            }
        }
    });
    jPanel8.setBorder(BorderFactory.createEmptyBorder(0, BORDER_SIZE, 0, 0));
    jPanel6.add(jPanel8);
    add(jPanel6);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) JTextField(javax.swing.JTextField) JList(javax.swing.JList) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JLabel(javax.swing.JLabel) GridBagConstraints(java.awt.GridBagConstraints) TitledBorder(javax.swing.border.TitledBorder) ListSelectionListener(javax.swing.event.ListSelectionListener) GridLayout(java.awt.GridLayout) GridLayout(java.awt.GridLayout) ChangeEvent(javax.swing.event.ChangeEvent) JLabel(javax.swing.JLabel) ChangeListener(javax.swing.event.ChangeListener) BorderLayout(java.awt.BorderLayout) JPanel(javax.swing.JPanel)

Example 30 with ChangeEvent

use of javax.swing.event.ChangeEvent in project intellij-community by JetBrains.

the class MavenArtifactSearchDialog method initComponents.

private void initComponents(Project project, String initialText, boolean classMode) {
    myTabbedPane = new TabbedPaneWrapper(project);
    MavenArtifactSearchPanel.Listener listener = new MavenArtifactSearchPanel.Listener() {

        public void itemSelected() {
            clickDefaultButton();
        }

        public void canSelectStateChanged(MavenArtifactSearchPanel from, boolean canSelect) {
            myOkButtonStates.put(from, canSelect);
            updateOkButtonState();
        }
    };
    myArtifactsPanel = new MavenArtifactSearchPanel(project, !classMode ? initialText : "", false, listener, this, myManagedDependenciesMap);
    myClassesPanel = new MavenArtifactSearchPanel(project, classMode ? initialText : "", true, listener, this, myManagedDependenciesMap);
    myTabbedPane.addTab("Search for artifact", myArtifactsPanel);
    myTabbedPane.addTab("Search for class", myClassesPanel);
    myTabbedPane.setSelectedIndex(classMode ? 1 : 0);
    myTabbedPane.getComponent().setPreferredSize(JBUI.size(900, 600));
    myTabbedPane.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            updateOkButtonState();
        }
    });
    updateOkButtonState();
}
Also used : ChangeListener(javax.swing.event.ChangeListener) ChangeEvent(javax.swing.event.ChangeEvent) TabbedPaneWrapper(com.intellij.ui.TabbedPaneWrapper) ChangeListener(javax.swing.event.ChangeListener)

Aggregations

ChangeEvent (javax.swing.event.ChangeEvent)164 ChangeListener (javax.swing.event.ChangeListener)130 JPanel (javax.swing.JPanel)45 ActionEvent (java.awt.event.ActionEvent)43 ActionListener (java.awt.event.ActionListener)38 JLabel (javax.swing.JLabel)30 GridBagConstraints (java.awt.GridBagConstraints)18 JButton (javax.swing.JButton)17 BorderLayout (java.awt.BorderLayout)16 JCheckBox (javax.swing.JCheckBox)16 JSpinner (javax.swing.JSpinner)16 SpinnerNumberModel (javax.swing.SpinnerNumberModel)16 GridBagLayout (java.awt.GridBagLayout)15 Dimension (java.awt.Dimension)14 PropertyChangeEvent (java.beans.PropertyChangeEvent)14 JSlider (javax.swing.JSlider)14 Insets (java.awt.Insets)13 ValidationPanel (org.netbeans.validation.api.ui.ValidationPanel)13 IOException (java.io.IOException)12 JTabbedPane (javax.swing.JTabbedPane)12