Sitemap

Amicuk Programming Answers

Detecting a mouse click on any (all) child components...

-0001-11-30   Views:0

Advertisement

Hey All, I am writing a number of compound GUI elements that i want to make focusable when you click any part of them. (i.e. a JTextArea inside a JScrollPane, coupled to a JTextField to provide input to the JTextArea). Is there an easy way to detect

Hey All,
I am writing a number of compound GUI elements that i want to make focusable when you click any part of them. (i.e. a JTextArea inside a JScrollPane, coupled to a JTextField to provide input to the JTextArea).
Is there an easy way to detect mouse clicks on child components of a JPanel?
My current code is:
m_oInputBox.addMouseListener(this);
m_oOutputBox.addMouseListener(this);
m_oScrollPane.getVerticalScrollBar().addMouseListener(this);
This detects most of the mouse clicks, but not those on the buttons that form the scroll bar ends or the scroll bar slider when it is present.
Any way tou can detect clicks on these too??
Iso

The replay answer
Advertisement
P.S. It does actually detect clicks on the scroll bar slider - just not onthe buttons that form the slider end caps (up/down).
Iso

Go to See the other 2 answers

Detecting a mouse click on any (all) child components...

Category:DefaultRelease time:-0001-11-30Views:130

Hey All, I am writing a number of compound GUI elements that i want to make focusable when you click any part of them. (i.e. a JTextArea inside a JScrollPane, coupled to a JTextField to provide input to the JTextArea). Is there an easy way to detect[More]

Detecting missing mouse clicks?

Category:DefaultRelease time:-0001-11-30Views:130

There are some times when a user clicks on a movie clip in my SWF that the mouse click goes undetected by any of my mouse event handlers. I even added a MouseClick listener at the root sprite of my SWF. Is there any way to detect where this mouse cli[More]

TreeSelectionListener detect if mouse click

Category:DefaultRelease time:-0001-11-30Views:130

hi, i've got a JTree and I'm using a TreeSelectionListener to carry out different actions when the user clicks on nodes. however, sometimes i want to change the selection on the tree programmatically (i know how to do this bit), and for the action as[More]

Detecting change of position and size of child components

Category:DefaultRelease time:-0001-11-30Views:130

As a JavafX learning excercise I want to create a scrollable container (Scrollbox). This may not seem a difficult thing to do but I want to simulate the CSS "overflow: auto" behaviour so the scrollbars only appear when the content overflows the[More]

Detect when mouse clicked over desktop

Category:DefaultRelease time:-0001-11-30Views:130

hello guys, i have a graduation project working with networking, the instructor on the server side presents a powerpoint slide show an when he moves to the next slide, i have to send an order to the students (clients) to move to the next slide. can i[More]

Mouse clicking

Category:DefaultRelease time:-0001-11-30Views:130

Hi all! Maybe it's too easy question, but I really appreciate your help! What listener should I use if I want to detect every mouse click wherever on the screen? When I add MouseListener to any Component, the MouseListener method mouseClicked is call[More]

Passing through a mouse click

Category:DefaultRelease time:-0001-11-30Views:130

I have a canvas with backgroundAlpha=0 over some other components, so that I can use rollOver and rollOut to trigger some events. However, i can't get the mouse to work with the components underneath the tranparent canvas. Is there a way to pass the[More]

Mouse clicks not detected on JTabbedPane

Category:DefaultRelease time:2015-10-11Views:130

Hi all, I have a JPanel placed inside a JTabbedPane. I want to double-click on the JPanel and bring up a JDialog. This works fine if the JPanel is not in a JTabbedPane, but if it is on a JTabbedPane, then the mouse clicks are not detected. I'd greatl[More]

Detect mouse clicks or keyboard events on desktop or everywhere

Category:DefaultRelease time:-0001-11-30Views:130

Hi, What I have to do is to start the application minimized in the system tray. Then the application must be listening for crtl+shift+left mouse click in any part of the desktop or an opened application, when that happens, I have to show a window ask[More]

Detecting mouse clicks in editable cell of JTable

Category:DefaultRelease time:-0001-11-30Views:130

Hi everyone :) I thought that this question might have been asked before, but I have searched the forums extensively and have not been able to find the solution. What I want to achieve is to detect single and double mouse clicks on JTable cells (that[More]

How to detect mouse clicks on desktop?

Category:DefaultRelease time:-0001-11-30Views:130

Hi All, I need to detect mouse clicks on the desktop and find out mouse position on the screen. How to listen to mouse events if I don't have any swing components like containers, panels, windows, etc? All things like "addMouseListener" are supp[More]

Hot
I'm not sure if this post is in the right area: I have about 5 apps that I purchased through my wife's account at the iTunes store. Is there a way that I can transfer these apps to my account? It sure would make updates through iTunes easier, as righ [More]
I'm trying to load Itunes onto a computer that already has a version of itunes on it. I get a message that says "error: -1639 invalid command line argument" Does anyone know what this means? Does this mean I can't load itunes onto a computer tha [More]
We are currently using some fairly archaic processes, whereby dynamic forms are completed digitally, printed, signed by hand, and then rescanned as static PDFs back onto our shared server. We are considering ways of streamlining this process, and one [More]
Hi, I have experienced oracle fallowing errors while making the BCV. Errors in file /cbsora/ora92/rdbms/log/udump/bobind_ora_29118.trc: ORA-27154: post/wait create failed ORA-27300: OS system dependent operation:semget failed with status: 28 ORA-2730 [More]
Hi, when installing the SSDTBIVS2012 Business Intelligence Studio I always get a very useless "BlockMixedArchitectureInstall" error that tells me I should add some functionality to my SQL-Server instance, but does not tell me at all what functio [More]
Hi All, I am preparing for the certification on Business Objects PLATFORM 4. with help of below documents. 1)BOE 320 : Business Object Enterprise XI 3.0/3.1 : Administering the server. 2)BOE 330: BusinessObjectsEnterpriseXI3.0/3.1:Designing and Deplo [More]
Hi All, Our app has requirement to maintain state across many root AM, by storing it in DB on UserId+HttpSessionId. (or is there any other way to do this ? ) So in prepareSession in each root AM I need to query to DB by UserId+HttpSessionId then stor [More]
Hi, Just discovered a nasty "feature" in mail.app. If you have a POP (or IMAP I suppose) defined and configured and which contains a bunch of mails (thousands, sigh) and you happen to define the same account again in the account preferences and [More]
My ipad screen left a deep scratch whilst playing a game how do I get rid of ItYou can't without replacing the screen, which is expensive. How did it get the deep scratch? You probably should have put a screen protector on it.  Cheers, TomRead other [More]
In order to use my mail, I now have to use the browser instead of my mail application because of the new "upgrade". Unfortunately, my online mailbox keeps blacking out saying that my messages more than a week old cannot be displayed at this time [More]