Java JCheckBox onCheckBoxChange(JCheckBox field, final Runnable task)

Here you can find the source of onCheckBoxChange(JCheckBox field, final Runnable task)

Description

on Check Box Change

License

Open Source License

Declaration

public static void onCheckBoxChange(JCheckBox field, final Runnable task) 

Method Source Code

//package com.java2s;
/**//  w w  w  .  ja v  a  2 s . c o m
 * Copyright (C) 2010-14 pvmanager developers. See COPYRIGHT.TXT
 * All rights reserved. Use is subject to license terms. See LICENSE.TXT
 */

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBox;

public class Main {
    public static void onCheckBoxChange(JCheckBox field, final Runnable task) {
        field.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                task.run();
            }
        });
    }
}

Related

  1. initJCheckBox(JCheckBox box, String element)
  2. isCheckBoxModified(JCheckBox checkBox, boolean originalValue)
  3. link(final JCheckBox box, final JComponent... comps)
  4. newJCheckBox()
  5. newJCheckBox(String n, char m)
  6. setDependency(final JCheckBox master, final JCheckBox slave)
  7. setSelectedWithClick(JCheckBox checkBox, boolean selected)
  8. update(JCheckBox box, JComponent... comps)
  9. updateCheckBoxState(final JCheckBox aCheckBox, final boolean aEnabled)