當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。