本文整理汇总了Java中com.intellij.ui.components.JBCheckBox.addActionListener方法的典型用法代码示例。如果您正苦于以下问题:Java JBCheckBox.addActionListener方法的具体用法?Java JBCheckBox.addActionListener怎么用?Java JBCheckBox.addActionListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.components.JBCheckBox
的用法示例。
在下文中一共展示了JBCheckBox.addActionListener方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AndroidXmlCodeStylePanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
AndroidXmlCodeStylePanel(CodeStyleSettings currentSettings, CodeStyleSettings settings) {
super(XMLLanguage.INSTANCE, currentSettings, settings);
myPanel = new JPanel(new BorderLayout());
myPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JPanel centerPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
myPanel.add(centerPanel, BorderLayout.CENTER);
myUseCustomSettings = new JBCheckBox("Use custom formatting settings for Android XML files");
myPanel.add(myUseCustomSettings, BorderLayout.NORTH);
myCodeStylePanels = new ArrayList<MyFileSpecificPanel>();
myCodeStylePanels.add(new ManifestCodeStylePanel());
myCodeStylePanels.add(new LayoutCodeStylePanel());
myCodeStylePanels.add(new ValueResourcesCodeStylePanel());
myCodeStylePanels.add(new OtherCodeStylePanel());
myFileSpecificCodeStylesPanel = new JPanel(new GridLayout((myCodeStylePanels.size() + 1) / 2, 2, 15, 0));
centerPanel.add(myFileSpecificCodeStylesPanel);
myUseCustomSettings.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
UIUtil.setEnabled(myFileSpecificCodeStylesPanel, myUseCustomSettings.isSelected(), true);
}
});
for (MyFileSpecificPanel panel : myCodeStylePanels) {
final JPanel titledPanel = new JPanel(new BorderLayout());
titledPanel.setBorder(IdeBorderFactory.createTitledBorder(panel.getTitle()));
titledPanel.add(panel, BorderLayout.CENTER);
myFileSpecificCodeStylesPanel.add(titledPanel);
}
}
示例2: GitPushTagPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public GitPushTagPanel(@Nullable GitPushTagMode defaultMode, boolean followTagsSupported) {
String checkboxText = "Push Tags";
if (followTagsSupported) {
checkboxText += ": ";
}
myCheckBox = new JBCheckBox(checkboxText);
myCheckBox.setMnemonic('T');
myCheckBox.setSelected(defaultMode != null);
setLayout(new BorderLayout());
add(myCheckBox, BorderLayout.WEST);
if (followTagsSupported) {
myCombobox = new ComboBox(GitPushTagMode.getValues());
myCombobox.setRenderer(new ListCellRendererWrapper<GitPushTagMode>() {
@Override
public void customize(JList list, GitPushTagMode value, int index, boolean selected, boolean hasFocus) {
setText(value.getTitle());
}
});
myCombobox.setEnabled(myCheckBox.isSelected());
if (defaultMode != null) {
myCombobox.setSelectedItem(defaultMode);
}
myCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(@NotNull ActionEvent e) {
myCombobox.setEnabled(myCheckBox.isSelected());
}
});
add(myCombobox, BorderLayout.CENTER);
}
else {
myCombobox = null;
}
}
示例3: AlternativeJREPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public AlternativeJREPanel() {
myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));
myFieldWithHistory = new TextFieldWithHistory();
final ArrayList<String> foundJDKs = new ArrayList<String>();
for (JreProvider provider : JreProvider.EP_NAME.getExtensions()) {
String path = provider.getJrePath();
if (!StringUtil.isEmpty(path)) {
foundJDKs.add(path);
}
}
final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();
for (Sdk jdk : allJDKs) {
foundJDKs.add(jdk.getHomePath());
}
myFieldWithHistory.setHistory(foundJDKs);
myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
ExecutionBundle.message("run.configuration.select.jre.dir.label"),
null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
add(myCbEnabled, "shrinkx");
add(myPathField, "growx, pushx");
InsertPathAction.addTo(myFieldWithHistory.getTextEditor());
myCbEnabled.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
enabledChanged();
}
});
enabledChanged();
setAnchor(myCbEnabled);
updateUI();
}
示例4: AlternativeJREPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public AlternativeJREPanel() {
myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));
myFieldWithHistory = new TextFieldWithHistory();
final ArrayList<String> foundJDKs = new ArrayList<String>();
final Sdk[] allJDKs = SdkTable.getInstance().getAllSdks();
for (Sdk jdk : allJDKs) {
foundJDKs.add(jdk.getHomePath());
}
myFieldWithHistory.setHistory(foundJDKs);
myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
ExecutionBundle.message("run.configuration.select.jre.dir.label"),
null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
add(myCbEnabled, "shrinkx");
add(myPathField, "growx, pushx");
InsertPathAction.addTo(myFieldWithHistory.getTextEditor());
myCbEnabled.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
enabledChanged();
}
});
enabledChanged();
setAnchor(myCbEnabled);
updateUI();
}
示例5: AlternativeJREPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public AlternativeJREPanel() {
myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));
myFieldWithHistory = new TextFieldWithHistory();
myFieldWithHistory.setHistorySize(-1);
final ArrayList<String> foundJDKs = new ArrayList<String>();
final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();
for (Sdk sdk : allJDKs) {
foundJDKs.add(sdk.getName());
}
for (JreProvider provider : JreProvider.EP_NAME.getExtensions()) {
String path = provider.getJrePath();
if (!StringUtil.isEmpty(path)) {
foundJDKs.add(path);
}
}
for (Sdk jdk : allJDKs) {
String homePath = jdk.getHomePath();
if (!SystemInfo.isMac) {
final File jre = new File(jdk.getHomePath(), "jre");
if (jre.isDirectory()) {
homePath = jre.getPath();
}
}
if (!foundJDKs.contains(homePath)) {
foundJDKs.add(homePath);
}
}
myFieldWithHistory.setHistory(foundJDKs);
myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
ExecutionBundle.message("run.configuration.select.jre.dir.label"),
null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
add(myCbEnabled, "shrinkx");
add(myPathField, "growx, pushx");
InsertPathAction.addTo(myFieldWithHistory.getTextEditor());
myCbEnabled.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
enabledChanged();
}
});
enabledChanged();
setAnchor(myCbEnabled);
updateUI();
}
示例6: RepositoryWithBranchPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public RepositoryWithBranchPanel(@NotNull final Project project, @NotNull String repoName,
@NotNull String sourceName, @NotNull PushTargetPanel<T> destPushTargetPanelComponent) {
super();
setLayout(new BorderLayout());
myRepositoryCheckbox = new JBCheckBox();
myRepositoryCheckbox.setFocusable(false);
myRepositoryCheckbox.setOpaque(false);
myRepositoryCheckbox.setBorder(null);
myRepositoryCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(@NotNull ActionEvent e) {
fireOnSelectionChange(myRepositoryCheckbox.isSelected());
}
});
myRepositoryLabel = new JLabel(repoName);
myLocalBranch = new JBLabel(sourceName);
myArrowLabel = new JLabel(" " + UIUtil.rightArrow() + " ");
myDestPushTargetPanelComponent = destPushTargetPanelComponent;
myTextRenderer = new ColoredTreeCellRenderer() {
public void customizeCellRenderer(@NotNull JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
}
};
myTextRenderer.setOpaque(false);
layoutComponents();
setInputVerifier(new InputVerifier() {
@Override
public boolean verify(JComponent input) {
ValidationInfo error = myDestPushTargetPanelComponent.verify();
if (error != null) {
//noinspection ConstantConditions
PopupUtil.showBalloonForComponent(error.component, error.message, MessageType.WARNING, false, project);
}
return error == null;
}
});
JCheckBox emptyBorderCheckBox = new JCheckBox();
emptyBorderCheckBox.setBorder(null);
Dimension size = emptyBorderCheckBox.getPreferredSize();
myCheckBoxWidth = size.width;
myCheckBoxHeight = size.height;
myLoadingIcon = LoadingIcon.create(myCheckBoxWidth, size.height);
myCheckBoxLoadingIconGapH = myCheckBoxWidth - myLoadingIcon.getIconWidth();
myCheckBoxLoadingIconGapV = size.height - myLoadingIcon.getIconHeight();
}
示例7: AlternativeJREPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public AlternativeJREPanel() {
myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));
myFieldWithHistory = new TextFieldWithHistory();
myFieldWithHistory.setHistorySize(-1);
final List<String> foundJDKs = new ArrayList<>();
final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();
String javaHomeOfCurrentProcess = System.getProperty("java.home");
if (javaHomeOfCurrentProcess != null && !javaHomeOfCurrentProcess.isEmpty()) {
foundJDKs.add(javaHomeOfCurrentProcess);
}
for (Sdk sdk : allJDKs) {
String name = sdk.getName();
if (!foundJDKs.contains(name)) {
foundJDKs.add(name);
}
}
for (Sdk jdk : allJDKs) {
String homePath = jdk.getHomePath();
if (!SystemInfo.isMac) {
final File jre = new File(jdk.getHomePath(), "jre");
if (jre.isDirectory()) {
homePath = jre.getPath();
}
}
if (!foundJDKs.contains(homePath)) {
foundJDKs.add(homePath);
}
}
myFieldWithHistory.setHistory(foundJDKs);
myPathField = new ComponentWithBrowseButton<>(myFieldWithHistory, null);
myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
ExecutionBundle.message("run.configuration.select.jre.dir.label"),
null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
add(myCbEnabled, "shrinkx");
add(myPathField, "growx, pushx");
InsertPathAction.addTo(myFieldWithHistory.getTextEditor());
myCbEnabled.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
enabledChanged();
}
});
enabledChanged();
setAnchor(myCbEnabled);
updateUI();
}
示例8: RepositoryWithBranchPanel
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public RepositoryWithBranchPanel(@Nonnull final Project project, @Nonnull String repoName,
@Nonnull String sourceName, @Nonnull PushTargetPanel<T> destPushTargetPanelComponent) {
super();
setLayout(new BorderLayout());
myRepositoryCheckbox = new JBCheckBox();
myRepositoryCheckbox.setFocusable(false);
myRepositoryCheckbox.setOpaque(false);
myRepositoryCheckbox.setBorder(null);
myRepositoryCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(@Nonnull ActionEvent e) {
fireOnSelectionChange(myRepositoryCheckbox.isSelected());
}
});
myRepositoryLabel = new JLabel(repoName);
myLocalBranch = new JBLabel(sourceName);
myArrowLabel = new JLabel(" " + UIUtil.rightArrow() + " ");
myDestPushTargetPanelComponent = destPushTargetPanelComponent;
myTextRenderer = new ColoredTreeCellRenderer() {
@RequiredDispatchThread
@Override
public void customizeCellRenderer(@Nonnull JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
}
};
myTextRenderer.setOpaque(false);
layoutComponents();
setInputVerifier(new InputVerifier() {
@Override
public boolean verify(JComponent input) {
ValidationInfo error = myDestPushTargetPanelComponent.verify();
if (error != null) {
//noinspection ConstantConditions
PopupUtil.showBalloonForComponent(error.component, error.message, MessageType.WARNING, false, project);
}
return error == null;
}
});
JCheckBox emptyBorderCheckBox = new JCheckBox();
emptyBorderCheckBox.setBorder(null);
}
示例9: MoveChangesDialog
import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public MoveChangesDialog(final Project project, Collection<Change> selected, final Set<ChangeList> changeLists, VirtualFile current) {
super(project, true);
mySelected = selected;
setTitle("Move Changes to Active Changelist");
myTreeList = new ChangesTreeList<Change>(project, selected, true, false, null, null) {
@Override
protected DefaultTreeModel buildTreeModel(List<Change> changes, ChangeNodeDecorator changeNodeDecorator) {
return TreeModelBuilder.buildFromChangeLists(project, isShowFlatten(), changeLists);
}
@Override
protected List<Change> getSelectedObjects(ChangesBrowserNode<Change> node) {
return node.getAllChangesUnder();
}
@Override
protected Change getLeadSelectedObject(ChangesBrowserNode node) {
final Object o = node.getUserObject();
if (o instanceof Change) {
return (Change) o;
}
return null;
}
};
myChanges = new ArrayList<>();
for (ChangeList list : changeLists) {
myChanges.addAll(list.getChanges());
}
myTreeList.setChangesToDisplay(myChanges, current);
myCheckBox = new JBCheckBox("Select current file only");
myCheckBox.setMnemonic('c');
myCheckBox.addActionListener(e -> setSelected(myCheckBox.isSelected()));
boolean selectCurrent = PropertiesComponent.getInstance().getBoolean(MOVE_CHANGES_CURRENT_ONLY);
myCheckBox.setSelected(selectCurrent);
setSelected(selectCurrent);
init();
}