Search in sources :

Example 1 with ActionListener

use of java.awt.event.ActionListener in project checkstyle by checkstyle.

the class OperatorHelper method myMethod.

//indent:4 exp:4
private void myMethod() {
    //indent:4 exp:4
    class localFoo {
    }
    class localFoo2 {

        //indent:12 exp:12
        int x;

        //indent:12 exp:12
        int func() {
            return 3;
        }
    }
    //indent:8 exp:8
    //     : this is broken right now: //indent:8 exp:8
    //   1) this is both an expression and an OBJBLOCK //indent:8 exp:8
    //   2) methods aren't yet parsed //indent:8 exp:8
    //   3) only CLASSDEF is handled now, not OBJBLOCK //indent:8 exp:8
    new JButton().addActionListener(new //indent:8 exp:8
    ActionListener() {

        //indent:8 exp:8
        public void actionPerformed(ActionEvent e) {
        //indent:12 exp:12
        }
    });
    //indent:8 exp:8
    new JButton().addActionListener(new //indent:8 exp:8
    ActionListener() {

        public void actionPerformed(ActionEvent e) {
            //indent:12 exp:12
            //indent:16 exp:16
            int i = 2;
        }
    });
    //indent:8 exp:8
    Object o = new //indent:8 exp:8
    ActionListener() {

        //indent:8 exp:8
        public void actionPerformed(ActionEvent e) {
        //indent:12 exp:12
        }
    };
    //indent:8 exp:8
    myfunc2(//indent:8 exp:8
    10, //indent:8 exp:8
    10, //indent:8 exp:8
    10, myfunc3(//indent:12 exp:>=12
    11, //indent:12 exp:>=12
    11, 11, //indent:16 exp:>=16
    11), //indent:12 exp:>=12
    10, //indent:12 exp:>=12
    10, //indent:12 exp:>=12
    10);
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton)

Example 2 with ActionListener

use of java.awt.event.ActionListener in project folding-plugin by dmytrodanylyk.

the class SettingConfigurable method createComponent.

@Nullable
@Override
public JComponent createComponent() {
    useCustomPatternCheckBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            boolean selected = getCheckBoxStatus(actionEvent);
            customPattern.setEnabled(selected);
            isModified = true;
        }
    });
    customPattern.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void insertUpdate(DocumentEvent e) {
            isModified = true;
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            isModified = true;
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            isModified = true;
        }
    });
    hideFoldingPrefix.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            isModified = true;
        }
    });
    reset();
    return mPanel;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) DocumentEvent(javax.swing.event.DocumentEvent) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with ActionListener

use of java.awt.event.ActionListener in project qi4j-sdk by Qi4j.

the class Main method main.

public static void main(String[] args) throws Exception {
    SingletonAssembler assembler = new SingletonAssembler() {

        public void assemble(ModuleAssembly module) throws AssemblyException {
            module.transients(BoundPersonComposite.class);
            module.transients(AddressTransient.class);
            module.values(CityValue.class, CountryValue.class);
            new SwingBindingAssembler().assemble(module);
        }
    };
    module = assembler.module();
    Address address1 = createAddress("Vista Damai", "Jalan Tun Razak");
    Address address2 = createAddress("Mutiara", "Jalan Ceylon");
    TransientBuilder<BoundPersonComposite> builder = module.newTransientBuilder(BoundPersonComposite.class);
    PersonComposite prototype = builder.prototype();
    prototype.address().set(address1);
    prototype.firstName().set("Niclas");
    final BoundPersonComposite p1 = builder.newInstance();
    prototype.address().set(address2);
    prototype.firstName().set("Edward");
    final BoundPersonComposite p2 = builder.newInstance();
    final StateModel<BoundPersonComposite> model = module.newObject(StateModel.class, BoundPersonComposite.class);
    Form form = new Form<BoundPersonComposite>(model);
    JFrame frame = new JFrame("testing");
    frame.add(form, BorderLayout.CENTER);
    JPanel checkBoxPanel = new JPanel();
    checkBoxPanel.setFocusable(true);
    checkBoxPanel.addFocusListener(new FocusListener() {

        public void focusGained(FocusEvent e) {
            System.out.println("Gained!");
        }

        public void focusLost(FocusEvent e) {
            System.out.println("LOst!");
        }
    });
    JCheckBox sw = new JCheckBox("Toggle");
    sw.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (((JCheckBox) e.getSource()).isSelected()) {
                model.use(p1);
                System.out.println(p1.firstName().get());
            } else {
                model.use(p2);
                System.out.println(p2.firstName().get());
            }
        }
    });
    checkBoxPanel.add(sw);
    frame.add(checkBoxPanel, BorderLayout.EAST);
    frame.pack();
    System.out.println(model);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
Also used : JPanel(javax.swing.JPanel) SwingBindingAssembler(org.qi4j.lib.swing.binding.SwingBindingAssembler) ActionEvent(java.awt.event.ActionEvent) FocusEvent(java.awt.event.FocusEvent) JCheckBox(javax.swing.JCheckBox) ModuleAssembly(org.qi4j.bootstrap.ModuleAssembly) ActionListener(java.awt.event.ActionListener) JFrame(javax.swing.JFrame) SingletonAssembler(org.qi4j.bootstrap.SingletonAssembler) FocusListener(java.awt.event.FocusListener)

Example 4 with ActionListener

use of java.awt.event.ActionListener in project SKMCLauncher by SKCraft.

the class VersionListDialog method initComponents.

private void initComponents() {
    JPanel mainPanel = new JPanel();
    versionsList = new JList();
    JScrollPane versionsScroll = new JScrollPane(versionsList);
    LinedBoxPanel buttonsPanel = new LinedBoxPanel(true).fullyPadded();
    JButton cancelButton = new JButton(_("button.cancel"));
    JButton selectButton = new JButton(_("button.select"));
    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(versionsScroll, BorderLayout.CENTER);
    buttonsPanel.addGlue();
    buttonsPanel.addElement(selectButton);
    buttonsPanel.addElement(cancelButton);
    add(mainPanel, BorderLayout.CENTER);
    add(buttonsPanel, BorderLayout.SOUTH);
    cancelButton.addActionListener(ActionListeners.dispose(this));
    selectButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Object selected = versionsList.getSelectedValue();
            if (selected != null && selected instanceof Version) {
                version = (Version) selected;
            }
            dispose();
        }
    });
    getRootPane().setDefaultButton(selectButton);
    versionsList.addMouseListener(new DoubleClickToButtonAdapter(selectButton));
    ListenableFuture<?> future = executor.submit(new AbstractWorker<Object>() {

        @Override
        protected void run() throws Exception {
            try {
                setVersions(application.getAvailable());
            } catch (IOException e) {
                dispose();
                throw new LauncherException(e, _("versionList.failedFetchError"));
            } catch (InterruptedException e) {
                dispose();
            }
        }

        @Override
        public String getLocalizedTitle() {
            return _("selectVersions.fetchingVersionsTitle");
        }

        @Override
        public boolean shouldConfirmInterrupt() {
            return false;
        }
    });
    SwingHelper.addErrorDialogCallback(future, this);
}
Also used : LauncherException(com.sk89q.skmcl.LauncherException) ActionEvent(java.awt.event.ActionEvent) IOException(java.io.IOException) IOException(java.io.IOException) LauncherException(com.sk89q.skmcl.LauncherException) ActionListener(java.awt.event.ActionListener) Version(com.sk89q.skmcl.application.Version)

Example 5 with ActionListener

use of java.awt.event.ActionListener in project SKMCLauncher by SKCraft.

the class ConsoleFrame method initComponents.

/**
     * Add components to the frame.
     */
private void initComponents() {
    JButton pastebinButton = new JButton(_("console.uploadLog"));
    buttonsPanel = new LinedBoxPanel(true);
    buttonsPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    buttonsPanel.addElement(pastebinButton);
    add(buttonsPanel, BorderLayout.NORTH);
    add(messageLog, BorderLayout.CENTER);
    pastebinButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            pastebinLog();
        }
    });
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Aggregations

ActionListener (java.awt.event.ActionListener)1037 ActionEvent (java.awt.event.ActionEvent)1000 JButton (javax.swing.JButton)292 JPanel (javax.swing.JPanel)269 JLabel (javax.swing.JLabel)182 BoxLayout (javax.swing.BoxLayout)136 FlowLayout (java.awt.FlowLayout)96 JScrollPane (javax.swing.JScrollPane)95 JMenuItem (javax.swing.JMenuItem)86 Dimension (java.awt.Dimension)77 JCheckBox (javax.swing.JCheckBox)72 GridBagConstraints (java.awt.GridBagConstraints)71 BorderLayout (java.awt.BorderLayout)70 GridBagLayout (java.awt.GridBagLayout)68 Insets (java.awt.Insets)68 JMenu (javax.swing.JMenu)58 JTextField (javax.swing.JTextField)52 JComboBox (javax.swing.JComboBox)50 MouseEvent (java.awt.event.MouseEvent)44 ButtonGroup (javax.swing.ButtonGroup)44