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

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

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

JPopupMenu.pack介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-awt

/** Mysterious calls to pack(), invalidate() and validate() ;-) */
private static void refreshPopup(JPopupMenu popup) {
  popup.pack();
  popup.invalidate();
  Component c = popup.getParent();
  if (c != null) {
    c.validate();
  }
}

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

});
sortOptions.add(separateCreaturesCb);
sortPopup.pack();

代码示例来源:origin: omegat-org/omegat

private void setText(String text) {
    item.setText(text);
    menu.pack();
  }
});

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

private void updateMenu()
 {
  m_menu.removeAll();
  m_menu.add(new JMenuItem("1"));
  m_menu.add(new JMenuItem("2"));
  m_menu.add(new JMenuItem("3"));
  JPopupMenu popup = m_menu.getPopupMenu();
  popup.pack();
 }

代码示例来源:origin: org.jacorb/jacorb

public void mouseReleased(MouseEvent e)
{
if (e.isPopupTrigger() || e.getModifiers() == java.awt.event.InputEvent.BUTTON3_MASK )
{
  popup.pack();
  popup.show(table, e.getX(), e.getY());
}
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

/**
 * @param _x le x du popup menu
 * @param _y le y du popup menu
 */
public void popMenu(final int _x, final int _y) {
 if (listener_ == null) {
   return;
 }
 final JPopupMenu menu = listener_.getCmdsContextuelles();
 if (menu == null) { return; }
 menu.pack();
 menu.show(this, _x, _y);
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

/**
 * @param _x le x du popup menu
 * @param _y le y du popup menu
 */
public void popMenu(final int _x, final int _y) {
 final JPopupMenu menu = listener_.getCmdsContextuelles();
 if (menu == null) {
  return;
 }
 menu.pack();
 final Component in = menu.getInvoker();
 menu.show(in == null ? this : in, _x, _y);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

/** Gets popup menu. Overrides superclass. Adds lazy menu items creation. */
  public JPopupMenu getPopupMenu() {
    JPopupMenu pm = super.getPopupMenu();
    pm.removeAll();
    pm.add(new AddNavigationRuleAction());
    pm.add(new AddNavigationCaseAction());
    pm.add(new JSeparator());
    pm.add(new AddManagedBeanAction());
    pm.pack();
    return pm;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Mysterious calls to pack(), invalidate() and validate() ;-) */
private static void refreshPopup(JPopupMenu popup) {
  popup.pack ();
  popup.invalidate ();
  Component c = popup.getParent ();
  if (c != null) {
      c.validate ();
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Mysterious calls to pack(), invalidate() and validate() ;-) */
private static void refreshPopup(JPopupMenu popup) {
  popup.pack ();
  popup.invalidate ();
  Component c = popup.getParent ();
  if (c != null) {
      c.validate ();
  }
}

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

public void splitButtonClicked(ActionEvent e) {
  // build the popupmenu on the fly
  buttonUpdateDatasource.getPopupMenu().removeAll();
  buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(actionUpdateDatasources2));
  buttonUpdateDatasource.getPopupMenu().addSeparator();
  for (String ds : TvShowModuleManager.SETTINGS.getTvShowDataSource()) {
   buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(new TvShowUpdateSingleDatasourceAction(ds)));
  }
  buttonUpdateDatasource.getPopupMenu().addSeparator();
  buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(actionUpdateTvShow));
  buttonUpdateDatasource.getPopupMenu().pack();
 }
});

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-widget

@Override
  public void run() {
    getPopup().pack();
    Dimension dim = getPopup().getPreferredSize();
    JToggleButton invoker = getButton();
    getPopup().show(invoker, (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()), invoker.getHeight());
//        getPopup().setVisible(true);
  }
};

代码示例来源:origin: com.synaptix/SynaptixSwing

private void initComponents() {
  createComponents();
  label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  label.addMouseListener(new LabelMouseListener());
  label.setToolTipText(SwingMessages.getString("JDateHourTextField.2")); //$NON-NLS-1$
  popupMenu.add(buildEditorPanel());
  popupMenu.pack();
  this.add(label);
  this.addComponentListener(new DateTextFieldComponentListener());
}

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

@Override
    public void run() {
      ui.getPopup().pack();
      JToggleButton invoker = ui.getButton();
      Dimension dim = ui.getPopup().getPreferredSize();
      Dimension invokerDim = invoker.getSize();
      ui.getPopup().show(invoker, (int) (invokerDim.getWidth() - dim.getWidth()), invoker.getHeight());
//        getPopup().setVisible(true);
    }
  };

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-widget

@Override
  public void run() {
    ui.getPopup().pack();
    Dimension dim = ui.getPopup().getPreferredSize();
    JToggleButton invoker = ui.getChangeDecorator();
    ui.getPopup().show(invoker, (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()), invoker.getHeight());
  }
});

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

@Override
    public void run() {
      ui.getPopup().pack();
      JToggleButton invoker = ui.getButton();
      Dimension dim = ui.getPopup().getPreferredSize();
      Dimension invokerDim = invoker.getSize();
      ui.getPopup().show(invoker, (int) (invokerDim.getWidth() - dim.getWidth()), invoker.getHeight());
//        getPopup().setVisible(true);
    }
  };

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-widget

@Override
  public void run() {
    getPopup().pack();
    Dimension dim = getPopup().getPreferredSize();
    JToggleButton invoker = getButton();
    getPopup().show(invoker, (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()), invoker.getHeight());
  }
};

代码示例来源:origin: com.synaptix/SynaptixSwing

private void initComponents() {
  createComponents();
  label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  label.addMouseListener(new LabelMouseListener());
  label.setToolTipText(SwingMessages.getString("JDateTextField.1")); //$NON-NLS-1$
  calendarPanel.addChangeListener(new CalendarChangeListener());
  popupMenu.add(buildEditorPanel());
  popupMenu.pack();
  this.add(label);
  this.addComponentListener(new DateTextFieldComponentListener());
}

代码示例来源:origin: com.synaptix/SynaptixWidget

private void showPopupCalendar() {
  if (popupMenu.isVisible()) {
    popupMenu.setVisible(false);
  } else {
    LocalDateTime localDate = (LocalDateTime) formattedTextField.getValue();
    monthView.setSelectionDate(localDate != null ? localDate.toDate() : null);
    formattedTextField.requestFocus();
    popupMenu.pack();
    popupMenu.show(this, this.getWidth() - popupMenu.getPreferredSize().width, this.getHeight());
  }
}

代码示例来源:origin: com.synaptix/SynaptixWidget

private void showPopupCalendar() {
  if (popupMenu.isVisible()) {
    popupMenu.setVisible(false);
  } else {
    LocalDate localDate = (LocalDate) formattedTextField.getValue();
    monthView.setSelectionDate(localDate != null ? localDate.toDate() : null);
    if (localDate != null) {
      monthView.setFirstDisplayedDay(localDate.toDate());
    }
    formattedTextField.requestFocus();
    popupMenu.pack();
    popupMenu.show(this, this.getWidth() - popupMenu.getPreferredSize().width, this.getHeight());
  }
}

相关文章

JPopupMenu类方法