javax.swing.JPopupMenu.setPreferredSize()方法的使用及代码示例

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

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

JPopupMenu.setPreferredSize介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

filterPopup.setPreferredSize(new Dimension(300, 300));
makeButtonPopup(filterButton, filterPopup);
filterButton.setVisible(false);

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra

public final void setPreferredSize(Dimension preferredSize) {
  menu.setPreferredSize(preferredSize);
}

代码示例来源:origin: org.bidib.org.oxbow/swingbits

public final void setPreferredSize( Dimension preferredSize ) {
  menu.setPreferredSize(preferredSize);
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

public final void setPreferredSize(Dimension preferredSize) {
  menu.setPreferredSize(preferredSize);
}

代码示例来源:origin: eugener/oxbow

public final void setPreferredSize( Dimension preferredSize ) {
  menu.setPreferredSize(preferredSize);
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Edits the column at the supplied index.
 *
 * @param columnIndex the column index
 */
private void editColumnAt(int columnIndex) {
  if ((columnIndex != -1) && (columnIndex != model.getGeometryFieldIndex())) {
    tableColumn = columnHeader.getColumnModel().getColumn(columnIndex);
    Rectangle columnRectangle = columnHeader.getHeaderRect(columnIndex);
    columnTextField.setText(tableColumn.getHeaderValue().toString());
    renamePopup.setPreferredSize(
        new Dimension(columnRectangle.width, columnRectangle.height - 1));
    renamePopup.show(columnHeader, columnRectangle.x, 0);
    columnTextField.requestFocusInWindow();
    columnTextField.selectAll();
  }
}

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

public void showList() {
 if (model == null) {
  rebuildModel();
 }
 if (model.getSize() > 0) {
  getPopup().setPreferredSize(null);
  Dimension dim = getPopup().getPreferredSize();
  dim.width = this.invoker.getWidth();
  getPopup().setPreferredSize(dim);
  getPopup().show(invoker, 0, invoker.getHeight());
 }
}

代码示例来源:origin: GoldenGnu/jeveassets

int maxScroll = menuItems.length - (topFixedCount + bottomFixedCount + 2);
if (scrollCount ==  maxScroll) { //Show All
  menu.setPreferredSize(null);
  return;
  preferredWidth = Math.max(preferredWidth, item.getPreferredSize().width);
menu.setPreferredSize(null); //Reset height
menu.setPreferredSize(new Dimension(preferredWidth, menu.getPreferredSize().height));

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

preferredWidth = Math.max(preferredWidth, item.getPreferredSize().width);
menu.setPreferredSize(new Dimension(preferredWidth, menu.getPreferredSize().height));
JComponent parent = (JComponent) upItem.getParent();
parent.revalidate();

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

private void showButtonsChooser() {
 if (isEnabled()) {
  Dimension dim = getSize();
  Dimension bcDim = getActionsRoot().getPreferredSize();
  Insets insets = getActionsChooser().getInsets();
  int width = dim.width;
  width = bcDim.width + insets.left + insets.right;
  int height = bcDim.height + insets.bottom + insets.top;
  Dimension newDim = new Dimension(width, height);
  getActionsChooser().setPreferredSize(newDim);
  getActionsChooser().show(this, 0, dim.height);
 }
}

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

jTextField2.addKeyListener(new java.awt.event.KeyAdapter() {
   public void keyReleased(java.awt.event.KeyEvent evt) {
     showPopup(evt);
   }
 });
void showPopup(java.awt.event.KeyEvent evt) {
   JPopupMenu popup = new JPopupMenu();
   popup.setLightWeightPopupEnabled(false);
   popup.setBorder(BorderFactory.createLineBorder(Color.black));
   popup.setLayout(new BorderLayout());
   popup.setSize(this.getPreferredSize());
   popup.setPreferredSize(this.getPreferredSize());
   popup.pack();
   popup.setOpaque(false);
   // create panel that contains the search result 
   popup.add(BorderLayout.CENTER, <YOUR PANEL WITH THE RESULT>);
   popup.setPreferredSize(new Dimension(jTextField2.getWidth(),250));
   <SEARCH PANEL>.setPreferredSize(new Dimension(jTextField2.getWidth(),250));
   popup.show(jTextField2, 0, jTextField2.getHeight());
  }

代码示例来源:origin: JChemPaint/jchempaint

Dimension d = p.getPreferredSize();
d = new Dimension((int)(d.width * 2.5), (int)(d.height * 0.7));
p.setPreferredSize(d);
p.setLayout(new FlowLayout());

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

int height = bcDim.height + insets.bottom + insets.top;
Dimension newDim = new Dimension(width, height);
getButtonsChooser().setPreferredSize(newDim);
getButtonsChooser().show(SplitButton.this, 0, dim.height);

相关文章

JPopupMenu类方法