本文整理汇总了Java中com.intellij.openapi.ui.ComboBox.addItem方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.addItem方法的具体用法?Java ComboBox.addItem怎么用?Java ComboBox.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.addItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupLanguageLevels
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
protected void setupLanguageLevels(Course course, CCNewProjectPanel panel) {
JLabel languageLevelLabel = panel.getLanguageLevelLabel();
languageLevelLabel.setText("Python:");
languageLevelLabel.setVisible(true);
ComboBox<String> languageLevelCombobox = panel.getLanguageLevelCombobox();
languageLevelCombobox.addItem(ALL_VERSIONS);
languageLevelCombobox.addItem(PYTHON_3);
languageLevelCombobox.addItem(PYTHON_2);
for (LanguageLevel level : LanguageLevel.values()) {
languageLevelCombobox.addItem(level.toString());
}
languageLevelCombobox.setVisible(true);
final String version = course.getLanguageVersion();
if (version != null) {
languageLevelCombobox.setSelectedItem(version);
}
else {
languageLevelCombobox.setSelectedItem(ALL_VERSIONS);
}
}
示例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: updateReferenceValues
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public void updateReferenceValues(@NotNull BuildFileKey containerProperty, @NotNull Iterable<String> values) {
BuildFileKey itemType = containerProperty.getItemType();
if (itemType == null) {
return;
}
ComboBox comboBox = (ComboBox)myProperties.get(itemType);
if (comboBox == null) {
return;
}
myIsUpdating = true;
try {
String currentValue = comboBox.getEditor().getItem().toString();
comboBox.removeAllItems();
for (String value : values) {
comboBox.addItem(value);
}
comboBox.setSelectedItem(currentValue);
} finally {
myIsUpdating = false;
}
}
示例4: 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");
}
示例5: composePanel
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void composePanel() {
myPanel = new JPanel(new GridBagLayout());
myComboBox = new ComboBox();
for (QualifyJavadocOptions options : QualifyJavadocOptions.values()) {
myComboBox.addItem(options);
}
myComboBox.setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
if (value instanceof QualifyJavadocOptions) {
setText(((QualifyJavadocOptions)value).getPresentableText());
}
}
});
JLabel title = new JLabel(ApplicationBundle.message("radio.use.fully.qualified.class.names.in.javadoc"));
myPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
GridBagConstraints left = new GridBagConstraints();
left.anchor = GridBagConstraints.WEST;
GridBagConstraints right = new GridBagConstraints();
right.anchor = GridBagConstraints.WEST;
right.weightx = 1.0;
right.insets = new Insets(0, 5, 0, 0);
myPanel.add(title, left);
myPanel.add(myComboBox, right);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:FullyQualifiedNamesInJavadocOptionProvider.java
示例6: initTargetResolutions
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void initTargetResolutions() {ComboBox targetResolutionComboBox = new ComboBox();
targetResolutionComboBox.addItem(Resolution.LDPI.getName());
targetResolutionComboBox.addItem(Resolution.MDPI.getName());
targetResolutionComboBox.addItem(Resolution.HDPI.getName());
targetResolutionComboBox.addItem(Resolution.XHDPI.getName());
targetResolutionComboBox.addItem(Resolution.XXHDPI.getName());
targetResolutionComboBox.addItem(Resolution.XXXHDPI.getName());
targetResolutionComboBox.setSelectedIndex(3);
table.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(targetResolutionComboBox));
}
示例7: initAssetResolutions
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void initAssetResolutions() {ComboBox assetResolutionComboBox = new ComboBox();
assetResolutionComboBox.addItem(Resolution.LDPI.getName());
assetResolutionComboBox.addItem(Resolution.MDPI.getName());
assetResolutionComboBox.addItem(Resolution.HDPI.getName());
assetResolutionComboBox.addItem(Resolution.XHDPI.getName());
assetResolutionComboBox.addItem(Resolution.XXHDPI.getName());
assetResolutionComboBox.addItem(Resolution.XXXHDPI.getName());
assetResolutionComboBox.addItem(Resolution.OTHER.getName());
assetResolutionComboBox.setSelectedIndex(3);
table.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(assetResolutionComboBox));
}
示例8: createVariablesTable
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private JComponent createVariablesTable() {
final String[] names = {
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.name"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.expression"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.default.value"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.skip.if.defined")
};
// Create a model of the data.
TableModel dataModel = new VariablesModel(names);
// Create the table
myTable = new JBTable(dataModel);
myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myTable.setPreferredScrollableViewportSize(new Dimension(500, myTable.getRowHeight() * 8));
myTable.getColumn(names[0]).setPreferredWidth(120);
myTable.getColumn(names[1]).setPreferredWidth(200);
myTable.getColumn(names[2]).setPreferredWidth(200);
myTable.getColumn(names[3]).setPreferredWidth(100);
if (myVariables.size() > 0) {
myTable.getSelectionModel().setSelectionInterval(0, 0);
}
ComboBox comboField = new ComboBox();
Macro[] macros = MacroFactory.getMacros();
Arrays.sort(macros, new Comparator<Macro> () {
@Override
public int compare(@NotNull Macro m1, @NotNull Macro m2) {
return m1.getPresentableName().compareTo(m2.getPresentableName());
}
});
eachMacro:
for (Macro macro : macros) {
for (TemplateContextType contextType : myContextTypes) {
if (macro.isAcceptableInContext(contextType)) {
comboField.addItem(macro.getPresentableName());
continue eachMacro;
}
}
}
comboField.setEditable(true);
DefaultCellEditor cellEditor = new DefaultCellEditor(comboField);
cellEditor.setClickCountToStart(1);
myTable.getColumn(names[1]).setCellEditor(cellEditor);
myTable.setRowHeight(comboField.getPreferredSize().height);
JTextField textField = new JTextField();
/*textField.addMouseListener(
new PopupHandler(){
public void invokePopup(Component comp,int x,int y){
showCellPopup((JTextField)comp,x,y);
}
}
);*/
cellEditor = new DefaultCellEditor(textField);
cellEditor.setClickCountToStart(1);
myTable.setDefaultEditor(String.class, cellEditor);
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction();
return decorator.createPanel();
}