javax.swing.JComboBox.setPrototypeDisplayValue()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(12.5k)|赞(0)|评价(0)|浏览(329)

本文整理了Java中javax.swing.JComboBox.setPrototypeDisplayValue()方法的一些代码示例,展示了JComboBox.setPrototypeDisplayValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.setPrototypeDisplayValue()方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:setPrototypeDisplayValue

JComboBox.setPrototypeDisplayValue介绍

暂无

代码示例

代码示例来源:origin: runelite/runelite

box.setForeground(Color.WHITE);
box.setFocusable(false);
box.setPrototypeDisplayValue("XXXXXXXX"); //sorry but this is the way to keep the size of the combobox in check.
try

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

public void setPrototypeDisplayValue(Object prototypeDisplayValue) {
  combo.setPrototypeDisplayValue(prototypeDisplayValue);
}

代码示例来源:origin: freeplane/freeplane

public Container createStyleBox() {
  final JComboBox stylesBox = new JComboBoxWithBorder(styles);
  stylesBox.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXX");
  stylesBox.setRenderer(new ComboBoxRendererWithTooltip(stylesBox));
  return stylesBox;
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public ComponentConfigurationPanel(ComponentActivity activity) {
  this.activity = activity;
  componentVersionChoice.setPrototypeDisplayValue(SHORT_STRING);
  configBean = activity.getConfiguration();
  initGui();
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public SharingPolicyChooserPanel() {
  super();
  permissionBox.setPrototypeDisplayValue(LONG_STRING);
  this.setLayout(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.anchor = WEST;
  gbc.fill = NONE;
  this.add(new JLabel(SHARING_LABEL), gbc);
  gbc.gridx = 1;
  gbc.weightx = 1;
  gbc.fill = BOTH;
  this.add(permissionBox, gbc);
  permissionBox.setEditable(false);
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public LicenseChooserPanel() {
  super();
  licenseBox.setPrototypeDisplayValue(LONG_STRING);
  this.setLayout(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.anchor = WEST;
  gbc.fill = NONE;
  this.add(new JLabel("License:"), gbc);
  gbc.gridx = 1;
  gbc.weightx = 1;
  gbc.fill = BOTH;
  this.add(licenseBox, gbc);
  licenseBox.setEditable(false);
  licenseBox.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent event) {
      if (event.getStateChange() == SELECTED)
        setLicense(licenseMap.get(licenseBox.getSelectedItem()));
    }
  });
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public ProfileChooserPanel() {
  super();
  profileBox.setPrototypeDisplayValue(LONG_STRING);
  this.setLayout(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.anchor = WEST;
  gbc.fill = NONE;
  this.add(new JLabel(PROFILE_LABEL), gbc);
  gbc.gridx = 1;
  gbc.weightx = 1;
  gbc.fill = BOTH;
  this.add(profileBox, gbc);
  profileBox.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent event) {
      if (event.getStateChange() == SELECTED)
        setProfile(profileMap.get(profileBox.getSelectedItem()));
    }
  });
  profileBox.setEditable(false);
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public FamilyChooserPanel() {
  familyBox.setPrototypeDisplayValue(LONG_STRING);
  setLayout(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.anchor = WEST;
  gbc.fill = NONE;
  this.add(new JLabel(FAMILY_LABEL), gbc);
  gbc.gridx = 1;
  gbc.weightx = 1;
  gbc.fill = BOTH;
  this.add(familyBox, gbc);
  familyBox.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent event) {
      if (event.getStateChange() == SELECTED) {
        updateDescription();
        notifyObservers();
      }
    }
  });
  familyBox.setEditable(false);
}

代码示例来源:origin: org.cytoscape/cpath2-impl

/**
 * Creates the Organism Combo Box.
 *
 * @return JComboBox Object.
 */
private JComboBox createOrganismComboBox() {
  //  Organism List is currently hard-coded.
  Vector<Organism> organismList = new Vector<Organism>();
  organismList.add(new Organism("All Organisms", -1));
  organismList.addAll(CPathProperties.getInstance().getOrganismList());
  DefaultComboBoxModel organismComboBoxModel = new DefaultComboBoxModel(organismList);
  JComboBox organismComboBox = new JComboBox(organismComboBoxModel);
  organismComboBox.setToolTipText("Select Organism");
  organismComboBox.setMaximumSize(new Dimension(200, 9999));
  organismComboBox.setPrototypeDisplayValue("12345678901234567");
  return organismComboBox;
}

代码示例来源:origin: cytoscape.coreplugins/cpath2

/**
 * Creates the Organism Combo Box.
 *
 * @return JComboBox Object.
 */
private JComboBox createOrganismComboBox() {
  //  Organism List is currently hard-coded.
  Vector organismList = new Vector();
  organismList.add(new Organism("All Organisms", -1));
  CPathProperties props = CPathProperties.getInstance();
  organismList.addAll(props.getOrganismList());
  DefaultComboBoxModel organismComboBoxModel = new DefaultComboBoxModel(organismList);
  JComboBox organismComboBox = new JComboBox(organismComboBoxModel);
  organismComboBox.setToolTipText("Select Organism");
  organismComboBox.setMaximumSize(new Dimension(200, 9999));
  organismComboBox.setPrototypeDisplayValue("12345678901234567");
  return organismComboBox;
}

代码示例来源:origin: net.sf.taverna.t2.ui-activities/component-activity-ui

public RegistryChooserPanel() {
  setLayout(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  registryMap = pref.getRegistryMap();
  registryBox = new JComboBox(registryMap.keySet().toArray());
  registryBox.setPrototypeDisplayValue(LONG_STRING);
  registryBox.setEditable(false);
  gbc.gridx = 0;
  gbc.anchor = WEST;
  this.add(new JLabel(REGISTRY_LABEL), gbc);
  gbc.gridx = 1;
  gbc.weightx = 1;
  gbc.fill = BOTH;
  this.add(registryBox, gbc);
  registryBox.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent event) {
      if (event.getStateChange() == SELECTED)
        dealWithSelection();
    }
  });
  String firstKey = registryMap.firstKey();
  registryBox.setSelectedItem(firstKey);
  dealWithSelection();
}

代码示例来源:origin: senbox-org/snap-desktop

private JPanel createSourceProductPanel() {
  final JPanel masterPanel = new JPanel(new BorderLayout(3, 3));
  masterPanel.add(masterProductSelector.getProductNameLabel(), BorderLayout.NORTH);
  masterProductSelector.getProductNameComboBox().setPrototypeDisplayValue(
      "MER_RR__1PPBCM20030730_071000_000003972018_00321_07389_0000.N1");
  masterPanel.add(masterProductSelector.getProductNameComboBox(), BorderLayout.CENTER);
  masterPanel.add(masterProductSelector.getProductFileChooserButton(), BorderLayout.EAST);
  final JPanel slavePanel = new JPanel(new BorderLayout(3, 3));
  slavePanel.add(slaveProductSelector.getProductNameLabel(), BorderLayout.NORTH);
  slavePanel.add(slaveProductSelector.getProductNameComboBox(), BorderLayout.CENTER);
  slavePanel.add(slaveProductSelector.getProductFileChooserButton(), BorderLayout.EAST);
  final TableLayout layout = new TableLayout(1);
  layout.setTableAnchor(TableLayout.Anchor.WEST);
  layout.setTableFill(TableLayout.Fill.HORIZONTAL);
  layout.setTableWeightX(1.0);
  layout.setCellPadding(0, 0, new Insets(3, 3, 3, 3));
  layout.setCellPadding(1, 0, new Insets(3, 3, 3, 3));
  final JPanel panel = new JPanel(layout);
  panel.setBorder(BorderFactory.createTitledBorder("Source Products"));
  panel.add(masterPanel);
  panel.add(slavePanel);
  return panel;
}

代码示例来源:origin: bcdev/beam

private JPanel createSourceProductPanel() {
  final JPanel masterPanel = new JPanel(new BorderLayout(3, 3));
  masterPanel.add(masterProductSelector.getProductNameLabel(), BorderLayout.NORTH);
  masterProductSelector.getProductNameComboBox().setPrototypeDisplayValue(
      "MER_RR__1PPBCM20030730_071000_000003972018_00321_07389_0000.N1");
  masterPanel.add(masterProductSelector.getProductNameComboBox(), BorderLayout.CENTER);
  masterPanel.add(masterProductSelector.getProductFileChooserButton(), BorderLayout.EAST);
  final JPanel slavePanel = new JPanel(new BorderLayout(3, 3));
  slavePanel.add(slaveProductSelector.getProductNameLabel(), BorderLayout.NORTH);
  slavePanel.add(slaveProductSelector.getProductNameComboBox(), BorderLayout.CENTER);
  slavePanel.add(slaveProductSelector.getProductFileChooserButton(), BorderLayout.EAST);
  final TableLayout layout = new TableLayout(1);
  layout.setTableAnchor(TableLayout.Anchor.WEST);
  layout.setTableFill(TableLayout.Fill.HORIZONTAL);
  layout.setTableWeightX(1.0);
  layout.setCellPadding(0, 0, new Insets(3, 3, 3, 3));
  layout.setCellPadding(1, 0, new Insets(3, 3, 3, 3));
  final JPanel panel = new JPanel(layout);
  panel.setBorder(BorderFactory.createTitledBorder("Source Products"));
  panel.add(masterPanel);
  panel.add(slavePanel);
  return panel;
}

代码示例来源:origin: Slowpoke101/FTBLaunch

search = new JButton(I18N.getLocaleString("FILTER_TEXSEARCH"));
resolution.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxxxx");
compatiblePack.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxxxx");

代码示例来源:origin: net.anwiba.commons/anwiba-commons-swing-core

public ObjectComboBox(final IObjectListConfiguration<T> configuration, final IComboBoxModel<T> listModel) {
 this.objectModel = listModel;
 final JComboBox<T> list = new JComboBox<>(listModel);
 list.setRenderer(
   new ObjectUiListCellRenderer<>(
     configuration.getObjectUiCellRendererConfiguration(),
     configuration.getObjectUi()));
 list.setPrototypeDisplayValue(configuration.getPrototype());
 list.setMaximumRowCount(configuration.getVisibleRowCount());
 this.component = list;
}

代码示例来源:origin: freeplane/freeplane

public Container createSizeBox() {
  final JComboBox sizeBox = new JComboBoxWithBorder(size);
  sizeBox.setPrototypeDisplayValue("88888");
  sizeBox.setPreferredSize(sizeBox.getPreferredSize());
  sizeBox.setEditor(new FixedBasicComboBoxEditor());
  sizeBox.setEditable(true);
  return sizeBox;
}

代码示例来源:origin: org.japura/japura-gui

protected void updateCellPanelWidth() {
 if (getPrototypeDisplayValue() != null) {
  getComboBox().setPrototypeDisplayValue(getPrototypeDisplayValue());
  return;
 }
 String value = null;
 for (CheckState checkState : CheckState.values()) {
  String text = getTextFor(checkState);
  if (text != null) {
   if (value == null) {
    value = text;
   } else if (text.length() > value.length()) {
    value = text;
   }
  }
 }
 ListCheckModel m = getModel();
 for (int i = 0; i < m.getSize(); i++) {
  String str = m.getElementAt(i).toString();
  if (value == null) {
   value = str;
  } else if (str.length() > value.length()) {
   value = str;
  }
 }
 getComboBox().setPrototypeDisplayValue(value);
}

代码示例来源:origin: bcdev/beam

private JPanel createSourceProductPanel() {
  final JPanel panel = sourceProductSelector.createDefaultPanel();
  sourceProductSelector.getProductNameLabel().setText("Name:");
  sourceProductSelector.getProductNameComboBox().setPrototypeDisplayValue(
      "MER_RR__1PPBCM20030730_071000_000003972018_00321_07389_0000.N1");
  sourceProductSelector.addSelectionChangeListener(new AbstractSelectionChangeListener() {
    @Override
    public void selectionChanged(SelectionChangeEvent event) {
      final Product sourceProduct = getSourceProduct();
      updateTargetProductName(sourceProduct);
      GeoPos centerGeoPos = null;
      if (sourceProduct != null) {
        centerGeoPos = ProductUtils.getCenterGeoPos(sourceProduct);
      }
      infoForm.setCenterPos(centerGeoPos);
      if (outputGeometryModel != null) {
        outputGeometryModel.setSourceProduct(sourceProduct);
      }
      updateCRS();
    }
  });
  return panel;
}

代码示例来源:origin: senbox-org/snap-desktop

private JPanel createSourceProductPanel() {
  final JPanel panel = sourceProductSelector.createDefaultPanel();
  sourceProductSelector.getProductNameLabel().setText("Name:");
  sourceProductSelector.getProductNameComboBox().setPrototypeDisplayValue(
      "MER_RR__1PPBCM20030730_071000_000003972018_00321_07389_0000.N1");
  sourceProductSelector.addSelectionChangeListener(new AbstractSelectionChangeListener() {
    @Override
    public void selectionChanged(SelectionChangeEvent event) {
      final Product sourceProduct = getSourceProduct();
      updateTargetProductName(sourceProduct);
      GeoPos centerGeoPos = null;
      if (sourceProduct != null) {
        centerGeoPos = ProductUtils.getCenterGeoPos(sourceProduct);
      }
      infoForm.setCenterPos(centerGeoPos);
      if (outputGeometryModel != null) {
        outputGeometryModel.setSourceProduct(sourceProduct);
      }
      updateCRS();
    }
  });
  return panel;
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http

private JPanel createTargetPanel() {
  targetNodesModel = new DefaultComboBoxModel<>();
  targetNodes = new JComboBox<>(targetNodesModel);
  targetNodes.setPrototypeDisplayValue(""); // $NON-NLS-1$ // Bug 56303 fixed the width of combo list
  JPopupMenu popup = (JPopupMenu) targetNodes.getUI().getAccessibleChild(targetNodes, 0); // get popup element
  JScrollPane scrollPane = findScrollPane(popup);
  if(scrollPane != null) {
    scrollPane.setHorizontalScrollBar(new JScrollBar(JScrollBar.HORIZONTAL)); // add scroll pane if label element is too long
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  }
  targetNodes.setActionCommand(CHANGE_TARGET);
  // Action listener will be added later
  JLabel label = new JLabel(JMeterUtils.getResString("proxy_target")); // $NON-NLS-1$
  label.setLabelFor(targetNodes);
  HorizontalPanel panel = new HorizontalPanel();
  panel.add(label);
  panel.add(targetNodes);
  return panel;
}

相关文章

JComboBox类方法