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

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

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

JComboBox.setSize介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JComboBox comboBox = new JComboBox();
comboBox.addItem("one");
comboBox.setSize( comboBox.getPreferredSize() );
Rectangle location = textPane.modelToView( textPane.getCaretPosition() );
comboBox.setLocation(location.x, location.y);
comboBox.setSize( comboBox.getPreferredSize() );
textPane.add( comboBox );

代码示例来源:origin: stackoverflow.com

String[] numbers = {"1","2","3","4","5","6","7","8","9","10"};
JComboBox numberbox = null;
for(int j = 1; j <= 12; j++){
 numberbox = new JComboBox(numbers); 
 numberbox.setLocation(103,j*30);
 numberbox.setSize(47,26);
 numberbox.setSelectedIndex(1);
 numberbox.setBackground(Color.WHITE);
 panelForTextFields.add(numberbox);
 numberbox.addActionListener(this);
}

代码示例来源:origin: sing-group/GC4S

private void fixComboSize(JComboBox<Color> combobox) {
  Dimension d = new Dimension(120, 20);
  combobox.setSize(d);
  combobox.setMaximumSize(d);
  combobox.setPreferredSize(d);
}

代码示例来源:origin: cytoscape.coreplugins/attribute-browser

private void initApplyToComboBox(final Container contentPane) {
  applyToComboBox = new JComboBox();
  final int selectedCellRow = table.getSelectedRow();
  if (selectedCellRow >= 0)
    applyToComboBox.addItem(ApplicationDomain.CURRENT_CELL);
  final List<GraphObject> selectedGraphObjects = tableModel.getObjects();
  if (selectedGraphObjects != null && !selectedGraphObjects.isEmpty())
    applyToComboBox.addItem(ApplicationDomain.CURRENT_SELECTION);
  applyToComboBox.addItem(ApplicationDomain.ENTIRE_ATTRIBUTE);
  final Dimension widthAndHeight = applyToComboBox.getPreferredSize();
  final Dimension desiredWidthAndHeight = new Dimension(180, 30);
  applyToComboBox.setPreferredSize(desiredWidthAndHeight);
  applyToComboBox.setMinimumSize(desiredWidthAndHeight);
  applyToComboBox.setSize(desiredWidthAndHeight);
  applyToComboBox.setMaximumSize(desiredWidthAndHeight);
  contentPane.add(applyToComboBox);
  applyToComboBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        applicationDomain = (ApplicationDomain)applyToComboBox.getSelectedItem();
      }
    });
  applyToComboBox.setEditable(false);
  applyToComboBox.setEnabled(false);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore

private void initCombo(JComponent bar, JComboBox comboBox) {
  GridBagConstraints constrains = new GridBagConstraints();
  constrains.anchor = GridBagConstraints.WEST;
  //@inherited fix of issue #69642. Focus shouldn't stay in toolbar
  comboBox.setFocusable(false);
  Dimension size = comboBox.getPreferredSize();
  comboBox.setPreferredSize(size);
  comboBox.setSize(size);
  comboBox.setMinimumSize(size);
  comboBox.setMaximumSize(size);
  comboBox.setEditable(true);
  bar.add(comboBox, constrains);
}

代码示例来源:origin: org.apache.directory/com.springsource.org.apache.directory.server.core

m_rdnChoice.setMaximumRowCount( 6 );
m_rdnChoice.setSize( new java.awt.Dimension( 130, 24 ) );
m_attrPnl.setLayout( new java.awt.BorderLayout() );
m_attrPnl.add( m_attrScrollPnl, java.awt.BorderLayout.CENTER );

代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools

m_rdnChoice.setMaximumRowCount( 6 );
m_rdnChoice.setSize( new java.awt.Dimension( 130, 24 ) );
m_attrPnl.setLayout( new java.awt.BorderLayout() );
m_attrPnl.add( m_attrScrollPnl, java.awt.BorderLayout.CENTER );

代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools

m_rdnChoice.setMaximumRowCount( 6 );
m_rdnChoice.setSize( new java.awt.Dimension( 130, 24 ) );
m_attrPnl.setLayout( new java.awt.BorderLayout() );
m_attrPnl.add( m_attrScrollPnl, java.awt.BorderLayout.CENTER );

代码示例来源:origin: org.apache.directory/com.springsource.org.apache.directory.server.core

m_scopeLbl.setText( "Scope:" );
m_scopeLbl.setFont( new java.awt.Font( "Dialog", java.awt.Font.PLAIN, 14 ) );
m_scopeChoice.setSize( new java.awt.Dimension( 115, 25 ) );
m_scopeChoice.setMaximumSize( new Dimension( 32767, 25 ) );
m_scopeChoice.setMinimumSize( new java.awt.Dimension( 115, 25 ) );

代码示例来源:origin: org.apache.directory/com.springsource.org.apache.directory.server.core

m_rdnChoice.setMaximumRowCount( 6 );
m_rdnChoice.setSize( new java.awt.Dimension( 130, 24 ) );
m_attrPnl.setLayout( new java.awt.BorderLayout() );
m_attrPnl.add( m_attrScrollPnl, java.awt.BorderLayout.CENTER );

代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools

m_scopeLbl.setText( "Scope:" );
m_scopeLbl.setFont( new java.awt.Font( "Dialog", java.awt.Font.PLAIN, 14 ) );
m_scopeChoice.setSize( new java.awt.Dimension( 115, 25 ) );
m_scopeChoice.setMaximumSize( new Dimension( 32767, 25 ) );
m_scopeChoice.setMinimumSize( new java.awt.Dimension( 115, 25 ) );

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

void initGUI() {
  removeAll();
  classBrowserButton = new JButton("Examine...");
  classBrowserButton.setToolTipText("Opens a new window that lets you examine classes and create new object instances");
  classBrowserButton.addActionListener(this);
  classBrowserButton.setEnabled(false);
  //classBrowserButton.setActionCommand(COMMAND_CREATE_BEAN);
  DefaultComboBoxModel dcm = new SortedComboBoxModel();
  classField = new JComboBox(dcm);
  classField.setSize(400, (int) classField.getSize().getHeight());
  classField.addActionListener(this);
  classField.setEnabled(true);
  final JTextComponent tc = (JTextComponent) classField.getEditor().getEditorComponent();
  tc.getDocument().addDocumentListener(this);
  setBorder(new TitledBorder("Class browser"));
  setLayout(new BorderLayout());
  add("North", new JLabel("Full class name:"));
  add("Center", classField);
  add("East", classBrowserButton);
  adjustSize();
  updatedClassFilter();
  installSearchable();
}

代码示例来源:origin: openpreserve/jhove

_handlerBox.setSize (120, 20);
accessory.add (new JLabel ("Choose output handler"));
if (_lastHandler != null) {
  _encodingBox.setSelectedItem (_lastEncoding);
_encodingBox.setSize (120, 20);
_encodingBox.setEditable (true);   // Let user type in any encoding
accessory.add (new JLabel ("Select encoding"));

代码示例来源:origin: org.jbpm/jbpm-examples

contexts.setSize(new Dimension(80, 24));
c = new GridBagConstraints();
c.weightx = 1;

代码示例来源:origin: sc.fiji/Image_Expression_Parser

expressionField.setEditable( true );
expressionField.setBorder( new LineBorder( new java.awt.Color( 252, 117, 0 ), 1, false ) );
expressionField.setSize( 12, 18 );
jPanelLeft.add( expressionField, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( 10, 10, 10, 10 ), 0, 0 ) );
expressionField.addActionListener( new ActionListener()

相关文章

JComboBox类方法