This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When running on a multi-monitor system, all menus and context menus always appear on monitor 0 (Primary Display) regardless of which monitor(s) NetBeans is running on. Menus and such are being drawn to monitor relative coordinates on monitor 0 rather than absolute coordinates.
I think it's window system.
Hi, The dropdown menus still appear on the primary monitor on OSX with RC1 (OS: 10.3.3, Java 1.4.2_04) so this is not just a Windows issue. It was supposed to be fixed with http://www.netbeans.org/issues/show_bug.cgi?id=38375 so maybe that fixed didn't make it into RC1? Travis
Unfortunately some fixes for dual monitor didn't make it into 3.6.
*** Issue 44259 has been marked as a duplicate of this issue. ***
If you use the SDI window system with 3.6 and position windows on both monitors. After exiting netbeans and restarting it, all windows appear on the main/first monitor. I believe these issues are related to the call to java to get the screen dimensions, this only processes the first monitors size. Toolkit.getDefaultToolkit().getScreenSize()
With regards to popup menus and toolbar menu showing up on the primary display when the main frame is on the secondary display in Windows XP. I had investigated this issue and found the problem to be the method overides in the implementations of org.openide.awt.JPopupMenuPlus and JMenuPlus. Commenting out the overrides, compiling, jaring and placing in the lib/locale direcory is a good way to patch the platform if a quick fix is needed... The windows dual monitor support is very wacked... The secondary display reports positions in the various events that appear to be off screen relative to the reported display size. The JPopupMenuPlus and JMenuPlus implementations try to put the menus "onscreen" which turns out to be coordinates on the primary display.
1. Should probably be assigned to Tim; he is the one likely to be fixing JPopupMenuPlus and its evil brethren. 2. Probably too late for 4.0.
I think this is a duplicate of bug 25383
There already is a workaround - start NetBeans with -J-Dnetbeans.popup.no_hack=true This is not on by default, because it can cause menus to "flash" (be redisplayed several times when they are shown) - which is due to some very old and hard to remove hacks (JInlineMenu and its evil brethren).
The workaround works pretty good for me. Maybe this can be a configuration option or something? But thanks anyway, this makes working with netbeans on my system a lot easier...
BTW, even with the workaround, tooltips are still displayed on the wrong screen.
I don't think we do anything special with tooltip placement - NetBeans doesn't replace the default tooltip manager to my knowledge, so that's probably a JDK bug. What JDK are you using? If not 1.5, does it work right in 1.5?
More relevant question: If you create a generic Swing app (say a form with a button that has a long tooltip), does the tooltip show up on the correct monitor? If it does not, it's a Swing bug (the fix will probably be in PopupFactory), but might be able to be worked around if we wanted to provide our own version of PopupFactory. It *should* be detectable if there is more than one display device.
I will try out as soon as I have multiple monitors available again. I am currently outsourced, and the buggers only have one monitor :(
Passing to Trung at his request.
With the 200409022120 build, the tooltips now appear on the correct monitor, regardless of the "nohack" option. With the "nohack" option the menus and contextual menus also appear on the apppropriate monitor. The only odd behaviour I found was that secondary dialog boxes appear on the main monitor rather than the monitor containing the primary dialog box. Travis
*** Issue 47719 has been marked as a duplicate of this issue. ***
*** Issue 46470 has been marked as a duplicate of this issue. ***
*** Issue 25383 has been marked as a duplicate of this issue. ***
updated summary
AWT since 1.3 provides multiple-monitor support API. We can fix this bug reliably, no need to hack
fixed 1.18 JPopupMenuUtils.java
You should fix also JMenuPlus.java and JPopupMenuPlus.java and completely remove the flag: Boolean.getBoolean("netbeans.popup.no_hack"); If you succeed please update also the API documents since I have mentioned the flag there also. I am willing to do some testing on my dual monitor machine if you are interested ;-)
both JMenuPlus.java and JPopupMenuPlus.java call into JPopupMenuUtils.java. It works correctly for my dual monitor setup, both windows and linux. Can you please verify, take the latest nightly or build the IDE from the CVS trunk I'll wait for verification before removing your hack
Note also d-eprg05-75-206:/space/nb_another/core/windows tim$ grep -r "no_hack" * src/org/netbeans/core/windows/view/ui/slides/CommandManager.java: private static final boolean NO_POPUP_PLACEMENT_HACK = Boolean.getBoolean("netbeans.popup.no_hack"); // NOI18N src/org/netbeans/core/windows/view/ui/TabbedHandler.java: private static final boolean NO_POPUP_PLACEMENT_HACK = Boolean.getBoolean("netbeans.popup.no_hack"); // NOI18N d-eprg05-75-206:/space/nb_another/core/windows tim$ grep -r "NO_POPUP" * src/org/netbeans/core/windows/view/ui/slides/CommandManager.java: private static final boolean NO_POPUP_PLACEMENT_HACK = Boolean.getBoolean("netbeans.popup.no_hack"); // NOI18N src/org/netbeans/core/windows/view/ui/slides/CommandManager.java: if (NO_POPUP_PLACEMENT_HACK) { src/org/netbeans/core/windows/view/ui/TabbedHandler.java: private static final boolean NO_POPUP_PLACEMENT_HACK = Boolean.getBoolean("netbeans.popup.no_hack"); // NOI18N src/org/netbeans/core/windows/view/ui/TabbedHandler.java: if (NO_POPUP_PLACEMENT_HACK) {
Hehe, it was not my hack. I just added the option to actually disable some strange hacks (by Evan Adams BTW).
Sorry it took so long. I have now verified that it works correctly using build number 200409221800 on my dual monitor WinXP box. There was no need to specify the command line option. If someone have time for this the command line option can be removed from all the places.
This issue had *1 votes* before move to platform component
Hi All, I need an immediate help from you all regarding my problem . It describes as below : The below are my use cases : 1. JDK 7 used. 2. OS - Ubuntu/windows XP/2008 3. A java swing built-up swing portal application is causing the issue. 4. Tested with extending more than 1 monitors, i.e. Laptop / primary monitors are attached with other secondary monitors attached and then running swing portal application. 4. This happens when you use "Extended Desktop" with two screens. Main screen left Second screen right Portal is visible on two screens. Open a context menu (right mouse) on the right screen, the context menu open on the left (Main) screen instead of the right The below is the sample of code of the file that actually open up the popups. The bold italics methods are the call hierarchy that are responsible to finally call the showPopupMenu(). private synchronized void handleMouseEvent( final IDirNodeMouseEvent e ) { if ( e.getMEvent().isPopupTrigger() ) { Thread thread = new Thread( new Runnable() { public void run() { JNDITreeNode node = (JNDITreeNode) e.getNodeAtEventLocation(); System.out.println(" --- handleMouseEvent ---"); createPopupMenu(e.getMEvent().getPoint(), e.getMEvent().getComponent(), node); } } ); thread.start(); } private synchronized void createPopupMenu(final Point point, final Component c, JNDITreeNode node) { contextMenuDN = node.getDn(); CursorHelper cursorHelper = CursorHelper.showWaitCursor(c); com.marconi.platform.cvb.bcmp.security.AbstractDNPanel.registerJndiTreeNode(node); ContextMenuFactory contextMenuFactory = new ContextMenuFactory ( context ); contextMenuFactory.setAttributeViewDisplayText(node.getDisplayText()); TreeNodeDescriptor treeNodeDescriptor = new TreeNodeDescriptor( node.getDn(), node.getDirData() ); boolean searchContextAvailable = true; JNDIData data = node.getDirData(); Attributes attrs = data.getAttributes(); Attribute a = attrs.get("mSearchContextAvailable"); try { if (a != null) { String value = (String)a.get(); if (value.equalsIgnoreCase("FALSE")) searchContextAvailable = false; } } catch (NamingException ne) { } jMenuItemSearch.setEnabled(searchContextAvailable); JPopupMenu menu = contextMenuFactory.getPopupContextMenu( treeNodeDescriptor ); menu.addSeparator(); menu.add( jMenuItemCollapseAll ); menu.add( jMenuItemSearch ); if ( contextMenuDN != null ) { menu.add(jMenuItemUpdate); } MUtils.showPopupMenu(menu, point, c); cursorHelper.showDefaultCursor(); } /** * MUtils ensures that the whole popup menu is visible, performs a cleanup before showing. * @param popupMenu the menu to be shown * @param mouseClickPoint where the mouse has been clicked * @param c the component on which to show the popup menu * @see cleanupMenu */ public static void showPopupMenu( final JPopupMenu popupMenu, final Point mouseClickPoint, final Component c) { if ( popupMenu.getComponentCount() == 0 ) return; cleanupMenu( popupMenu ); if ( autoAssigningMnemonics ) { assignMnemonics( popupMenu ); } final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); final Point result = new Point(mouseClickPoint); SwingUtilities.convertPointToScreen( result, c); Dimension popupSize = popupMenu.getPreferredSize(); popupSize.height = popupSize.height + 30; // as Windows TaskBar is overlapping always if ( popupSize != null ) { if ( result.getX() + popupSize.getWidth() > screenSize.getWidth() ) { result.setLocation( screenSize.getWidth() - popupSize.getWidth() , result.getY() ); } if ( result.getY() + popupSize.getHeight() > screenSize.getHeight() ) { result.setLocation( result.getX(), screenSize.getHeight() - popupSize.getHeight() ); } } result.x = Math.max( 0, result.x ); result.y = Math.max( 0, result.y ); SwingUtilities.convertPointFromScreen( result, c ); javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run() { popupMenu.show( c, (int) result.getX(), (int) result.getY()); } } ); } Please let me know how to resolve it !!!