本文整理汇总了Java中com.intellij.openapi.ui.ComboBox.addActionListener方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.addActionListener方法的具体用法?Java ComboBox.addActionListener怎么用?Java ComboBox.addActionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.addActionListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AlternativeSourceNotificationPanel
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public AlternativeSourceNotificationPanel(ComboBoxClassElement[] alternatives,
final PsiClass aClass,
final Project project,
final VirtualFile file) {
setText(DebuggerBundle.message("editor.notification.alternative.source", aClass.getQualifiedName()));
final ComboBox switcher = new ComboBox(alternatives);
switcher.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FileEditorManager.getInstance(project).closeFile(file);
PsiClass item = ((ComboBoxClassElement)switcher.getSelectedItem()).myClass;
item = (PsiClass)item.getNavigationElement(); // go through compiled
DebuggerUtilsEx.setAlternativeSource(file, item.getContainingFile().getVirtualFile());
item.navigate(true);
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session != null) {
session.updateExecutionPosition();
}
}
});
myLinksPanel.add(switcher);
}
示例2: createTopRightComponent
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected JComponent createTopRightComponent() {
final ComboBox artifactTypeBox = new ComboBox();
for (ArtifactType type : ArtifactType.getAllTypes()) {
artifactTypeBox.addItem(type);
}
artifactTypeBox.setRenderer(new ArtifactTypeCellRenderer(artifactTypeBox.getRenderer()));
artifactTypeBox.setSelectedItem(getArtifact().getArtifactType());
artifactTypeBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
if (selected != null && !Comparing.equal(selected, getArtifact().getArtifactType())) {
getEditor().setArtifactType(selected);
}
}
});
final JPanel panel = new JPanel(new FlowLayout());
panel.add(new JLabel("Type: "));
panel.add(artifactTypeBox);
return panel;
}
示例3: createOptionsPanel
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@Nullable
@Override
public JComponent createOptionsPanel() {
final ComboBox comboBox = new ComboBox(new Object[]{
InspectionGadgetsBundle.message("all.levels.option"),
InspectionGadgetsBundle.message("warn.level.and.lower.option"),
InspectionGadgetsBundle.message("info.level.and.lower.option"),
InspectionGadgetsBundle.message("debug.level.and.lower.option"),
InspectionGadgetsBundle.message("trace.level.option")
});
comboBox.setSelectedIndex(warnLevel);
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
warnLevel = comboBox.getSelectedIndex();
}
});
final JPanel panel = new JPanel(new BorderLayout());
panel.add(FormBuilder.createFormBuilder().addLabeledComponent(InspectionGadgetsBundle.message("warn.on.label"), comboBox).getPanel(),
BorderLayout.NORTH);
return panel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:StringConcatenationArgumentToLogCallInspection.java
示例4: createKeymapListPanel
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private JPanel createKeymapListPanel() {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
myKeymapList = new ComboBox(myKeymapListModel);
myKeymapList.setEditor(new MyEditor());
myKeymapList.setRenderer(new MyKeymapRenderer(myKeymapList.getRenderer()));
JLabel keymapLabel = new JLabel(KeyMapBundle.message("keymaps.border.factory.title"));
keymapLabel.setLabelFor(myKeymapList);
panel.add(keymapLabel, new GridBagConstraints(0,0, 1, 1, 0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0));
panel.add(myKeymapList, new GridBagConstraints(1,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,4,0,0),0,0));
panel.add(createKeymapButtonsPanel(), new GridBagConstraints(2,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0),0,0));
myKeymapList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (myKeymapListModel.getSelectedItem() != mySelectedKeymap) processCurrentKeymapChanged(getCurrentQuickListIds());
}
});
panel.add(createKeymapNamePanel(), new GridBagConstraints(3,0,1,1,1,0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,10,0,0),0,0));
return panel;
}
示例5: createKeymapListPanel
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private JPanel createKeymapListPanel() {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
myKeymapList = new ComboBox(myKeymapListModel);
myKeymapList.setEditor(new MyEditor());
myKeymapList.setRenderer(new MyKeymapRenderer(myKeymapList.getRenderer()));
JLabel keymapLabel = new JLabel(KeyMapBundle.message("keymaps.border.factory.title"));
keymapLabel.setLabelFor(myKeymapList);
panel.add(keymapLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
panel.add(myKeymapList, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 4, 0, 0), 0, 0));
panel.add(createKeymapButtonsPanel(),
new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
myKeymapList.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (myKeymapListModel.getSelectedItem() != mySelectedKeymap) processCurrentKeymapChanged(getCurrentQuickListIds());
}
});
panel.add(createKeymapNamePanel(),
new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
return panel;
}
示例6: createTopRightComponent
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected JComponent createTopRightComponent(final JTextField nameField) {
final ComboBox artifactTypeBox = new ComboBox();
for (ArtifactType type : ArtifactType.EP_NAME.getExtensions()) {
artifactTypeBox.addItem(type);
}
artifactTypeBox.setRenderer(new ArtifactTypeCellRenderer(artifactTypeBox.getRenderer()));
artifactTypeBox.setSelectedItem(getArtifact().getArtifactType());
artifactTypeBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
if (selected != null && !Comparing.equal(selected, getArtifact().getArtifactType())) {
getEditor().setArtifactType(selected);
}
}
});
return LabeledComponent.left(artifactTypeBox, "Type");
}
示例7: createOrderComboBox
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@NotNull
private ComboBox<LonLatOrder> createOrderComboBox() {
ComboBox<LonLatOrder> orderOptionComboBox = new ComboBox<>(orderOptionsModel);
orderOptionComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
LonLatOrder selectedOrder = (LonLatOrder) orderOptionsModel.getSelectedItem();
LonLatOrder storedOrder = configManager.getLonLatOrder();
if (!selectedOrder.equals(storedOrder)) {
isModified = true;
}
}
});
return orderOptionComboBox;
}
示例8: FrameworkVersionComponent
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public FrameworkVersionComponent(final FrameworkSupportModelBase model, final String frameworkOrGroupId,
final List<? extends FrameworkVersion> versions_, String labelText) {
myModel = model;
myAllVersions = versions_;
myMainPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 3, true, false));
myFrameworkOrGroupId = frameworkOrGroupId;
myVersionsBox = new ComboBox();
myVersionsBox.setRenderer(new ListCellRendererWrapper<FrameworkVersion>() {
@Override
public void customize(JList list, FrameworkVersion value, int index, boolean selected, boolean hasFocus) {
setText(value != null ? value.getPresentableName() : "");
}
});
myVersionsBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FrameworkVersion selectedVersion = getSelectedVersion();
if (selectedVersion != null) {
model.setSelectedVersion(frameworkOrGroupId, selectedVersion);
}
}
});
myVersionsPanel = FormBuilder.createFormBuilder().setHorizontalGap(5).addLabeledComponent(labelText, myVersionsBox).getPanel();
myMainPanel.add(myVersionsPanel);
updateVersionsList();
}
示例9: ParentRendererEditor
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public ParentRendererEditor(@NotNull ThemeEditorContext context) {
myContext = context;
myComboBox = new ComboBox();
//noinspection GtkPreferredJComboBoxRenderer
myComboBox.setRenderer(new StyleListCellRenderer(context));
myComboBox.addActionListener(new ParentChoiceListener());
}
示例10: EnumRendererEditor
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public EnumRendererEditor() {
myComboBox = new ComboBox();
myComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
stopCellEditing(); // registers the selection as soon as clicked
}
});
}
示例11: createComponent
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@Nullable
@Override
public JComponent createComponent() {
if (settingPanel == null) {
settingPanel = new JPanel(new VerticalLayout(18));
// header UI
Container container = new Container();
container.setLayout(new BorderLayout());
currentEngine = TranslationEngineType.fromName(
PropertiesComponent.getInstance().getValue(StorageDataKey.SettingLanguageEngine));
TranslationEngineType[] items = TranslationEngineType.getLanguageEngineArray();
languageEngineBox = new ComboBox(items);
languageEngineBox.setEnabled(true);
languageEngineBox.setSelectedItem(currentEngine);
languageEngineBox.addActionListener(this);
container.add(new JLabel("Language engine: "), BorderLayout.WEST);
container.add(languageEngineBox, BorderLayout.CENTER);
settingPanel.add(container);
initContentContainer();
initAndAddFilterContainer();
}
return settingPanel;
}
示例12: FrameworkVersionComponent
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public FrameworkVersionComponent(final FrameworkSupportModelBase model, final String frameworkOrGroupId,
final List<? extends FrameworkVersion> versions_) {
myModel = model;
myAllVersions = versions_;
myMainPanel = new JPanel(new VerticalFlowLayout());
myFrameworkOrGroupId = frameworkOrGroupId;
myVersionsBox = new ComboBox();
myVersionsBox.setRenderer(new ListCellRendererWrapper<FrameworkVersion>() {
@Override
public void customize(JList list, FrameworkVersion value, int index, boolean selected, boolean hasFocus) {
setText(value != null ? value.getPresentableName() : "");
}
});
myVersionsBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FrameworkVersion selectedVersion = getSelectedVersion();
if (selectedVersion != null) {
model.setSelectedVersion(frameworkOrGroupId, selectedVersion);
}
}
});
myVersionsPanel = FormBuilder.createFormBuilder().addLabeledComponent("Version:", myVersionsBox).getPanel();
myMainPanel.add(myVersionsPanel);
updateVersionsList();
}
示例13: initDoctypeField
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void initDoctypeField()
{
doctypeField = new ComboBox(new DefaultComboBoxModel(getSortedDoctypes().toArray()));
doctypeField.setSelectedItem(doctype);
doctypeField.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent actionEvent)
{
doctype = getSelectedDoctype();
}
});
}
示例14: LocalToServerSettingsEditor
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public LocalToServerSettingsEditor(final ServerType<S> type, DeploymentConfigurator<D> deploymentConfigurator, Project project) {
myServerType = type;
myDeploymentConfigurator = deploymentConfigurator;
myProject = project;
mySourceListModel = new SortedComboBoxModel<DeploymentSource>(new Comparator<DeploymentSource>() {
@Override
public int compare(DeploymentSource o1, DeploymentSource o2) {
return o1.getPresentableName().compareToIgnoreCase(o2.getPresentableName());
}
});
mySourceListModel.addAll(deploymentConfigurator.getAvailableDeploymentSources());
mySourceComboBox = new ComboBox(mySourceListModel);
mySourceComboBox.setRenderer(new ListCellRendererWrapper<DeploymentSource>() {
@Override
public void customize(JList list, DeploymentSource value, int index, boolean selected, boolean hasFocus) {
if (value == null) return;
setIcon(value.getIcon());
setText(value.getPresentableName());
}
});
myDeploymentSettingsComponent = new JPanel(new BorderLayout());
mySourceComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
onDeploymentSourceChanged(null);
}
});
}
示例15: buildProperties
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的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());
}