Instead of setting up 3 TextFields on a Stage that collect first, second and last names, I'd like to have just one in which a user can enter all his/ her names. I think my form will look simpler, less clustered, therefore less complicated for my users.
I was on some web page some time back and saw an implementation of the above this way:
The text field when blank shows three parts hinting first, second and
last name. When initially on forcus, only the first name hint
dissapeared, but the others, second and last remained. Then when
you're done entering the first name and press spacebar, the second
name dissapears and now only the last name hint shows. The same will
go for last name after entering the second name.
All text dissapears when the hint is set as new TextField("hint");.
Is there a way to go about it without having all the hints dissapear on focus?
Thank you all in advance.
Related
The item group name appearing as "itemGroup.dragon quest" instead of "dragon quest"
My little project is on github, and I made an issue with some screen here
I think I found where thr problem comes from. here you are putting the key "dragon quest". I think it's used everywhere to get the name.
If you remove the space (and so, have super("dragonquest");), you will see the translation here : "Tutorial Item Group".
And so, you should change the lang file to change the name showed in the inventory name.
I am creating a matrix of JRadioButtons (see image below). What I want to do is allow only one selection per row and column. Is there any way I can possibly assigned two button groups to a single button? Or is there any other suggestions how I may do this?
Description: I want the user to select one value from Highest, Normal, Least and Not Available option for Morning, Afternoon and Evening. However, I also want them to limit them to picking only one option from Morning, Afternoon and Evening for Highest, Normal, Least and Not available. So, basically, only one option needs to be selected for each row and only one option for each column, and yes, they can be the same option for the row and column.
Ideas? Suggestions?
You cannot use more than one ButtonGroup for a single JRadioButton. To solve the problem, just check for errors at click button, then display the proper error message if any error encountered.
Another smart idea is hiding per click. Handle click event for each one, so that when a radio button is selected its row and column are hidden setVisible(false) (or at least disabled setEnabled(false)).
I have a table of forms which accepts first name, last name etc. When I navigate through using the tab key and enter some text in first name, all of the text disappears and that row gets selected. I have tried almost all techniques.
Is there any way we can avoid that using coding?
If I use the mouse then it wont give that error.
Assuming an otherwise correct use of JTable, you may need to terminate the edit when focus is lost, as suggested here and here:
table.putClientProperty("terminateEditOnFocusLost", true);
I'm having a problem with JTextArea (not a problem though).
I want to create my own college program, one of the function is to write down and save a list of homework each day. It's text area having the main function here, which is to type everything my lecturer said. But text area will act like Windows original notepad, which is not keeping the indentation. So my questions are:
How do I have a function where I press the SHIFT+TAB key it will decrease indentation by one.
If number 1 is possible, then how do my program have behaviour when I press ENTER key, it will have a new line with previous indentation? Just like NetBeans and other IDE.
Edited: I'm a beginner in Java, in truth, I'm making this program while studying Java in my college.
How do I have a function where I press the SHIFT+TAB key it will decrease indentation by one.
You need to use key bindings to listen for the user typing Shift+Tab.
If number 1 is possible, then how do my program have behavior when I press ENTER key, it will have a new line with previous indentation? Just like NetBeans and other IDE.
Use a similar piece of logic to capture the Enter key presses. Then, check the previous line in the editor and count the number of tab characters preceding the text. Output a similar number at the start of the new line.
you could use Javascript/jquery for indenting by inserting empty space of specific line. while pressing your hot key combination call function to insert five spaces on your cursor.
I'm designing a program simulating a vending machine. You know how vending machines have that one large text box that displays whatever messages you need to know...that's what I want to do. So basically, if the user clicks a button and if the item is out of store, expired, they don't have enough credit, whatever, the message should be displayed in this box.
Then, after a second or 2, return to displaying how much money the user put into the machine. I also want to make the box so that, well theres a button next to the text box to click to insert money. When they click that, I want to make the text box editable, they then enter the amount of money they want to enter, then press insert again, and the money is inserted. The text box becomes uneditable again, and displays the credit they have in the machine.
Does anyone have any suggestions as to how to do this?
I also was wondering how I could implement the delay before getting rid of the message and returning to displaying the credit in the machine. Thank you.
As Andrew Thompson says, you would use a JTextField. Set the desired text using the setText() method and you could then use a sleep function (usleep() I think should work for your application) and then set the text again back to the Dollar value.
Edit: didn't see the last half. To enable and disable the textfield entirely, use setEnabled(true/false), to stop it from being editable, use setEditable(true/false)
Also, just thinking, you could get the current date in a timestamp format and then enter a loop where you continually get the timestamp and compare it to the first one. If the desired difference is reached then exit the loop and update the textfield. Have a look at the Java doc for Date ;)