當前位置: 首頁>>代碼示例>>Java>>正文


Java ComboBox.addActionListener方法代碼示例

本文整理匯總了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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:AlternativeSourceNotificationProvider.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:ArtifactConfigurable.java

示例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;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:22,代碼來源:KeymapPanel.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:25,代碼來源:KeymapPanel.java

示例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");
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:23,代碼來源:ArtifactConfigurable.java

示例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;
}
 
開發者ID:dnltsk,項目名稱:intellij-geocoding-plugin,代碼行數:16,代碼來源:GeocodingConfigurable.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:FrameworkVersionComponent.java

示例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());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:ParentRendererEditor.java

示例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
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:EnumRendererEditor.java

示例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;
}
 
開發者ID:westlinkin,項目名稱:AndroidLocalizationer,代碼行數:29,代碼來源:SettingConfigurable.java

示例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();
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:28,代碼來源:FrameworkVersionComponent.java

示例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();
        }
    });
}
 
開發者ID:monday-consulting,項目名稱:idea-coremedia-plugin,代碼行數:14,代碼來源:CreateBeansDialog.java

示例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);
    }
  });
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:31,代碼來源:LocalToServerSettingsEditor.java

示例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());

}
 
開發者ID:CeH9,項目名稱:PackageTemplates,代碼行數:54,代碼來源:PackageTemplateWrapper.java


注:本文中的com.intellij.openapi.ui.ComboBox.addActionListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。