Focus « Menu « Java Swing Q&A





1. JPopupMenu should not lose focus    stackoverflow.com

Question about JPopupMenu behavior. I would like the JPopupMenu not to loose focus when it comes up. Also when JPopupMenu is in focus, the user should be able to click/update ...

2. Focus traversal is not working even though JPopupMenu has focus    stackoverflow.com

I have a JTree and right click on any node in that tree opens a JPopupMenu. I have set mnemonics for each of the menu items in the popup menu. If ...

3. Focus in a JPopupMenu    coderanch.com

Hi, I'm having quite a bit of trouble getting the focus into a popup menu. Here's what I'm doing: I created a JPopupMenu and added a JList as it's only component. I created a JButton that when clicked on displays the popup menu. What I want is for the popup menu to be displayed and the JList in the menu to ...

4. Lost the focus from desired component while one use the menu option    coderanch.com

Hi,

I have multiple Textcomponents (JTextField) in single panel and have "Edit" functionality i.e. "cut", "copy", "past" and "select All" through menubar. For the above mentioned functionality, first, I have to identify my focused component. But when I use "Edit" menu option, the focus has been changed to menu item and I have not get expected focused component.

But ...

5. Focus problem in 1.4_2 when JPopupMenu show is called    coderanch.com

Hi, there: I have an application, with a JTextField when that textfield gained focus, a popup menu is shown, and when it lost focus, the popup menu is hidden. My focus listener class is listed below, where popup is JPopupMenu, and function displayPopup() is just to call show() in JPopupMenu: class MyFocusListener extends FocusAdapter { public void focusGained(FocusEvent e) { System.out.println("focus ...

6. JMenu Focus    coderanch.com

7. mnemonics are not getting focus for the menubar    coderanch.com

Seems to work in j2se 1.6.0_07 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MnemonicTest { private JDesktopPane getContent() { JInternalFrame jif = new JInternalFrame("title", true, true, true, true); jif.setSize(300,300); jif.setLocation(25, 25); jif.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(jif); return desktop; } /** Copied from menu page in the java tutorial. */ private JMenuBar getMenuBar() { //Create the menu bar. JMenuBar ...

8. Adding a JPanel to a JMenu - Focus issues    java-forums.org

Hi all, I am working on a requirement and have come across something unexpected. The expected behaviour when working with menu items is when adding a JMenuItems to a JMenu and making the Menu visible, moving the mouse over each of the items highlights that items and allows each to be selected. However when I add a JPanel to a JMenu, ...

9. Losing focus, between game and JMenu    forums.oracle.com

Hi, im basically creating a game. In its main window (the JFrame) it consists of a JMenuBar, and a canvas(JComponent implements keylistener) for refreshing and drawing the game. Basically ive set it up so you click on the menu and can hit new game, then the game starts. This all works perfectly except the game is not responding to any of ...





10. Problem with jPopupMenu getting focus    forums.oracle.com

By default when you make the popupmenu visible it should get the focus. If it does not, maybe you have some component behind it that is grabbing the focus away from it. Check your other components if you have some manual focus handling somewhere. Also, button 3 is the right mouse button for you? It is the middle one on any ...