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


Java JCheckBox.setActionCommand方法代码示例

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


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

示例1: addCheckBoxToPanel

import javax.swing.JCheckBox; //导入方法依赖的package包/类
public void addCheckBoxToPanel(Food food) {
    JFrame frame = this;
    jPanel2.setLayout(new GridLayout(0, 4));
    final JCheckBox box = new JCheckBox(food.getFood());
    box.setActionCommand(String.valueOf(food.getId()));
    box.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (box.isSelected()) {
                jTextArea1.append(box.getText() + "\n");
                selectedFoodIds.add(Integer.parseInt(box.getActionCommand()));
            }
        }
    });
    jPanel2.add(box);
    frame.revalidate();
    frame.repaint();
}
 
开发者ID:seyidkanan,项目名称:my-diploma-work,代码行数:19,代码来源:IngredientsFrame.java

示例2: 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

示例3: createThumbsCheckbox

import javax.swing.JCheckBox; //导入方法依赖的package包/类
protected Component createThumbsCheckbox() {
	thumbsB = new JCheckBox("<html>Image Viewer</html>",true);
	thumbsB.setSize(45, 45);
	thumbsB.addActionListener(this);
	thumbsB.setActionCommand("thumb");
	thumbsB.setEnabled(false);
	return thumbsB;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:9,代码来源:CustomDB.java

示例4: createPlotCheckbox

import javax.swing.JCheckBox; //导入方法依赖的package包/类
protected Component createPlotCheckbox() {
	plotB = new JCheckBox("<html>Plot Refresh</html>",true);
	plotB.setSize(50, 45);
	plotB.addActionListener(this);
	plotB.setActionCommand("plotS");
	plotB.setEnabled(false);
	return plotB;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:9,代码来源:CustomDB.java

示例5: createAllPlotableCheckbox

import javax.swing.JCheckBox; //导入方法依赖的package包/类
protected Component createAllPlotableCheckbox() {
	plotAllB = new JCheckBox("<html>Plot All</html>",true);
	plotAllB.setSize(50, 45);
	plotAllB.addActionListener(this);
	plotAllB.setActionCommand("plotAll");
	plotAllB.setEnabled(false);
	return plotAllB;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:9,代码来源:CustomDB.java

示例6: checkbox

import javax.swing.JCheckBox; //导入方法依赖的package包/类
protected JCheckBox checkbox(String name, boolean selected)
{
    JCheckBox rb = new JCheckBox(name);
    rb.setActionCommand(name);
    rb.setText("");
    rb.setSelected(selected);
    checks.put(name, rb);
    return rb;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:10,代码来源:BaseDialog.java

示例7: SelectionBar

import javax.swing.JCheckBox; //导入方法依赖的package包/类
public SelectionBar()
{
    super();

    Messenger.register(MT.SERIES_CHANGED, this);

    setLayout(new MigLayout("ins 2, center, gap 4"));
    setBorder(new BevelBorder(0));

    Font f = new Font(Font.DIALOG, Font.BOLD, 14);
    eventSelect = new JComboBox<Event>();
    eventSelect.setActionCommand("eventChange");
    eventSelect.addActionListener(this);

    lock = new JCheckBox("Lock");
    lock.setActionCommand("lockEvent");
    lock.addActionListener(this);

    JLabel dl = new JLabel("Series:");
    dl.setFont(f);
    JLabel el = new JLabel("Event:");
    el.setFont(f);

    add(dl, "");
    add(new CurrentSeriesLabel(), "");
    add(el, "gap left 25");
    add(eventSelect, "");
    add(lock, "");
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:30,代码来源:SelectionBar.java

示例8: actionPerformed

import javax.swing.JCheckBox; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();
    JCheckBox firstEntry = null;
    JPopupMenu popupMenu = new JPopupMenu();

    JPanel menuPanel = new JPanel();
    menuPanel.setFocusCycleRoot(true);
    popupMenu.add(menuPanel);
    menuPanel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.BASELINE_LEADING;
    constraints.weightx = 1;
    constraints.gridx = 0;
    
    Set<Integer> visibleColumns = dataPanel.getVisibleColumns();
    DataViewTableUIModel dvtm = dataPanel.getModel();
    
    for(int i = 0; i < dvtm.getColumnCount(); i++) {
        JCheckBox columnEntry = new JCheckBox(dvtm.getColumnName(i));
        columnEntry.setActionCommand(Integer.toString(i));
        columnEntry.setSelected(visibleColumns.contains(i));
        columnEntry.addActionListener(columnVisibilityToggler);
        constraints.gridy += 1;
        menuPanel.add(columnEntry, constraints);
        if(firstEntry == null) {
            firstEntry = columnEntry;
        }
    }
    
    constraints.gridy += 1;
    menuPanel.add(new JSeparator(), constraints);
    
    JCheckBox checkboxItem = new JCheckBox("Fit column width");
    checkboxItem.setSelected(dataPanel.getAutoResizeMode() != JTable.AUTO_RESIZE_OFF);
    checkboxItem.addActionListener(fitColumnWidthToggler);
    
    constraints.gridy += 1;
    menuPanel.add(checkboxItem, constraints);
    
    popupMenu.show(button, 0, button.getHeight());
    if(firstEntry == null) {
        checkboxItem.requestFocus();
    } else {
        firstEntry.requestFocus();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:DataViewUI.java


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