I am making a input spinner component. It's almost working, I just was unable to get long mouse click in the up and down buttons.
Is it possible? If yes, how can I do that?
Check out http://code.google.com/p/gwt-incubator-1-5-wiki/wiki/Spinner
It has the feature you're looking for. You can either use the component it self or see how it implements the feature
Related
I'm trying to find a way to tell what object fired my onClick event. I have a checkbox that currently fires once when the checkbox is clicked and fires twice when the label is clicked. I want to be able to ignore when the label is clicked.
I have found some code that is similar to what I want here which explains how to use a gxt FieldEvent, but i'm using a gxt BaseEvent and i'm not able to change it to a field event. Is there an equivalent function to .getTarget() for BaseEvents?
TLDR; Does anyone know how to do an equivalent of what's here but using gxt BaseEvent rather than FieldEvent?
According to the api here:
http://dev.sencha.com/deploy/gxt-2.2.5/docs/api/com/extjs/gxt/ui/client/event/BaseEvent.html
you should be able to call the getSource() method and then extract the name. Was this what you were looking for?
I am trying to find the java class name for this widget. It looks like a bubble pop up when the user hovers the mouse on an item. This widget is normally used to display a short description about the item. You would often see this on the toolbar button when the mouse is on the button. If anyone has used Qt, it would be similar to the QWhatsThis widget. Is there an equivalent widget in java ?
It is probably a Tool Tip, though it's difficult to say without seeing a screenshot.
I have a JFrame which contains most everything in the application. It has a KeyListener attached, and it also has several buttons and textfield on it. The problem it, when a button is clicked or a textfield is selected, it gets focus and shortcuts don't work. Of course, one can tab out of them, but to do this you must tab through EVERYTHING (each button, each textfield) before giving the window focus again.
Is there a sensible way to only require one tab to return focus to the frame from the textfield, and no tabs to return focus to the frame from a button click?
A WindowListener doesn't seem like the best way to do this, but if it's the only way I suppose I can forge forward there.
Thanks in advance!
It has a KeyboardListener attached
I have never heard of the KeyboardListener class so I can only guess what you are trying to do.
My guess is that you should NOT be using a listener of any kind.
Instead you should be using Key Bindings.
If you only need this for the textfield, you can add a keyListener to the textfield and when the user presses tab use yourJFrame.requestFocus(). Otherwise refer you may want to use a window manager or a key map.
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.
Is there a way to globally make right click also select the element that you right click on?
From what I understand this has been a bug in Swing for a long time likely to never be fixed because at this point applications depend on it.
Any advice on doing this on a global scale? Perhaps on the L&F?
Using the Glass Pane will do the trick.
Here's a tutorial on how to use the glass pane to get the right click button and redispatch it to the right component.
As the glass pane is not a solution in this case, I suggest you take a look at the Toolkit class. Specificaly the addAWTEventListener method. You can add a global event listener with it. To add a mouse event listener:
Toolkit.getDefaultToolkit().
addAWTEventListener(listener, AWTEvent.MOUSE_EVENT_MASK);
Cheers