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


Java JCheckBoxMenuItem.setSelected方法代码示例

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


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

示例1: createTypeMenu

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
/**
 * @return menu that allows to select possible column types
 */
private JMenu createTypeMenu() {
	ButtonGroup typeGroup = new ButtonGroup();
	JMenu typeChangeItem = new JMenu(CHANGE_TYPE_LABEL);
	typeChangeItem.setToolTipText(CHANGE_TYPE_TIP);
	for (final ColumnType columnType : ColumnType.values()) {
		final JCheckBoxMenuItem checkboxItem = new JCheckBoxMenuItem(
				DataImportWizardUtils.getNameForColumnType(columnType));
		if (columnType == metaData.getColumnMetaData(columnIndex).getType()) {
			checkboxItem.setSelected(true);
		}
		checkboxItem.addItemListener(new ItemListener() {

			@Override
			public void itemStateChanged(ItemEvent e) {
				if (e.getStateChange() == ItemEvent.SELECTED) {
					changeType(columnType);
				}

			}
		});
		typeGroup.add(checkboxItem);
		typeChangeItem.add(checkboxItem);
	}
	return typeChangeItem;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:ConfigureDataTableHeader.java

示例2: addCheckbox

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
/**
 * Adds a checkbox item with a given name to the options, and returns the
 * associated (fresh) menu item.
 * @param name the name of the checkbox menu item to add
 * @return the added {@link javax.swing.JCheckBoxMenuItem}
 */
private final JCheckBoxMenuItem addCheckbox(final String name) {
    JCheckBoxMenuItem result = new JCheckBoxMenuItem(name);
    boolean selected = userPrefs.getBoolean(name, boolOptionDefaults.get(name));
    boolean enabled = isEnabled(name);
    result.setSelected(selected & enabled);
    this.itemMap.put(name, result);
    if (enabled) {
        result.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                userPrefs.putBoolean(name, e.getStateChange() == ItemEvent.SELECTED);
            }
        });
    } else {
        result.setEnabled(false);
    }
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:25,代码来源:Options.java

示例3: initialize

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
private void initialize() {
	mouseToolbarCheckbox = new JCheckBoxMenuItem("Mouse toolbar");
	zoomToolbarCheckbox = new JCheckBoxMenuItem("Zoom toolbar");
	simulationToolbarCheckbox = new JCheckBoxMenuItem("Simulation toolbar");
	dbToolbarCheckbox = new JCheckBoxMenuItem("Explore toolbar");
	undoToolbarCheckbox = new JCheckBoxMenuItem("Undo/Redo toolbar");
	undoToolbarCheckbox.setSelected(true);
	
	mouseToolbarCheckbox.addItemListener(this);
	zoomToolbarCheckbox.addItemListener(this);
	simulationToolbarCheckbox.addItemListener(this);
	dbToolbarCheckbox.addItemListener(this);
	undoToolbarCheckbox.addItemListener(this);
	
	this.add(mouseToolbarCheckbox);
	this.add(zoomToolbarCheckbox);
	this.add(simulationToolbarCheckbox);
	this.add(dbToolbarCheckbox);
	this.add(undoToolbarCheckbox);

	
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:23,代码来源:ViewMenu.java

示例4: initialize

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
private void initialize() {
	mouseToolbarCheckbox = new JCheckBoxMenuItem("Mouse toolbar");
	zoomToolbarCheckbox = new JCheckBoxMenuItem("Zoom toolbar");
	simulationToolbarCheckbox = new JCheckBoxMenuItem("Simulation toolbar");
	dbToolbarCheckbox = new JCheckBoxMenuItem("Explore toolbar");
	undoToolbarCheckbox = new JCheckBoxMenuItem("Undo/Redo toolbar");
	undoToolbarCheckbox.setSelected(true);

	mouseToolbarCheckbox.addItemListener(this);
	zoomToolbarCheckbox.addItemListener(this);
	simulationToolbarCheckbox.addItemListener(this);
	dbToolbarCheckbox.addItemListener(this);
	undoToolbarCheckbox.addItemListener(this);

	this.add(mouseToolbarCheckbox);
	this.add(zoomToolbarCheckbox);
	this.add(simulationToolbarCheckbox);
	this.add(dbToolbarCheckbox);
	this.add(undoToolbarCheckbox);

}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:22,代码来源:ViewMenu.java

示例5: addAction

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
private void addAction(JPopupMenu popup, Action action) {
    if (action == null) {
        popup.addSeparator();
    } else {
        Class cls = (Class)action.getValue(KEY_CLASS);
        if (Boolean.class.equals(cls)) {
            Boolean boolvalue = (Boolean)action.getValue(KEY_BOOLVALUE);
            JCheckBoxMenuItem item = new JCheckBoxMenuItem(action);
            item.setSelected(boolvalue);
            popup.add(item);
        } else {
            popup.add(action);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:DropdownButton.java

示例6: addMenuItem

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
private void addMenuItem(JPopupMenu menu, Object o) {
    if (o instanceof JSeparator) {
        menu.add((JSeparator) o);
    } else if (o instanceof Action) {
        Action a = (Action) o;
        if (isBooleanStateAction(a)) {
            JCheckBoxMenuItem item = new JCheckBoxMenuItem(a);
            item.setSelected((Boolean) a.getValue(BOOLEAN_STATE_ENABLED_KEY));
            menu.add(item);
        } else {
            menu.add((Action) o);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:Terminal.java

示例7: headerMenuChanged

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
private void headerMenuChanged(String col, JCheckBoxMenuItem source) {
	int index = this.getColumnModel().getColumnIndex(col); // real index
	if (!source.isSelected()) {
		int tv = 0;
		for (int i = 0; i < this.getColumnCount(); i++) {
			tv += this.getColumnModel().getColumn(i).getWidth();
		}
		if (tv == this.getColumn(col).getWidth()) {
			source.setSelected(true);
			return;
		}
		this.originalColumsWidth.set(this.columnNames.indexOf(col), new Integer(this.getColumnModel().getColumn(index)
				.getWidth()));
		this.getColumnModel().getColumn(index).setMaxWidth(0);
		this.getColumnModel().getColumn(index).setMinWidth(0);
		this.getColumnModel().getColumn(index).setWidth(0);
		this.getColumnModel().getColumn(index).setPreferredWidth(0);
		this.getTableHeader().resizeAndRepaint();
	} else {
		this.getColumnModel().getColumn(index).setMaxWidth(2147483647);
		this.getColumnModel().getColumn(index)
				.setPreferredWidth(this.originalColumsWidth.get(this.columnNames.indexOf(col)).intValue());
		this.getColumnModel().getColumn(index)
				.setWidth(this.originalColumsWidth.get(this.columnNames.indexOf(col)).intValue());
		this.originalColumsWidth.set(this.columnNames.indexOf(col), Integer.valueOf(0));
		this.getTableHeader().resizeAndRepaint();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:FileTable.java

示例8: createPeer

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
@Override
public JCheckBoxMenuItem createPeer() {
  final JCheckBoxMenuItem item = new JCheckBoxMenuItem(action);
  item.setSelected(state);
  item.addItemListener(this);

  peers.add(new WeakReference<JCheckBoxMenuItem>(item, queue));
  return item;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:10,代码来源:CheckBoxMenuItemProxy.java

示例9: TutorialFunction

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
public TutorialFunction() {
	button = new JMenuItem("Help!");
	button.addActionListener(new ActionListener() {			
		@Override
		public void actionPerformed(ActionEvent e) {
			playNextActiveMessage();
		}
	});
	
		
	checkBox = new JCheckBoxMenuItem("AutoHelp");
	checkBox.setSelected(true);
	messages = new LinkedList<>();
	activeMessages = new LinkedList<>();
	nextMessage = new AtomicReference<>();
	playerx = 0;
	playery = 0;
	if (timerThread == null) {
		nextAlarm = new AtomicLong(0);
		timerThread = new Thread(new Runnable() {			
			@Override
			public void run() {
				timerLoop();
			}
		});
		timerThread.start();
	}
}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:29,代码来源:TutorialFunction.java

示例10: createCheckItem

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
private JCheckBoxMenuItem createCheckItem(Container c,String txt, 
		boolean selected) {
	JCheckBoxMenuItem i = new JCheckBoxMenuItem(txt);
	i.setSelected(selected);
	i.addActionListener(this);
	c.add(i);
	return i;
}
 
开发者ID:mdonnyk,项目名称:the-one-mdonnyk,代码行数:9,代码来源:SimMenuBar.java

示例11: getPopupPresenter

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
@Override
public JMenuItem getPopupPresenter() {
    JCheckBoxMenuItem mi = new JCheckBoxMenuItem(this);
    mi.setSelected(showAsPackages());
    return mi;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:OthersRootNode.java

示例12: getPopupPresenter

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
@Override public JMenuItem getPopupPresenter() {
    JCheckBoxMenuItem mi = new JCheckBoxMenuItem(this);
    mi.setSelected(showManagedState());
    return mi;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:DependencyNode.java

示例13: getPopupPresenter

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
@Override
   public JMenuItem getPopupPresenter() {
JCheckBoxMenuItem item = new JCheckBoxMenuItem(this);
item.setSelected((Boolean) this.getValue(BOOLEAN_STATE_ENABLED_KEY));
return item;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:WrapAction.java

示例14: fill

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
private void fill() {
	removeAll();
	DockableState[] dockables = dockingContext.getDesktopList().get(0).getDockables();
	List<DockableState> sorted = new LinkedList<>();
	sorted.addAll(Arrays.asList(dockables));
	Collections.sort(sorted, new Comparator<DockableState>() {

		@Override
		public int compare(DockableState o1, DockableState o2) {
			return o1.getDockable().getDockKey().getName().compareTo(o2.getDockable().getDockKey().getName());
		}
	});
	for (final DockableState state : sorted) {
		if (state.getDockable() instanceof DummyDockable) {
			continue;
		}
		DockKey dockKey = state.getDockable().getDockKey();
		boolean cont = false;
		for (String prefix : HIDE_IN_DOCKABLE_MENU_PREFIX_REGISTRY) {
			if (dockKey.getKey().startsWith(prefix)) {
				cont = true;
				break;
			}
		}
		if (cont) {
			continue;
		}
		String description = null;
		if (dockKey instanceof ResourceDockKey) {
			description = ((ResourceDockKey) dockKey).getShortDescription();
		}
		description = description != null ? description : "";
		String text = dockKey.getName();
		if (SystemInfoUtilities.getOperatingSystem() != OperatingSystem.OSX) {
			// OS X cannot use html in menus so only do it for other OS
			text = "<html><p style='margin-left:5'><b>" + dockKey.getName() + "</b><br/>" + description + "</p></html>";
		}
		JCheckBoxMenuItem item = new JCheckBoxMenuItem(text, dockKey.getIcon());

		item.setSelected(!state.isClosed());
		item.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				if (state.isClosed()) {
					dockingContext.getDesktopList().get(0).addDockable(state.getDockable());
				} else {
					dockingContext.getDesktopList().get(0).close(state.getDockable());
				}
			}

		});

		// special handling for results overview dockable in Results perspective
		// this dockable is not allowed to be closed so we disable this item while in said
		// perspective
		if (RapidMinerGUI.getMainFrame().getPerspectiveController().getModel().getSelectedPerspective().getName()
				.equals(PerspectiveModel.RESULT)
				&& ResultDisplay.RESULT_DOCK_KEY.equals(state.getDockable().getDockKey().getKey())) {
			item.setEnabled(false);
		}

		add(item);
	}

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:67,代码来源:DockableMenu.java

示例15: reloadConsole

import javax.swing.JCheckBoxMenuItem; //导入方法依赖的package包/类
private void reloadConsole() {
    for(JCheckBoxMenuItem cbmi : menucheckboxitems) {
        cbmi.setSelected(console_visible);
    }
}
 
开发者ID:Panzer1119,项目名称:JAddOn,代码行数:6,代码来源:JLogger.java


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