How to locate elements on Java Swing Application for accessibility? - java

I'm trying to locate elements on my Java swing application window using Accessibility Insights for Windows. But, it is not identifying my own java swing windows application. However, it is working fine when I'm trying to locate elements on any other Windows App like, Calculator.
How do I inspect my own java swing application, just like any other Window App ?

Java Swing application is not like other Windows apps. Swing uses its own GUI controls and engine which runs completely within Java. To Windows, a Swing application seems like a single canvas in the size of a window; in other words it does not use any Windows API for controls like buttons, labels etc. This is why you are not seeing anything.
If you want to make your Java program accessible, you should follow the Java Accessibility Guide:
for Java 16 (PDF, dated 2021-03, latest version)
for Java 11 (PDF, dated 2020-12, LTS version)
for Java 8 (LTS version)
for Java 7

Related

JApplet via Java Web Start 9 and 10 seems to take width as height setting

I am porting a Java Web Start application, which worked fine under Oracle JDK Java 7 and 8, to Java 9 and 10. What remains to be solved is a layout bug:
The application is a former Java applet which is running as JApplet,
using the <applet-desc> element with width=1000, height=650.
However under Java 9 and 10 it renders the window with width=1000, height=1000, providing an unwanted lower display area.
I tried to resize the window, but without success. The dimension values of the targeted container get updated, but the rendered window will not change its size.
Can anyone confirm this behaviour?
I would prefer a simple fix rather than porting the applet into a regular Swing application.
Update: I confirmed the same behaviour in a JWS JApplet application from another party.

Java GUI compatible with Mac and Windows

I have a project whose GUI was implemented in MAC notebook, when I tried to run it in Windows, there is different GUI and also different buttons' characters. I checked the type of all used fonts, and I am sure they are all installed in windows, Are there any other things I have to consider to work in both platforms ?
In swing there exists a LookAndFeel which by default is set to be platform specific: adapt to the normal platform theme. A nice cross-platform look-and-feel is nimbus.
What the fonts are concerned: look at this where registerFont is called.
You can Swing as the same code you develop will run on Mac, Windows or Linux.
You can install Windows Builder for eclipse. Tute is here:
https://www.youtube.com/watch?v=oeswfZz4IW0
(till 5:05 in the video)
A comprehensive guide to Swing and its various components can be found here: https://www.youtube.com/watch?v=rgkWfz7Vy40

java fx editor in netbeans

I want to make an animation using Java FX.
Basically, I don't know where to start. I've been looking for a Java FX editor and I found out that there is an editor apart from netbeans. But that editor, now is integrated to netbeans (after netbeans 7.x.x) and I can't find the way of making a Java FX animation using the modern version of netbeans.
And, can I make an animated frame, just one? So that the rest of the frames keep the same as they were before (non-animated) ? Or do I need to start a whole new animated project and do all the coding in Java FX?
Thanks
Java FX is not just an animation, presentation or game building tool like Flash, but a great UI framework with the power and flexibility of Java.
It is a relatively new technology that there is no Flash like tool to do complex drawings and animations, AFAIK.
I guess you mentioned about Scene Builder as the NetBeans integrated editor in your question. Scene Builder lets you build UI through drag & drop just like the NetBeans Swing GUI Builder or Visual Studio. It uses a special XML based markup language called FXML to write the UI.
Unfortunately, It runs a lot slower than it should, even on a 3 GHz Intel Pentium 4 CPU.
IMHO, the best option is to programatically code your UI in Java FX.
Resources
Official Java FX 2 Getting Started Tutorial
JavaFX 2 Scene Builder Tutorial
Another Java FX Getting Started Tutorial

Swing - JavaFX integration

I have a bit of a weird problem. I have a swing application that has some windows with are built with JavaFX (Don't ask why I did this, I had to for due to project delivery time restrictions). The app is 50% Swing and 50% javaFx. Anyway what I found when I started deploying the application to customers is that some of the JavaFX JFXPanels that I am using don't display properly
To be more precise JFXPanels that I have in my main window, which are crested as the application starts, are showing fine. Other JFXPanels that I include in other windows that popup while using the application don't display correctly. The JFrame opens up but its empty of JavaFX components. The weird thing is the when I enable Java console (Java-settings -> Advanced -> Show console) everything is working fine.
The same problem I have in all operating systems I deployed the application. 32 and 64 bit.
also I am using JRE 7u25 in all machines.
Any clues anybody?
Maybe it's related to bug 8021381?
I appears to be fixed in Java 7u40-b38 according to the release notes
So I suggest to try out the Java 7u40 early access release (Download).

Objective-C/Java interaction

I have some java code that I use on a windows machine that runs as a service and has a tray icon that I want to port to Mac OS X. From what I can tell there is no good way to make a menu bar icon using java, so I want to basically wrap my java code with objective-c so I can have a nice menu bar icon and still interact with the java code as I am able to when running the code on my windows box. Is there a good way to do this?
My java code makes web requests every so often so the main functionality I'm looking for is to start/stop the web client, as well as receive updates from the java code on the status of the web requests (more or less push notifications).
Thanks for your help everyone!
If all you're trying to do is get your application's icon displayed in the Dock & the Finder, you don't need to write an objective-C wrapper; all you need to do is bundle the Java code up in with the icons in an OS X "application bundle". See Apple's Java Deployment Guide
You might also want to look into the com.apple.eawt package (see questions/1319805/java-os-x-dock-menu), which provides some features to allow a Java app to appear more like a native OS X application to the user (for example, supporting drag-and-dropping a file to the application icon).

Categories