当前位置: 首页>>代码示例>>Java>>正文


Java JCheckBox.addActionListener方法代码示例

本文整理汇总了Java中javax.swing.JCheckBox.addActionListener方法的典型用法代码示例。如果您正苦于以下问题:Java JCheckBox.addActionListener方法的具体用法?Java JCheckBox.addActionListener怎么用?Java JCheckBox.addActionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JCheckBox的用法示例。


在下文中一共展示了JCheckBox.addActionListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initSpellField

import javax.swing.JCheckBox; //导入方法依赖的package包/类
/** Initialize this save field to contain spell data */
private void initSpellField(){
	int data = json.get(jpath[0]).getAsInt();
	JCheckBox rankOne = new JCheckBox("", (data&1)!=0);
	JCheckBox rankTwo = new JCheckBox("", (data&2)!=0);
	
	rankOne.setToolTipText("Rank 1");
	rankTwo.setToolTipText("Rank 2");
	
	BoolSpellListener bsl1 = new BoolSpellListener(rankOne, json, jpath[0], 1); 
	BoolSpellListener bsl2 = new BoolSpellListener(rankTwo, json, jpath[0], 2);
	
	rankOne.addActionListener(bsl1);
	rankTwo.addActionListener(bsl2);
	
	JPanel container = new JPanel();
	container.add(rankOne);
	container.add(rankTwo);
	this.add(container, BorderLayout.LINE_START);
}
 
开发者ID:KayDeeTee,项目名称:Hollow-Knight-SaveManager,代码行数:21,代码来源:SaveField.java

示例2: initDreamField

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private void initDreamField(){
	JCheckBox rankOne = new JCheckBox("",json.get(jpath[0]).getAsBoolean());
	JCheckBox rankTwo = new JCheckBox("",json.get(jpath[1]).getAsBoolean());
	JCheckBox rankThr = new JCheckBox("",json.get(jpath[2]).getAsBoolean());
	
	rankOne.setToolTipText("Dreamnail");
	rankTwo.setToolTipText("Dreamgate");
	rankThr.setToolTipText("Awakened Dreamnail");
	
	BoolCheckboxListener bcl1 = new BoolCheckboxListener(rankOne, json, jpath[0]); 
	BoolCheckboxListener bcl2 = new BoolCheckboxListener(rankTwo, json, jpath[1]); 
	BoolCheckboxListener bcl3 = new BoolCheckboxListener(rankThr, json, jpath[2]); 
	
	rankOne.addActionListener(bcl1);
	rankTwo.addActionListener(bcl2);
	rankThr.addActionListener(bcl3);
	
	JPanel container = new JPanel();
	container.add(rankOne);
	container.add(rankTwo);
	container.add(rankThr);
	this.add(container, BorderLayout.LINE_START);
}
 
开发者ID:KayDeeTee,项目名称:Hollow-Knight-SaveManager,代码行数:24,代码来源:SaveField.java

示例3: ControlerAlteracaoLanche

import javax.swing.JCheckBox; //导入方法依赖的package包/类
public ControlerAlteracaoLanche(AlteracaoLanche alteracaoLanche, Lanche lanche, Vendas tela) {
    this.alteracaoLanche = alteracaoLanche;
    this.lanche = lanche;
    this.telaVenda = tela;

    this.alteracaoLanche.getBtn_Cancelar().addActionListener(this);
    this.alteracaoLanche.getBtn_Finalizar().addActionListener(this);
    for (JCheckBox botao : this.alteracaoLanche.getBotoes()) {
        botao.addActionListener(this);
    }

    getDados();
    iniciaCheckBox();
    marcarCheck();

    this.alteracaoLanche.setVisible(true);
    this.alteracaoLanche.toFront();
    this.alteracaoLanche.setLocationRelativeTo(this.telaVenda);
    this.alteracaoLanche.setVisible(true);
}
 
开发者ID:wesleyreis1808,项目名称:projetomcdonalds,代码行数:21,代码来源:ControlerAlteracaoLanche.java

示例4: addRoundRobin

import javax.swing.JCheckBox; //导入方法依赖的package包/类
/**
 * Adds a Round-Robin checkbox to an interval panel
 * @param intervalPanel the interval panel
 * @author Federico Dal Castello
 */
protected void addRoundRobin(Container intervalPanel) {

	JCheckBox roundRobinCheckBox = new JCheckBox();
	roundRobinCheckBox.setText(ROUND_ROBIN + " (A-B-A-B-A-B-A-B...)");
	roundRobinCheckBox.setName(ROUND_ROBIN);

	Boolean isChecked = (Boolean) current.getParameter(5).getValue();
	roundRobinCheckBox.setSelected(isChecked.booleanValue());

	roundRobinCheckBox.addActionListener(new RoundRobinAdapter());

	//the checkbox will be aligned to the left
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.HORIZONTAL;
	c.weightx = 1.0;
	c.weighty = 0.0;

	//Add the distribution
	intervalPanel.add(roundRobinCheckBox, c);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:26,代码来源:DistributionsEditor.java

示例5: addCheckboxListener

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private static void addCheckboxListener(JCheckBox checkBox, String configString) {
    checkBox.addActionListener(arg0 -> {
        Utils.setConfigBoolean(configString, checkBox.isSelected());
        Utils.configureLogger();
    });

}
 
开发者ID:RipMeApp,项目名称:ripme,代码行数:8,代码来源:MainWindow.java

示例6: initialize

import javax.swing.JCheckBox; //导入方法依赖的package包/类
protected final void initialize(JComboBox targetsComboBox, JCheckBox duplicates) {
    this.targetsComboBox = targetsComboBox;
    this.duplicates = duplicates;
    
    duplicates.addActionListener(new ActionListener() {
        @Override public void actionPerformed(ActionEvent e) {
            updateTargetsModel();
        }
    });

    updateTargetsModel();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:CommonMembersPanel.java

示例7: ResultSetTableCellEditor

import javax.swing.JCheckBox; //导入方法依赖的package包/类
public ResultSetTableCellEditor(final JCheckBox checkBox) {
    super(checkBox);
    delegate = new EditorDelegate() {

        @Override
        public void setValue(Object value) {
            val = value;
            checkBox.setSelected((value instanceof Boolean) ? ((Boolean) value) : false);
        }

        @Override
        public boolean isCellEditable(EventObject evt) {
            if (evt instanceof MouseEvent) {
                return ((MouseEvent) evt).getClickCount() >= 2;
            }
            return true;
        }

        @Override
        public Object getCellEditorValue() {
            Boolean bolVal = checkBox.isSelected();
            if (val == null && !checkBox.isSelected()) {
                return null;
            } else {
                return bolVal;
            }
        }
    };

    checkBox.addActionListener(delegate);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:ResultSetTableCellEditor.java

示例8: rebuildVisibilityToolBar

import javax.swing.JCheckBox; //导入方法依赖的package包/类
/**
 * Creates a JCheckBox for every series and add it to the JToolBar
 */
private void rebuildVisibilityToolBar(){
	
	this.getJToolBarSeriesVisibility().removeAll();

	// Iterate over all series
	int seriesCount = this.getChart().getXYPlot().getDataset().getSeriesCount();
	for(int i=0; i<seriesCount; i++){
		
		// Create JCheckBox for this series
		Series series = parent.getDataModel().getChartModel().getSeries(i);
		JCheckBox seriesCheckBox = new JCheckBox((String)series.getKey());
		seriesCheckBox.addActionListener(this);
		
		// Set state according to current visibility
		boolean currentlyVisible = this.getChart().getXYPlot().getRenderer().getItemVisible(i, 0);
		seriesCheckBox.setSelected(currentlyVisible);
		
		seriesCheckBox.setToolTipText(this.generateToolTipTextForVisibilityCheckBox(seriesCheckBox));
		
		// Add to the JToolBar
		this.getJToolBarSeriesVisibility().add(seriesCheckBox);
	}
	
	this.getJToolBarSeriesVisibility().repaint();
	this.getJToolBarSeriesVisibility().revalidate();
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:31,代码来源:ChartTab.java

示例9: setupThumbClose

import javax.swing.JCheckBox; //导入方法依赖的package包/类
/**
 * create returns the thumb close component
 *
 * @param p
 * @return
 */
private JComponent setupThumbClose(final JPanel p) {
    JCheckBox cb = new JCheckBox();
    cb.setIcon(close);
    cb.setSelectedIcon(closesel);
    cb.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeThumbPanel(p);
        }
    });
    cb.setPreferredSize(CL_SIZE);
    cb.setMaximumSize(CL_SIZE);
    return cb;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:21,代码来源:ImageGallery.java

示例10: createPlotAllCheckbox

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private Component createPlotAllCheckbox() {
	drawAllIcons = new JCheckBox("Draw All Center Icons",false);
	drawAllIcons.addActionListener(this);
	drawAllIcons.setActionCommand("drawAll");
	drawAllIcons.setEnabled(false);
	return drawAllIcons;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:8,代码来源:WWCustomDB.java

示例11: createDetails

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private JComponent createDetails()
{
	JLabel titleLabel = new JLabel(CurrentLocale.get("wizard.controls.title")); //$NON-NLS-1$
	JLabel descriptionLabel = new JLabel(CurrentLocale.get("wizard.controls.description")); //$NON-NLS-1$
	JLabel columnsLabel = new JLabel(CurrentLocale.get("wizard.controls.columncount")); //$NON-NLS-1$

	title = new I18nTextField(BundleCache.getLanguages());
	description = new I18nTextField(BundleCache.getLanguages());
	mandatory = new JCheckBox(CurrentLocale.get("wizard.controls.mandatory")); //$NON-NLS-1$

	reload = new JCheckBox(CurrentLocale.get("wizard.controls.reload")); //$NON-NLS-1$
	reload.addActionListener(new ReloadHandler(reload));

	columnsModel = new JAdminSpinner(1, 1, 10, 1);

	final int height1 = title.getPreferredSize().height;
	final int width1 = columnsLabel.getPreferredSize().width;

	final int[] rows = {height1, height1, height1, height1, height1,};
	final int[] cols = {width1, TableLayout.FILL, TableLayout.DOUBLE_FILL,};

	JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));

	all.add(titleLabel, new Rectangle(0, 0, 1, 1));
	all.add(title, new Rectangle(1, 0, 2, 1));

	all.add(descriptionLabel, new Rectangle(0, 1, 1, 1));
	all.add(description, new Rectangle(1, 1, 2, 1));

	all.add(columnsLabel, new Rectangle(0, 2, 1, 1));
	all.add(columnsModel, new Rectangle(1, 2, 1, 1));

	all.add(mandatory, new Rectangle(0, 3, 3, 1));
	all.add(reload, new Rectangle(0, 4, 3, 1));

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:38,代码来源:RadioButtonEditor.java

示例12: createDetails

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private JComponent createDetails()
{
	JLabel titleLabel = new JLabel(CurrentLocale.get("wizard.controls.title")); //$NON-NLS-1$
	JLabel descriptionLabel = new JLabel(CurrentLocale.get("wizard.controls.description")); //$NON-NLS-1$
	JLabel columnsLabel = new JLabel(CurrentLocale.get("wizard.controls.columncount")); //$NON-NLS-1$

	title = new I18nTextField(BundleCache.getLanguages());
	description = new I18nTextField(BundleCache.getLanguages());
	mandatory = new JCheckBox(CurrentLocale.get("wizard.controls.mandatory")); //$NON-NLS-1$

	reload = new JCheckBox(CurrentLocale.get("wizard.controls.reload")); //$NON-NLS-1$
	reload.addActionListener(new ReloadHandler(reload));

	columnsSpinner = new JAdminSpinner(1, 1, 10, 1);

	final int height1 = title.getPreferredSize().height;
	final int width1 = columnsLabel.getPreferredSize().width;

	final int[] rows = {height1, height1, height1, height1, height1,};
	final int[] cols = {width1, TableLayout.FILL, TableLayout.DOUBLE_FILL,};

	JPanel all = new JPanel(new TableLayout(rows, cols));

	all.add(titleLabel, new Rectangle(0, 0, 1, 1));
	all.add(title, new Rectangle(1, 0, 2, 1));

	all.add(descriptionLabel, new Rectangle(0, 1, 1, 1));
	all.add(description, new Rectangle(1, 1, 2, 1));

	all.add(columnsLabel, new Rectangle(0, 2, 1, 1));
	all.add(columnsSpinner, new Rectangle(1, 2, 1, 1));

	all.add(mandatory, new Rectangle(0, 3, 3, 1));
	all.add(reload, new Rectangle(0, 4, 3, 1));

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:38,代码来源:CheckBoxEditor.java

示例13: setupGUI

import javax.swing.JCheckBox; //导入方法依赖的package包/类
@SuppressWarnings("nls")
private void setupGUI(Node privNode, PrivilegeList accessModel)
{
	JButton add = new JButton(addAction);
	JButton remove = new JButton(removeAction);
	JButton up = new JTextlessButton(upAction);
	JButton down = new JTextlessButton(downAction);

	privilegeModel = new MyTableModel(privNode, accessModel);
	privilegeTable = new JTable(privilegeModel);
	privilegeTable.addMouseListener(new TablePopupListener(privilegeTable, actions));

	ListSelectionModel selectionModel = privilegeTable.getSelectionModel();
	selectionModel.addListSelectionListener(this);
	selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

	TableColumn actionColumn = privilegeTable.getColumnModel().getColumn(0);
	actionColumn.setCellRenderer(new ActionTableCellRenderer());
	actionColumn.setCellEditor(new ActionTableCellEditor());

	TableColumn whoColumn = privilegeTable.getColumnModel().getColumn(1);
	whoColumn.setCellRenderer(new ExpressionTableCellRenderer(userService));
	whoColumn.setCellEditor(new WhoTableCellEditor(userService, this));

	JScrollPane scroller = new JScrollPane(privilegeTable);

	final int height1 = add.getPreferredSize().height;
	final int width1 = remove.getPreferredSize().width;
	final int[] rows = {height1, height1, height1, height1, TableLayout.FILL,};
	final int[] cols = {TableLayout.FILL, width1,};

	JPanel all = new JPanel(new TableLayout(rows, cols));
	all.add(scroller, new Rectangle(0, 0, 1, 5));
	all.add(add, new Rectangle(1, 0, 1, 1));
	all.add(remove, new Rectangle(1, 1, 1, 1));
	all.add(up, new Rectangle(1, 2, 1, 1));
	all.add(down, new Rectangle(1, 3, 1, 1));

	showOverrides = new JCheckBox(
		CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.overriding"));
	showDefaults = new JCheckBox(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.default"));

	showOverrides.addActionListener(this);
	showDefaults.addActionListener(this);

	final int mainHeight1 = showOverrides.getPreferredSize().height;
	final int[] mainRows = {TableLayout.INVISIBLE, TableLayout.FILL, TableLayout.INVISIBLE, mainHeight1,};
	final int[] mainCols = {TableLayout.FILL, TableLayout.FILL, width1,};
	layout = new TableLayout(mainRows, mainCols);
	setLayout(layout);

	add(new JLabel(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.overrides")),
		new Rectangle(2, 0, 1, 1));
	add(all, new Rectangle(0, 1, 3, 1));
	add(new JLabel(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.defaults")),
		new Rectangle(2, 2, 1, 1));
	add(showOverrides, new Rectangle(0, 3, 1, 1));
	add(showDefaults, new Rectangle(1, 3, 1, 1));

	updateButtons();
}
 
开发者ID:equella,项目名称:Equella,代码行数:62,代码来源:AdvancedEditorPanel.java

示例14: createDetails

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private JComponent createDetails()
{
	JLabel titleLabel = new JLabel(CurrentLocale.get("wizard.controls.title"));
	JLabel descriptionLabel = new JLabel(CurrentLocale.get("wizard.controls.description"));

	title = new I18nTextField(BundleCache.getLanguages());
	description = new I18nTextField(BundleCache.getLanguages());

	JComponent dateSelection = generateDefaultDate();

	formatGroup = new ButtonGroup();

	JLabel formatLabel = new JLabel(getString("date.format"));
	dayMonthYear = new JRadioButton(getDateString("full"));
	formatGroup.add(dayMonthYear);
	monthYear = new JRadioButton(getDateString("month"));
	formatGroup.add(monthYear);
	year = new JRadioButton(getDateString("year"));
	formatGroup.add(year);
	dayMonthYear.setSelected(true);// default

	mandatory = new JCheckBox(CurrentLocale.get("wizard.controls.mandatory"));

	reload = new JCheckBox(CurrentLocale.get("wizard.controls.reload"));
	reload.addActionListener(new ReloadHandler(reload));

	final int width1 = formatLabel.getPreferredSize().width;
	final int height1 = title.getPreferredSize().height;
	final int height2 = dateSelection.getPreferredSize().height;
	final int height3 = dayMonthYear.getPreferredSize().height;

	final int[] rows = {height1, height1, height2, height1, height3, height3, height3, height1, height1,
			TableLayout.PREFERRED,};
	final int[] cols = {width1, TableLayout.FILL,};

	JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));

	int row = -1;
	all.add(titleLabel, new Rectangle(0, ++row, 1, 1));
	all.add(title, new Rectangle(1, row, 1, 1));

	all.add(descriptionLabel, new Rectangle(0, ++row, 1, 1));
	all.add(description, new Rectangle(1, row, 1, 1));

	all.add(dateSelection, new Rectangle(0, ++row, 2, 1));
	// TODO: format so it doesn't look so ugly
	all.add(formatLabel, new Rectangle(0, ++row, 1, 1));
	all.add(dayMonthYear, new Rectangle(1, ++row, 1, 1));
	all.add(monthYear, new Rectangle(1, ++row, 1, 1));
	all.add(year, new Rectangle(1, ++row, 1, 1));

	all.add(mandatory, new Rectangle(0, ++row, 2, 1));

	all.add(reload, new Rectangle(0, ++row, 2, 1));

	if( getWizardType() != WizardHelper.WIZARD_TYPE_POWERSEARCH )
	{
		range = new JCheckBox(CurrentLocale.get("wizard.controls.timerange"));
		all.add(range, new Rectangle(0, ++row, 2, 1));
	}

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:64,代码来源:CalendarEditor.java

示例15: createDetails

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private JComponent createDetails()
{
	JLabel titleLabel = new JLabel(CurrentLocale.get("wizard.controls.title")); //$NON-NLS-1$
	JLabel descriptionLabel = new JLabel(CurrentLocale.get("wizard.controls.description")); //$NON-NLS-1$

	title = new I18nTextField(BundleCache.getLanguages());
	description = new I18nTextField(BundleCache.getLanguages());
	mandatory = new JCheckBox(CurrentLocale.get("wizard.controls.mandatory")); //$NON-NLS-1$
	tokenise = new JCheckBox(
		CurrentLocale.get("com.dytech.edge.admin.wizard.editor.shufflelisteditor.tokenise"), true); //$NON-NLS-1$
	checkDuplicates = new JCheckBox(CurrentLocale.get("wizard.controls.checkDuplicates")); //$NON-NLS-1$
	enforceUniqueness = new JCheckBox(CurrentLocale.get("wizard.controls.enforceUniqueness")); //$NON-NLS-1$

	checkDuplicates.addActionListener(new ActionListener()
	{
		private boolean showWarning = true;

		@Override
		public void actionPerformed(ActionEvent e)
		{
			updateGui();

			if( checkDuplicates.isEnabled() && showWarning )
			{
				Object[] options = new String[]{CurrentLocale.get("wizard.controls.uniqueness.ok"), //$NON-NLS-1$
						CurrentLocale.get("wizard.controls.uniqueness.dontshowagain")}; //$NON-NLS-1$

				if( JOptionPane.showOptionDialog(checkDuplicates,
					CurrentLocale.get("wizard.controls.uniqueness.message"), CurrentLocale //$NON-NLS-1$
						.get("wizard.controls.uniqueness.title"), JOptionPane.YES_NO_OPTION, //$NON-NLS-1$
					JOptionPane.INFORMATION_MESSAGE, null, options, options[0]) == JOptionPane.NO_OPTION )
				{
					showWarning = false;
				}
			}
		}
	});

	final int height1 = title.getPreferredSize().height;
	final int height2 = getWizardType() == WizardHelper.WIZARD_TYPE_POWERSEARCH ? height1 : 0;
	final int width1 = descriptionLabel.getPreferredSize().width;

	final int[] rows2 = {height1, height1, height1, height1, height1, height2};
	final int[] cols = {width1, TableLayout.FILL, TableLayout.DOUBLE_FILL,};

	JPanel all = new JPanel(new TableLayout(rows2, cols, 5, 5));

	all.add(titleLabel, new Rectangle(0, 0, 1, 1));
	all.add(title, new Rectangle(1, 0, 2, 1));

	all.add(descriptionLabel, new Rectangle(0, 1, 1, 1));
	all.add(description, new Rectangle(1, 1, 2, 1));

	all.add(mandatory, new Rectangle(0, 2, 3, 1));
	all.add(checkDuplicates, new Rectangle(0, 3, 3, 1));
	all.add(enforceUniqueness, new Rectangle(0, 4, 3, 1));

	all.add(tokenise, new Rectangle(0, 5, 3, 1));

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:62,代码来源:ShuffleListEditor.java


注:本文中的javax.swing.JCheckBox.addActionListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。