Java Code Examples for javax.swing.JCheckBoxMenuItem#getClientProperty()

The following examples show how to use javax.swing.JCheckBoxMenuItem#getClientProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderingHintsContextMenu.java    From pumpernickel with MIT License 6 votes vote down vote up
public void setSelectedValue(Object value) {
	for (int a = 0; a < getItemCount(); a++) {
		if (getItem(a) instanceof JCheckBoxMenuItem) {
			JCheckBoxMenuItem item = (JCheckBoxMenuItem) getItem(a);
			Object itemValue = item
					.getClientProperty("RenderingHint.value");
			if (itemValue != null && itemValue.equals(value)
					&& item.isSelected() == false) {
				item.doClick();
				return;
			}
		}
	}
	throw new IllegalArgumentException("the value \"" + value
			+ "\" was not found");
}
 
Example 2
Source File: FilterSubmenuAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();
    // react just on submenu items, not on submenu click itself
    if (source instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
        String filterName = (String)(menuItem.getClientProperty(PROP_FILTER_NAME));
        filters.setSelected(filterName, menuItem.isSelected());
    }
}
 
Example 3
Source File: FilterSubmenuAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();
    // react just on submenu items, not on submenu click itself
    if (source instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
        String filterName = (String)(menuItem.getClientProperty(PROP_FILTER_NAME));
        filters.getInstance().setSelected(filterName, menuItem.isSelected());
    }
}
 
Example 4
Source File: FiltersDescriptor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();
    // react just on submenu items, not on submenu click itself
    if (source instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
        String filterName = (String)(menuItem.getClientProperty(PROP_FILTER_NAME));
        filtersDesc.setSelected(filterName, menuItem.isSelected());
    }
}
 
Example 5
Source File: FilterActions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();
    // react just on submenu items, not on submenu click itself
    if (source instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
        String filterName = (String)(menuItem.getClientProperty(PROP_FILTER_NAME));
        filters.setSelected(filterName, menuItem.isSelected());
    }
}
 
Example 6
Source File: RenderingHintsContextMenu.java    From pumpernickel with MIT License 5 votes vote down vote up
public Object getSelectedValue() {
	if (undefined.isSelected())
		return null;

	for (int a = 0; a < getItemCount(); a++) {
		if (getItem(a) instanceof JCheckBoxMenuItem) {
			JCheckBoxMenuItem item = (JCheckBoxMenuItem) getItem(a);
			if (item.isSelected())
				return item.getClientProperty("RenderingHint.value");
		}
	}
	return null;
}