Java - Right Clicking JTabbledPane Tab - java

I have it working, however the popup menu appears when you right click anywhere inside the tab. I only would like it to appear when you right click the top of the tab (the name). I cannot figure out how to do this. Any help is appreciated.
Thanks.

Try adding your popup to the custom component demonstrated in TabComponentsDemo.

Related

Java netbeans jlabel visibility when changing tabs

I am having a problem with my jframe gui program ... basically I created a gui with 2 tabs (Home & About) .. and I can switch between the tabs easily which works fine. I also put a button in the about tab which when I click , a pop up appears. Now I want that pop up to stay there even if I switch tabs .. my problem is when I go to the home tab and go back to the about tab , the pop up is gone (I have to click the button again) , I was wondering if there is a way to make it stay there. This is a gif showing my exact problem
any help will be highly appreciated!! thanks :)

Java - Extra Window Button

Google Chrome Recently had an update that added an extra button onto to the top of the window that allowed you edit your account settings. I have a great use for an extra button like this one but I do not know how to make it. So, how can I add an extra button at the top of the window?
This is what I would like to do or have in mind.
This is more of an amateur/simple answer but it could be possible just to make a title bar with all of the drop downs without text until you reach the button you want and customize that

How to make a hidden "Exit" button in java netbeans?

I want to create a hidden button in netbeans. Suppose if I click a Next button then a new "Exit" button will be appear in the same jFrame. Until I click the Next button the Exit button will not be shown. So how to make it? I mean how to make a button which is by-default in .setVisible(false) in netbeans?
Please help me out about this problem.
Since you already seem to know the proper method I assume you doubt is about Netbeans operation.
Right click in the method and select "Customize Code".
Then you'll have the chance to add the proper code after the button creation.
Use JButton.setVisible(false); right after you create the button.

How to set focus on a particular tab in jface on button click

The problem I am facing right now is that I want a particular tab on the tabbedfolder to be the active one on click of a button. I have tried the setFocus() method on the composite contained in this tab but it is not working how to do so?
Try to use
tabFolder.setSelection(tabIndex/tabItem)
Also, you may want to use
tabItem.getControl().setFocus()
Hope this helps.

JButton inside JMenuItem

I'm trying to build a particular JMenu.
I want a JMenuItem with JMenu functionality, I.E. when we click it the item should do something (like opening a dialog). But the JMenuItem should also contain a button (or other component) that when we click it, should open a popup with a couple of options.
So, till now I have something like this:
That is what I have before click the arrow.
My problem is that, when I press the button (arrow), the sub-menu is actually opened, but the menu item that contains that button closes because loses focus.
That is the result after clicking in the arrow button.
Is there any way to manage this? Or a better way to have this behavior?
We can guide you if we know exactly what you are trying to implement. If you just want to select an option, you can implement that in better way with the JRadioButtonMenuItem,so you dont really need to implement a button and then select an option.But it depends on what you really want.
That's not what a menu is intended for. Use a ribbon instead, and these things will be easy and natural.
Why not just use simple nested JMenuItem instead?
Something like this (First screen from the top).
On the other hand you can benefit from a similar solution described here.
Couldn't actually find a solution for this particular problem.
As a workaround, I used just a simple button that toggle between the option 1 and option 2, instead of having the button (arrow) that open a new popup.
Thanks a lot for your help.

Categories

Resources