SWT Tray Icon Popup - java

I'm playing with a Tray and TrayItem in SWT, and i was wondering if there was a way of getting the location on screen of the icon. I want to be able to position another shell just underneath it as if it were a popup.
Basicaly just having a mare trying to find the dimensions and location of it....
Any ideas?
Cheers
Andy

Why would you need this?
If the trigger for displaying the pop-up is a mouse click, you can use the Event object of the listener to get the co-ordinates.
If not, I don't think its a good idea to do this. Mainly because you never know whether a tray icon will be visible or not (in Windows 7 for example). If you are using Gnome, you can use libNotify, which is a much better choice for pop-ups.

Related

How to "fake" someone clicking the fullscreen button

I am making a javafx application and I made the border around it invisible but now I would like to know how to "fake" someone from clicking on the fullscreen button (in Windows the middle button in the right top corner). I know how to make it 100% fullscreen but I just want to know how to "fake" the clicking of the windows fullscreen button.
Thanks.
Solution
I think you refer to a maximize button, and perhaps the stage.setMaximized() method.
Maximized != Full Screen
Setting the stage fullscreen viastage.setFullScreen() is generally a different thing than maximizing a stage. A full screen stage operates in full screen exclusive mode (i.e. no windowing at all, the stage takes over the entire display).
Related
What you seem to be doing is creating an undecorated window (i.e. a window with no default OS window frame and no in-built controls for resizing, title and minimize/maximize/close), but you still want some of the functionality that you would get if the window were decorated (by adding your own custom decoration controls to provide it). For more information on how to tackle that problem, see the related question:
JavaFX entirely customized windows?
In particular, checkout the Undecorator project, which is the defacto standard way of supplying such functionality for JavaFX.

JAVA - Get mouse location when mouse is clicked

I need to get the absolute location of mouse after a click on the screen. I've already searched on the web but the only solution I have found uses this method:
MouseInfo.getPointerInfo().getLocation()
which gets the position independently from the click.
Otherwise, i have to use an EventListener to check out when the mouse is clicked, but the problem is that listeners are related to a component, while i need the absolute location.
How can i solve this?
This is an OS dependent feature. As far as I understand your question, you don't have a GUI or you don't want to add a listener to your GUI components. JVM will only receive clicks for components that are related to it.
Here you have to write some native code to hook to events that you want on your own, or you should use a library like jnativehook that does the same thing for you and you don't need to write code for Linux, Mac OS X and Windows.

System tray with Java

I've set my program to appear in the system tray by doing what Oracle told to do. My first question is about the icon. I have a lot of programs in the system tray and mine is hidden. Can I make it to show in the bar without needing to click the arrow in the tray?
I also figured out that I can display a message by calling trayIcon.displayMessage(title, content, icon). I wonder if I can change the outlook of the balloon in the way Skype has done it.
Or do I need to use someting else do display a message? It should appear always in the front of all the applications and it shouldn't hinder other applications. For example if the user is playing a game, the information dialog shouldn't steal the focus from mouse and keyboard.
No you cant change the style of the baloon using the java systray mechanism. Skype doesnt use the java mechanism to show the systray. It is the systems task to style and display the baloon.
To show your icon, it is a windows configuration - when you click the arrow, there is a "customize" link, where you can configure which icons are displayed.
If you want to influence the style of the window, you need to implement your custom Frame that feels like and is positioned like a systray info window. And you would not use the Tray classes.
Concerning your question regarding skinning. The SystemTray displayMessage balloon can not be customized in any way.

Unable to drag items from palette in window builder

I've recently installed window builder plug-in on my Eclipse IDE. When I create a New project and add window builder or anything, I'm unable to drag even a button from the palette.I might be dragging it the wrong way or there might have been something missing in the path etc. Does anyone know the solution to it? It'll be highly appreciated. Thanks!
What do you mean by "I'm unable to drag even a button from the palette" - is the palette not responsible to mouse events?
Try creating File->New->Other and selecting Window Builder->Swing Designer->Application Window. Switch to Design tab.
Basically you don't drag components/layouts to the graphical view of your window. You should select for example JButton by clicking it first. Afterwards you click (second time) on the window.

how to get the back image of a window?

We are building a program for visual impaired people, the aim is to replace some features of the screen, like colors, shapes or else. Currently, we have a full-screen window, we grab a snapshot of the screen (through the robot java library) and we reproduce it to the full-screen window. When we try to take the next screenshot, obviously the image we got refers to the current full-screen window. We need to get the back of the full-screen window, after an extensive research we had no success on find a way to do so.
Do you know of a library or a way to achieve this, possibly (but not necessarily) in java?
If you are in Windows 7 you could
1) have Robot click the Rectangle in the lower right corner (to the right of the clock). This will minimize everything.
2) Then have Robot take the screenshot
3) have Robot click the Rectangle again, returning all app windows to previous state
4) have Robot take the other screenshot showing with apps open (if you like)
Robot can do this very fast, but it will interfere with any mouse movement that the user is doing.
You can achieve something similar in other versions of Windows by using right click on the task bar and then selecting "Show the Desktop" and "Show open Windows" to return to the original perspective.

Categories