I am creating an application where I need that the keyboard pops up automatically without the need to click on the textbox in MIT APP INVENTOR 2.
I tried to focus on the textbox but it didn't work.
I created a screen2 and added a text box named TextBox1. Then in the blocks I added When Screen2.Initialize => call TextBox1.RequestFocus procedure. And it didn't work.
I found the solution and I am going to share it with you.
Just download the taifun tool extension and use it. Actually, it has the show keyboard option.
First choose the textbox to write in and then set the focus to that textbox and the keyboard will appear automatically. If don't you can try a actititystarter.
Greetings!
Related
I am new to this GUI stuff on NetBeans, so could someone please explain how to link multiple GUIs into one? This I should mention is in a java format.
If you want to open another gui from a specific gui, you should give an event to a button.
For example, if you want to open anothergui from maingui, you can create an event for a button which says anothergui is new anothergui, then you can set visibility true for anothergui.
I am working with Movilizer v15 in eclipse neon.
Currently, I am making a quiz, where people need to answer a number of questions with numeric values. But every question now consists of clicking on the answer (attributeType="2") to open the numeric keyboard, followed by answering, closing it again and pressing ok. This get's very tedious after a while.
So my question: Is there a way I can bypass opening the keyboard or having to click twice to move on to the next screen?
You can focus an Answer in the onEnterAssignment of a Question. If that Answer is of attributeType="2" this should open the numeric keyboard of the platform right away. If that keyboard allows "tabbing" forward, you can move from input field to input field. I think on Android the standard keyboard can do that.
focus(answ-desc answer, str clientKey)
Limitations might be
input fields across complex UIs
triggering OK event after the last input field is left
I have a simple game and when I run the program I have to click on the window before the game will accept user input.
When I play games like The Binding of Isaac they accept user input on the main menu without me ever clicking them.
Is there a way to set the focus of my keyboard to my game without clicking it first? There was another question on this: Have to click before pressing key , but it was left unanswered.
Call window.requestFocus(); after calling main.start() so you override any other focus request done in the meanwhile
If you have JFrame, or something like this (something inherited from java.awt.Component), you can try:
window.requestFocus();
Link to javadoc
EDIT:
In case of JFrame, I have found this question:
How to focus a JFrame?
One of the answer is the same as I advice
This can help you
This is a crosspost to the thread in Javaranch (includes some images): http://www.coderanch.com/t/567472/GUI/java/Optimal-solution-creating-multiple-dialog
I'm trying to develop a simple swing desktop application where I imagine alot of different dialog's jumping around to fetch user input. Would need to present labels, textfields, passwordfields, combobxes, checkboxes etc in various dialog windows.
For example: creating the database firsthand, creating the first admin account, adding users, changing user accounts etc.
I have an understanding that JOptionPane is used to create simple quick & easy modal dialog's. I would really like to know why one would choose one over another in this case. Which one is more preferable to use: JOptionPane vs. JDialog
Also I could use some pointers how one should appropriately design and implement this.
Thank you.
Here's a statement I found on the Java website that says one key point about the difference between the two.
How to make Dialogs
A Dialog can be modal. When a modal Dialog is visible, it blocks user input to all other windows in the program. JOptionPane creates JDialogs that are modal. To create a non-modal Dialog, you must use the JDialog class directly.
So it sounds like you would use JOptionPane if you want a user to have to make a choice and close the box before returning to the main screen. If you use a JDialog box, then they can just click around it and get back to the main screen without making a choice. For example, say you wanted to make a user choose the number of results before clicking submit, you wouldn't want them to be able to click around that window and click submit. You would use JOptionPane to force them to select a value first before going back to submit.
Check out http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html it pretty much has everything you would need.
As i understand it, JOptionPane is great for what it can do, but you can't really change the functionality beyond that (not easily). JDialog is better to inherit from if you want to create your own custom Dialogs.
We are building our own Web Browser in Java. It doesn't have to be anything too complicated, we just want several things to do so we could distinguish our project from others.
What we want to know is this:
Is it possible to somehow embed a JTextField object into a JMenuItem?
To be more precise, we want our address bar (text field) to show when we click on a certain item within our menu.
Well, menu items are used for invoking an Action which causes the menu to close.
So you would just have your menu item Action display a popup dialog or something like that.
Or, if you really want to keep the popup open, the you could probably create a sub menu and then just add the JTextField to the sub menu. Remember, you can add any Component to JMenu.
Or, if you just want the text field to display on the main menu, then you just add the text field to the main menu. Of course you would lose functionality like being able to use the keyboard to navigate up and down the menu list.
All the suggestions are a hack at best, so I agree with the original comment to your question.
It's done in the standard OS X "help" menu, so I wouldn't call it an interface "quirk".
A quick google turned up this old link from 2004:
http://coding.derkeiler.com/Archive/Java/comp.lang.java.gui/2004-12/0149.html