Click « Menu « Java Swing Q&A





1. How to add a menu by Right clicking a particular object in the GUI? (In Eclipse RCP)    stackoverflow.com

I wanted to add a right click menu, by selecting a column in my GUI. Any suggestions how to do it?

2. How can i display new GUI based on menu click    stackoverflow.com

I am learning java and building one project to test basics. I have one menu item FILE and then sub menu item like

1)Front
2)Admin
3)Booking
I have separate gui made in separate files but i ...

3. Automation : Accessing a webpage which is loaded dynamically by clicking a menu item on a swing application    stackoverflow.com

I am trying to automate a testcase where I need to access the help webpage of a swing application. I need to move the focus from the swing app to the ...

4. Create menu on button click in Java    stackoverflow.com

For a project we want to create a button which will make a tiny menu when it is clicked (the way it works is similar to back button's drop-down menu in ...

5. How to catch click on a JMenu element?    stackoverflow.com

I'm developping a Java/Swing application with a menu using JMenuBar, JMenu and JMenuItem. System look and fell is applied to the UI.

UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
I have several top level elements for my menu ...

6. Refresh of Jframe with new components at Runtime upon clicking a JMenuBar    coderanch.com

Hi techies: I am new to Swing.I am developing a Jframe based application with 2 methods(one for Add a issue and for viewing a issue with different components altogether). Can anyone here provide me with code as how to update with this Add and View functions whenever I click the Selected Items in a MenuBar. i.e Add>>>displayAdd(); View>>DisplayView(); Both these methods ...

7. Open new window from menu click    coderanch.com

8. JMenu keep open with right click    coderanch.com

Hi. I need help with a mouse listener on a menu I made. I added a mouse listener to the each Menu item. If a user left clicks the menu item, it opens the option. But if he right clicks on the menu item, it should keep the menu open and display the right click popup menu. I got the popup ...

9. Right-Click on JMenuItem    coderanch.com

I spent a little bit of time with this tonight. Couldn't get it perfect, but maybe this will get you started: import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; public class PopupTest extends JFrame implements MouseListener { public static void main(String[] args) { new PopupTest(); } public PopupTest() { super("Popup Test"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setJMenuBar(buildMenuBar()); setSize(300, 300); ...





10. opening a frame on click on JMenuItem    coderanch.com

11. Prevent JPopupMenu from hiding when clicked outside the menu    coderanch.com

Second edit: This prevents the popup from closing if you click elsewhere in the JFrame (or more correctly, its content pane). Clicking a menu item hides the popup; if that too is undesired, see my blog post Keeping Menus Open. I don't think there's any reasonable, LaF independent way to keep the popup open if the mouse is clicked outside the ...

12. Right-click menu    coderanch.com