本文整理汇总了Java中com.intellij.ui.components.JBCheckBox.addItemListener方法的典型用法代码示例。如果您正苦于以下问题:Java JBCheckBox.addItemListener方法的具体用法?Java JBCheckBox.addItemListener怎么用?Java JBCheckBox.addItemListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.components.JBCheckBox
的用法示例。
在下文中一共展示了JBCheckBox.addItemListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOptionsPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
@NotNull
private JPanel getOptionsPanel(final JPanel root) {
JPanel options = new JPanel(new GridBagLayout());
GridBag bag = new GridBag()
.setDefaultInsets(new JBInsets(0, 4, 0, 4))
.setDefaultFill(GridBagConstraints.HORIZONTAL);
cbAddInternal = new JBCheckBox("Internal");
cbAddJ2EE = new JBCheckBox("J2EE");
ItemListener itemListener = e -> {
root.remove(comboBox);
comboBox = getSelector();
root.add(comboBox);
root.revalidate();
};
cbAddInternal.addItemListener(itemListener);
cbAddJ2EE.addItemListener(itemListener);
options.add(cbAddInternal, bag.nextLine().next());
options.add(cbAddJ2EE, bag.next());
return options;
}
示例2: BlazeIntellijPluginConfigurationSettingsEditor
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public BlazeIntellijPluginConfigurationSettingsEditor(
Iterable<Label> javaLabels,
RunConfigurationStateEditor blazeFlagsEditor,
RunConfigurationStateEditor exeFlagsEditor) {
targetCombo =
new ComboBox<>(
new DefaultComboBoxModel<>(
Ordering.usingToString().sortedCopy(javaLabels).toArray(new Label[0])));
targetCombo.setRenderer(
new ListCellRendererWrapper<Label>() {
@Override
public void customize(
JList list, @Nullable Label value, int index, boolean selected, boolean hasFocus) {
setText(value == null ? null : value.toString());
}
});
this.blazeFlagsEditor = blazeFlagsEditor;
this.exeFlagsEditor = exeFlagsEditor;
ProjectSdksModel sdksModel = new ProjectSdksModel();
sdksModel.reset(null);
sdkCombo = new JdkComboBox(sdksModel, IdeaJdkHelper::isIdeaJdkType);
keepInSyncCheckBox = new JBCheckBox("Keep in sync with source XML");
keepInSyncCheckBox.addItemListener(e -> updateEnabledStatus());
}
示例3: getOptionsPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
@NotNull
private JPanel getOptionsPanel() {
// isEnabled
cbEnabled = new JBCheckBox();
cbEnabled.setSelected(directory.isEnabled());
cbEnabled.addItemListener(e -> setEnabled(cbEnabled.isSelected()));
cbEnabled.setToolTipText(Localizer.get("tooltip.IfCheckedElementWillBeCreated"));
// Script
jlScript = new IconLabel(
Localizer.get("tooltip.ColoredWhenItemHasScript"),
PluginIcons.SCRIPT,
PluginIcons.SCRIPT_DISABLED
);
// CustomPath
jlCustomPath = new IconLabel(
Localizer.get("tooltip.ColoredWhenItemHasCustomPath"),
PluginIcons.CUSTOM_PATH,
PluginIcons.CUSTOM_PATH_DISABLED
);
// WriteRules
jlWriteRules = new IconLabelCustom<Directory>(Localizer.get("tooltip.WriteRules"), directory) {
@Override
public void onUpdateIcon(Directory item) {
setIcon(item.getWriteRules().toIcon());
}
};
updateOptionIcons();
JPanel optionsPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("2pt","0")));
optionsPanel.add(cbEnabled, new CC());
optionsPanel.add(jlScript, new CC());
optionsPanel.add(jlCustomPath, new CC());
optionsPanel.add(jlWriteRules, new CC());
return optionsPanel;
}
示例4: getOptionsPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
@NotNull
private JPanel getOptionsPanel() {
JPanel optionsPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("2pt","0")));
cbEnabled = new JBCheckBox();
cbEnabled.setSelected(file.isEnabled());
cbEnabled.addItemListener(e -> setEnabled(cbEnabled.isSelected()));
cbEnabled.setToolTipText(Localizer.get("tooltip.IfCheckedElementWillBeCreated"));
// Script
jlScript = new IconLabel(
Localizer.get("tooltip.ColoredWhenItemHasScript"),
PluginIcons.SCRIPT,
PluginIcons.SCRIPT_DISABLED
);
// CustomPath
jlCustomPath = new IconLabel(
Localizer.get("tooltip.ColoredWhenItemHasCustomPath"),
PluginIcons.CUSTOM_PATH,
PluginIcons.CUSTOM_PATH_DISABLED
);
// WriteRules
jlWriteRules = new IconLabelCustom<File>(Localizer.get("tooltip.WriteRules"), file) {
@Override
public void onUpdateIcon(File item) {
setIcon(item.getWriteRules().toIcon());
}
};
updateOptionIcons();
optionsPanel.add(cbEnabled, new CC());
optionsPanel.add(jlScript, new CC());
optionsPanel.add(jlCustomPath, new CC());
optionsPanel.add(jlWriteRules, new CC());
return optionsPanel;
}
示例5: BlazeCommandRunConfigurationSettingsEditor
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
BlazeCommandRunConfigurationSettingsEditor(BlazeCommandRunConfiguration config) {
Project project = config.getProject();
targetField =
new TextFieldWithAutoCompletion<>(
project, new TargetCompletionProvider(project), true, null);
elementState = config.elementState.clone();
targetExpressionLabel = new JBLabel(UIUtil.ComponentStyle.LARGE);
keepInSyncCheckBox = new JBCheckBox("Keep in sync with source XML");
editorWithoutSyncCheckBox = UiUtil.createBox(targetExpressionLabel, targetField);
editor = UiUtil.createBox(editorWithoutSyncCheckBox, keepInSyncCheckBox);
updateEditor(config);
updateHandlerEditor(config);
keepInSyncCheckBox.addItemListener(e -> updateEnabledStatus());
}
示例6: buildProperties
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
private void buildProperties() {
// Header
JLabel jlName = new JLabel(Localizer.get("Name"));
JLabel jlDescription = new JLabel(Localizer.get("Description"));
jtfName = new JBTextField(packageTemplate.getName());
jtaDescription = new JTextArea(packageTemplate.getDescription());
panelProperties.add(jlName, new CC().wrap().spanX().pad(0, 0, 0, 8).gapY("0", "4pt"));
panelProperties.add(jtfName, new CC().spanX().growX().pushX().wrap());
panelProperties.add(jlDescription, new CC().wrap().spanX().pad(0, 0, 0, 8).gapY("4pt", "4pt"));
panelProperties.add(jtaDescription, new CC().spanX().growX().pushX().wrap().gapY("0", "4pt"));
//FileTemplate Source
ArrayList<FileTemplateSource> actionTypes = new ArrayList<>();
actionTypes.add(FileTemplateSource.DEFAULT_ONLY);
actionTypes.add(FileTemplateSource.PROJECT_ONLY);
actionTypes.add(FileTemplateSource.PROJECT_PRIORITY);
actionTypes.add(FileTemplateSource.DEFAULT_PRIORITY);
cboxFileTemplateSource = new ComboBox(actionTypes.toArray());
cboxFileTemplateSource.setRenderer(new FileTemplateSourceCellRenderer());
cboxFileTemplateSource.setSelectedItem(packageTemplate.getFileTemplateSource());
cboxFileTemplateSource.addActionListener (e -> {
packageTemplate.setFileTemplateSource((FileTemplateSource) cboxFileTemplateSource.getSelectedItem());
});
if (mode == ViewMode.USAGE) {
jtfName.setEditable(false);
jtaDescription.setEditable(false);
cboxFileTemplateSource.setEnabled(false);
} else {
// Properties
cbShouldRegisterAction = new JBCheckBox(Localizer.get("property.ShouldRegisterAction"), packageTemplate.isShouldRegisterAction());
cbSkipDefiningNames = new JBCheckBox(Localizer.get("property.SkipPresettings"), packageTemplate.isSkipDefiningNames());
panelProperties.add(cbShouldRegisterAction, new CC().wrap().spanX());
panelProperties.add(cbSkipDefiningNames, new CC().wrap().spanX());
}
// Properties
cbSkipRootDirectory = new JBCheckBox(Localizer.get("property.SkipRootDirectory"), packageTemplate.isSkipRootDirectory());
cbSkipRootDirectory.addItemListener(e -> {
collectDataFromFields();
reBuildElements();
});
cbShowReportDialog = new JBCheckBox(Localizer.get("property.ShowReportDialog"), packageTemplate.shouldShowReport());
panelProperties.add(cbSkipRootDirectory, new CC().spanX().wrap());
panelProperties.add(cbShowReportDialog, new CC().spanX().wrap());
panelProperties.add(new JLabel(Localizer.get("FileTemplateSource")), new CC().spanX().split(2));
panelProperties.add(cboxFileTemplateSource, new CC().pushX().growX().wrap());
}