本文整理了Java中javax.swing.JPopupMenu.setSize()
方法的一些代码示例,展示了JPopupMenu.setSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPopupMenu.setSize()
方法的具体详情如下:
包路径:javax.swing.JPopupMenu
类名称:JPopupMenu
方法名:setSize
暂无
代码示例来源:origin: log4j/log4j
protected void showPopup(CategoryNode node, int x, int y) {
JPopupMenu popup = new JPopupMenu();
popup.setSize(150, 400);
//
// Configure the Popup
//
if (node.getParent() == null) {
popup.add(createRemoveMenuItem());
popup.addSeparator();
}
popup.add(createSelectDescendantsMenuItem(node));
popup.add(createUnselectDescendantsMenuItem(node));
popup.addSeparator();
popup.add(createExpandMenuItem(node));
popup.add(createCollapseMenuItem(node));
popup.addSeparator();
popup.add(createPropertiesMenuItem(node));
popup.show(_renderer, x, y);
}
代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-common
@Override
public void action( Dockable dockable ) {
titleField.setText( "" );
menu.setSize( menu.getPreferredSize() );
titleField.setText( dockable.getTitleText() );
Component component = DockUtilities.getShowingComponent( dockable );
if( component != null ){
current = dockable;
menu.show( component, 0, 0 );
titleField.requestFocus();
}
}
代码示例来源:origin: xyz.cofe/docking-frames-common
@Override
public void action( Dockable dockable ) {
titleField.setText( "" );
menu.setSize( menu.getPreferredSize() );
titleField.setText( dockable.getTitleText() );
Component component = DockUtilities.getShowingComponent( dockable );
if( component != null ){
current = dockable;
menu.show( component, 0, 0 );
titleField.requestFocus();
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
protected void showPopup(CategoryNode node, int x, int y) {
JPopupMenu popup = new JPopupMenu();
popup.setSize(150, 400);
//
// Configure the Popup
//
if (node.getParent() == null) {
popup.add(createRemoveMenuItem());
popup.addSeparator();
}
popup.add(createSelectDescendantsMenuItem(node));
popup.add(createUnselectDescendantsMenuItem(node));
popup.addSeparator();
popup.add(createExpandMenuItem(node));
popup.add(createCollapseMenuItem(node));
popup.addSeparator();
popup.add(createPropertiesMenuItem(node));
popup.show(_renderer, x, y);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
protected void showPopup(CategoryNode node, int x, int y) {
JPopupMenu popup = new JPopupMenu();
popup.setSize(150, 400);
//
// Configure the Popup
//
if (node.getParent() == null) {
popup.add(createRemoveMenuItem());
popup.addSeparator();
}
popup.add(createSelectDescendantsMenuItem(node));
popup.add(createUnselectDescendantsMenuItem(node));
popup.addSeparator();
popup.add(createExpandMenuItem(node));
popup.add(createCollapseMenuItem(node));
popup.addSeparator();
popup.add(createPropertiesMenuItem(node));
popup.show(_renderer, x, y);
}
代码示例来源:origin: net.java.openjdk.cacio/cacio-shared
public void show(Event e) {
JMenu m = (JMenu) getSwingMenu();
JPopupMenu pm = m.getPopupMenu();
Dimension d = pm.getPreferredSize();
// TODO: Fix location relative to target.
pm.setLocation(e.x, e.y);
pm.setSize(d.width, d.height);
pm.setVisible(true);
// TODO: Add listener for closing the popup menu.
}
代码示例来源: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());
}
内容来源于网络,如有侵权,请联系作者删除!