Detect and identify GUI components from Java - java

I need to create a Java application that can detect any GUI component of an application on Windows or Linux. For example, you have a Firefox browser running and I want to have a list of interactive components (such as buttons, menus) and possibly drive Firefox with my program (sort of like a remote controller). Do the OSes provide some capabilities that enable this?
I remember from a long time ago when I did some automated software testing, the testing software could tell each GUI component of any application on Windows. I've looked around and found ResourceHacker (http://www.angusj.com/resourcehacker/rh_shot.html) and it's somewhat similar.
Is this possible through Java? If not, what language might be suitable? Any opensource solutions out there?
Any pointer/advice would be appreciated.
Thank you!

Related

JFrame on website

I have an application which is composed of many JFrame objects (using Java and Netbeans). The 'main' frame has 4 buttons and each button opens another frame. Now my problem is that I want the whole application to be run on the web as a website.
I was considering 3 possible scenarios (from my research):
Use Java Web Start
Convert JFrame to JApplet
Create from scratch a Java web application
I was hoping that maybe someone can give me some help, and guidelines of which option I should opt for.
The quickest option is to modify your application to run as an applet (yes, this would involve making a JApplet from your JFrame). However, you should realize that the Java Applet is considered an outdated technology. Most mobile devices won't run them and even some popular desktop browsers won't (Mac Chrome). What's more, Oracle now requires all applets to be signed in order to run with default security settings. This means purchasing a yearly (~$200) signing certificate.
Java Web Start is not really fundamentally different from applets and will suffer the same issues as above.
Think again about your choice of technology. A Java web application (e.g., Spring MVC) or a JavaScript application (e.g., GWT, JQuery) are better choices.
For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X & Unix/Linux.
Applet deployment has always been difficult, with weird bugs in particular versions of specific JREs in conjunction with particular browsers. My 'favorite' bug happened in a version of Firefox that triggered an applet to reload when the user scrolled up in the web page.
See also The Use of Multiple JFrames, Good/Bad Practice?

Taskbar behaviour for Swing Application

I have a Swing Application that currently has the feature setAlwaysOnTop(true); and is docked to the top of the screen.
Now i can't find a way for other windows (Browser, IDE) to maximize in respect of my application.
To make myself clearer here is a picture:
As you see, currently the maximized window is behind my Application.
I don't want other applications to expand behind my application; just like maximizing a browser won't expand it past the Windows taskbar.
How can i realize the desired behaviour with JAVA?
If not possible directly with/in Java, are there other ways to achieve this?
N.B.: The App only has to work on Windows 7.
I guess the reason for my lack of search results was my inability to describe this behaviour. Any hints would be appreciated.
Thank you for your time.
It is called an Application Desktop Toolbar
The system prevents other applications from using the desktop area used by an appbar
Which is very Windows-specific, making it difficult in pure Java.
Perhaps jdeskbar could be an option if you really have to do this in Java and not a more "Windowsy" language
EDIT: According to the jDeskBar project wiki, the current release is broken. Maybe it can be picked apart?

java to access webcam and pen tablet (standalone app vs applet)

i need to develop in java an application that accesses local resources, mainly a webcam, and possibly a wacom bamboo pen tablet. It should take pictures and notes and then post them to a web server.
The ways i can think of are:
use applets
use some kind of standalone app created via JavaFx (or swing or similar)
Which way would you go about it? Are applets considered a viable/secure way to achieve this?
Thanks
I would go the standalone app route. I always turn Java off in my browsers because I can never remember which specific version has security bugs.
If you build it as a desktop app I think you could quite easily convert it to be an applet later on if you wanted.

I need something to automate web browser tasks in its own virtual enviorment (Chrome)

Ever since i started learning java i wanted to create a way to automate a few actions on a couple websites,
For example, topline is a website that replaces all your ads with its own ads and pays you a bit of money for it, i want to emulate the act of just surfing the web, then start emulating specific tasks like clicking certain buttons or playing flash games (Actually playing the game by using image recognition) and this has to be written in java as i want to run this on a raspberry pi.
any help is appreciated, is there a class that i can use?
any help is appreciated!
Selenium is a good browser automation tool. Refer http://seleniumhq.org/
You can get more info on Google. Let me know if you need help finding resources.
Check the class Robot, it will help you to emulate mouse interactions with the screen, but you have to implement the image recognition though
Although I can't point you to a JAVA solution, I would like to advocate two very interesting tools: PhantomJS and CasperJS. The latter depends on the first, and with them, browser navigation scripting and testing are a breeze.
They both work on Linux, MAC OS and Windows and are as multiplatform as Javascript can be. Naturally, it will work just fine in you Raspberry Pi.

How to port web ui to desktop app?

I have seen a lot of people try to make a web ui looks like a desktop ui. However, most of the time i feel web ui is much more interesting than the desktop ui, with the help of javascript toolkit like jquery, gwt-ext etc.
My question is, how to port the web ui to desktop ui? Do I need to embed a javascript engine in java? css engine? html layout engine? That sounds like a lot of work to do.
Any easy way of doing this?
you can embed a web server in your app and you can embed a browser inside your app window. i know eclipse does this pretty well. it uses SWT to do the heavy lifting
http://www.eclipse.org/swt/snippets/#browser
check the Browser section
your web server doesnt even have to be a proper web server, it just has to set the content, and can query / change it on the fly. the javascript on the page can even interact directly with your app.
you should be even able to use crazy web frameworks like
http://echo.nextapp.com/site/
or
http://code.google.com/webtoolkit/
or even run a ruby site through JRUBY
or make really complex apps using the new HTML5 engine [canvas/video tags] (if your client has the new mozilla installed)
Adobe AIR technology solves this exact problem. The code you develop using Flex can be rendered in the Flash player plugin of a browser or the same code can be easily packaged as a Desktop application that runs on the AIR runtime.
Have you seen Appcelerator's Titanium Desktop
This is one of the best solution for you (i think!)
You write the javascript and html code, and the titanium SDK creates the Desktop application of the same
There is support for Python and Ruby.
Must try :
http://www.appcelerator.com/products/titanium-desktop/
if you are a Ruby programmer then you must also see this
http://www.rubyinside.com/bowline-rails-for-the-desktop-2183.html
Prism from Mozilla is made for this goal, exactly. It's out of beta now too, I believe.
Check Google Gears y Adobe AIR
It not 'a lot of work to do', it's a huge amount of work to do - you would in effect be writing you own browser and it'd never come close to the poplar ones out there, simply because you wouldn't get the level of feedback something like Firefox gets.
If you're trying to avoid address bars, menu bars, etc these can be switched off in all the popular browsers and so to the user the appearance would be that it's more application like with only the rich content of the HTML visible.
Sounds like JavaFX would be good for you?
http://en.wikipedia.org/wiki/Javafx
Try XULRunner from Mozilla. If you have developed extensions for Firefox, then this is the exact same thing. XULRunner contains the Gecko engine, so it can render XUL and HTML with CSS, and it supports JavaScript with many useful XUL Components, like file read and write, directory browser and network tools.
Because it supports HTML you can in effect make a webpage and have it run like an application. Also it is cross platform, so it will run on Windows, Mac and Linux, anywhere Firefox runs actually.
There is some information on creating XULRunner applications on the net, but since it's so similar to making Firefox Extensions, you can just google for that. A good Tutorial for getting started is this one.

Categories