JavaFX menubar Windows Narrator support - java

I'm currently working on a school assignment where I need to create an app for visually impaired users. I would like to use Java with JavaFx for GUI.
Preferred element for visually impaired users is menu bar, since it can be easily navigated by keyboard. Menu bar in JavaFx is a MenuBar class object, that has Menu class attribute, which has MenuItem class attributes. Windows Narrator (neither the NVDA screen reader) works with this menu bar out of the box. It won't read the labels at all. It just says "Menu" and that's it.
Menu and MenuItem do not have accessibleText attribute which stores the text to be read by the screen reader software. Is there a way to make this menu bar screen reader compatible?
TL;DR: Is there a way to create menu bar that works with Windows Narrator in JavaFx?

For future reference: I've managed to solve this. The issue was I didn't have Java Access Bridge enabled (https://docs.oracle.com/javase/7/docs/technotes/guides/access/enable_and_test.html). Enabling it made the menu bar work without any other changes.

Related

How to add custom menu action and titlebar icon to JFrame

I have a custom JFrame. On the title bar I have an icon in the top left, a title, and then the standard minimize, maximize, and close buttons on the right.
When I click the icon in the title bar I get the standard options: Restore, Move, Size, Minimize, Maximize, Close.
How can I add my own menu option here? I'd like to add and "Always On Top" option here.
Additionally I'd like to add a button next to the max,min,close buttons on the title bar to allow uses to toggle the "Always On Top" state of the JFrame.
You could create your own customized Components. To do that, create a new class which extends JMenuBar for example and override the methods which fit your needs. Very often, for example, one wants to override paintComponent(Graphics).
That is not what you want, 'though. Customizing the JMenuBar wont work as you expect it to. The "JMenuBar" is another bar below the title bar. I am Mac user, but as far as my knowledge goes, it is not possible to customize the title bar, because that isn't handled by the JVM. The only thing that is modifiable without using native code is the Icon in the top left.
For further information on that, look at this question and the best answer there. This will help you a lot.
Your problem (adding a button at the top for toggling the alwaysOnTop status) is best solved by creating normal instances of a JMenuBar, a JMenu and a JMenuItem.
To then add that MenuBar to your Frame, use JFrame.setJMenuBar(JMenuBar). See also How to use Menus.
I hope this helps!

Android: Convert a normal menu to slider menu? (With minimal coding)

I have an app with a normal menu i.e. the common old menu that shows up at the bottom of the screen when the menu button is pressed. But it is a problem in some phones where there is no hard menu button.
I want to switch to slider menu with a menu icon on top. Is there an easy way to do this (I mean a way where code change would be minimum) retaining the existing functionality? Or will i have to go about coding the slider menu from scratch?
Any example code of a similar situation would really help.
I have an app with a normal menu i.e. the common old menu that shows up at the bottom of the screen when the menu button is pressed
Normally, that "menu" will appear as the overflow on devices with an action bar that either:
do not have a MENU button, or
run Android 4.4+
But it is a problem in some phones where there is no hard menu button.
Make sure that your app has an action bar.
I want to switch to slider menu with a menu icon on top
The options menu/action-bar-with-overflow is unrelated to the "slider menu". They serve different roles. Please read the design guidelines for a navigation drawer (a.k.a., "slider menu").
Is there an easy way to do this (I mean a way where code change would be minimum) retaining the existing functionality?
No, because they are not related.

How to disable Mac's About/Quit menu items when showing a JDialog?

I have a Swing application that runs on Mac. When the user opens any JDialog like the JFileChooser i want automatically the "About App_Name", "Quit App_Name" menu items in the Mac's menu beside the apple button at the top left of the screen to appear disabled, so the user won't be able to click them.
Is this possible ?
By default, the application menu entries do nothing when a modal dialog has focus, but the appearance is unaffected; this is standard on Mac OS X interface. Of course, your application's own menus should be enabled or disabled as appropriate. You can intercept the relevant events using OSXAdapter, as shown in this answer.

How to display frame within menu options window

I am developing a Java application using Swing. I am using menu bar in my application. Whenever I click a menu item I need to open a new panel/frame within the window containing menu options.
To be precise I don't want to open a new window on clicking a menu item. What is the possible solution to this problem?
Thanks in advance.
If you want to put windows inside of other windows, you should look at JInternalFrame:
http://download.oracle.com/javase/tutorial/uiswing/components/internalframe.html
If you don't want to open a new window when clicking a menu item, CardLayout is a good choice. Also, don't overlook the convenience of using actions in your menus.

Java editing window menu bar

I have a problem. You see, I want to add my own items to the window menu bar of my application, not add items to a JMenuBar. Like for example, look at the menu bar of the browser you are using. That type of menu bar. I know Java is run in a VM so you can't access too many things outside of the JVM, but is there any possible way that can be done? Whenever I search "Java menu bar" it comes up with just JMenuBar stuff and nothing about creating a window menu bar. Thanks!
You can make the JMenuBar look however you want. You just need to configure the menu bar and its menus appropriately.

Categories