I am attempting to create a a java GUI for use on Zedboard with the 7" touchscreen display. The GUI I am creating is supposed to mimic exactly (though scaled down) a physical console with many interactive buttons.
My question is what would be the best method in making the buttons interactive, my first thought was to cut out the buttons of the console and have each one a separate image that can be set as interactive, but I feel there may be another simpler method.
Thanks
LDY
For the console mimicking, you could take an image of the entire console and then listen to touch event at specific points in the image which corresponds to a button. Based on where the touch event occurs, you could do different actions.
For this you need to get the coordinates of the touch event and check if it corresponds to any of the buttons on the console.
Related
In other words, how can I make it so that the window or screen that they are on is the only screen that they can interact with. For example, if the user wants to exit from the screen but then wants to go to another screen, well then they will have to exit from the exit window first before they can do anything else. A better example is when you open multiple windows in Windows and try to exit from another screen than the one you're on, it will make a beeping noise indicating that you can't do that. Something similar to that is what I'm trying to achieve
It's important to note that my program consists of java code, FXML and a little bit of CSS
If you just want a frame to block all other frames from receiving events, use a modal Dialog.
I am trying to develop an application which responds to multiple digital pens (IRIS Pens) so that if any of the pen writes on paper; I relay the output to a single screen. Thus making a multi-input whiteboard for myself.
In Ubuntu these pens are recognized as mouse and thus can be handled in a similar manner as mouse events are handled.
So now what I plan to do is to handle these events in C/C++ using XLib and pass these events to a Java Swing application using JNI callback. I am able to do this but when the X11 window looses focus no events are transferred to the Swing frame. I also tried to use the root window in X11 but it does not seem to work.
Any help would be really appreciated. Thanking you in advance.
How about maximizing the C/X11 window in front of the Java one, and making it transparent? You should be able to see the Java window while still focusing on the C/X11 one.
Since you are using Ubuntu, you can achieve this using the "Opacity, brightness and saturation" plugin for Compiz. It is in the compiz-plugins-main package, and you can activate it with Compiz Settings Manager (from the compizconfig-settings-manager package). When you activate the plugin, alt+wheel is bound by default to change the transparency of the focused window.
Try reading the mouse directly. I don't remember the exact location, but you should find it in something like '/dev/input/mouseX', where X is the number of your device, ranging from 0 to n-1 devices..
When you read the packet, your application should block until the mouse moves and then your read function will return a raw mouse packet which describes the delta (which is probably more useful then the screen coordinates, in your case) and the mouse button statuses.
The raw packet can be decoded as described here: http://www.computer-engineering.org/ps2mouse/
Create a modal dialog and set it to XmDIALOG_SYSTEM_MODAL (the actual name of the property depends on your toolkit: Motif, Gtk, Qt, ...). Dialogs like this block the whole display and can never loose focus.
The drawback is of course that you can't do anything else while this dialog is on the screen.
This entry in the X11 FAQ might help.
Is there any material/tutorials available that can shed some light on creating drap and drop widgets with Java 2D? I am not talking about drag and drop data transfer like here. What I want to do is have a visual pane in my application, where users can create widgets, connect them to each other etc. Something like a creating a graph, but with widgets that have properties.
Thanks.
This is generally works like this:
When a user presses the mouse button your application goes to a "drag" mode
When repaint() method is called while you're in drag mode you move your widget position to the coordinates of the cursor
When mouse button is released you fixate the ultimate position of the windget.
The simple illustration for this might be a program I was writing in my youth - interactive chess board. Here is relevant class that includes pieces dragging capabilities http://jinyan.svn.sourceforge.net/viewvc/jinyan/trunk/jinyan/client/src/net/sfficslecview/lvboard/EditableChessBoard.java?revision=77&view=markup
I have found the perfect solution. I can make use of the Netbeans Visual Library by extracting jar from the Netbeans Platform.
Wow, what a stupid question you might say. But is it possible? I have a mouse move event in a Jpanel and it works even when the application is not in focus, now can I have something like that for the clicking event or something similar. And most importantly I don't want other apps (even something like the main menu) to lose focus when i click on my app.
I thought of the system's event queue but i'm not sure where that would lead me to.
Thanks in advance.
[EDIT - the purpose]
I want to create an app that mimics the users interactions with the system in a later time. for example a user takes the mouse and clicks and writes and my app will mimic that in say 2 hours time. ofcourse i would need a system hook for the outer events but i wanted to avoid os-dependant code so i basically capture the screen, take it to my app,for example the user clicks on an icon in the captured picture and then for making that come to life, i translate the coordinates to the real icon and click it (with a Robot) and in this way i can capture the user's events in my own app. the problem occurs when the user clicks on the main menu or right clicks (he's doing that in my app, and my app does that to the system so my app is in between) and ofcourse the real main menu will lose focus when the user tries to click on one of it's items.
sorry for my english.
I'm still not sure I follow what you are trying to do. But the concept of an app getting focus when you click on it is fundamental to the GUI and I suspect rather difficult to get around.
I just found this:
Focusable Windows
To support palette windows and input methods, client code can prevent a Window from becoming the focused Window. By transitivity, this prevents the Window or any of its descendants from becoming the focus owner. Non-focusable Windows may still own Windows that are focusable. By default, every Frame and Dialog is focusable. Every Window which is not a Frame or Dialog, but whose nearest owning Frame or Dialog is showing on the screen, and which has at least one Component in its focus traversal cycle, is also focusable by default. To make a Window non-focusable, use Window.setFocusableWindowState(false).
In this doucment http://java.sun.com/j2se/1.5.0/docs/api/java/awt/doc-files/FocusSpec.html
That sounds like it might do what you want.
Using Java is there anyway to display a custom form/image that behaves similar to TrayIcon.displayMessage() function in that it displays just above the system tray for a while then disappears?
I am also looking for a way to display multiple notifications at the same time by having them display above each other.
If not, how do I find the pixel location for the lower left corner just above the system tray?
I don't think there's a shortcut for drawing frames that act just like the standard TrayIcons (with the x button in the corner) that support stacking akin to the Mac Growl notifications.
you will probably have to implement it yourself.
I've found that stacking messages like that is a complete waste of time as the user will not pay attention to them - the better location for these is in the status area of the application in a simple popup menu.
You can use java.awt.GraphicsEnvironment. getLocalGraphicsEnvironment() to get information about the desktop, which contains 'getMaximumWindowBounds()' which takes care of things like the taskbar position.
You can use a subclass of a javax.swing.JWindow to create a window without a border which can be positioned on the desktop relative to the bottom right corner. This will not always work as the default tray icon, as the location of the icon generator can be somewhere else other than that.
You can add a button that acts like the 'x' button of a standard desktop window - but it's going to be platform dependent.
I use square windows that stack up from the top right corner if I'm using LTR, and it seems to work well.
Go check out Java GNOME. It has Java bindings for GTK, including a status icon for the tray, and notification events.