textfield

Hide textfield blinking cursor

喜夏-厌秋 提交于 2019-11-26 11:51:41
I have a textfield is there a way to hide the blinking text cursor? I say this because I am doing a horror/mystery website and one of the clues is to start typing anywhere. Maybe I can do it with javascript? Richard JP Le Guen Try this: $(document).ready( function() { $("textarea").addClass("-real-textarea"); $(".textarea-wrapper").append("<textarea class=\"hidden\"></textarea>"); $(".textarea-wrapper textarea.hidden").keyup( function() { $(".textarea-wrapper textarea.-real-textarea").val($(this).val()); } ); $(".textarea-wrapper textarea.-real-textarea").focus( function() { $(this).parent()

Resize textField Based On Content

不问归期 提交于 2019-11-26 09:55:11
问题 How can a textField be resized based on content while using auto-layout in an iOS application written in Swift? The text field will resize as necessary to fit its content when the view loads as well as while the user is typing. Ideally, the text field would stop resizing at a certain point, say, 6 lines, and become scrollable. 回答1: You have to use an UITextView instead of an UITextField . Then, you can use the sizeThatFits method. But first you have to know how high one line will be. You can

Java - placeholder on textfield

夙愿已清 提交于 2019-11-26 09:47:46
问题 I\'m trying to create a GUI with Swing. My problem is, I have a textfield, but I want it to have a \"placeholder\" (like in html). I read here and there that it can be done by overriding the paint() of the textfield. Since my code is generated I found out that I need to use the \"Custom Creation Code\" to override the code that was generated. Here is what I have put in the \"Custom Creation Code\" field new javax.swing.JTextField() { String test = super.getText(); String hint = \"Username\";

Android - Add textview to layout when button is pressed

十年热恋 提交于 2019-11-26 09:29:08
问题 So right now I have a text field with a button (add+) below it. I would like to make it so every time text is entered into the Text Field, and the Add button is pressed, a new text view is added to a vertical layout below it with the text that the user typed in the field. I do not want to simply make a text view invisible, then visible when clicked, because I would like them to be able to add more than one text view with whatever text they type. 回答1: This code contains what you want. (The

How to disable Button when TextField is empty?

扶醉桌前 提交于 2019-11-26 09:10:18
问题 In the following code I have a TextField and a Button. I need to disable the Button when ever the TextField is empty, so that I can avoid entering empty values to the database. How can I make the button disabled ? private VBox addVBox() { VBox vb1 = new VBox(); vb1.setPadding(new Insets(15, 20, 25, 20)); vb1.setSpacing(15); vb1.setStyle(\"-fx-background-color: #333333;\"); final Label label = new Label(\"Staff Details\"); label.setFont(Font.font(\"Arial\", FontWeight.BOLD, 20)); label

javascript to find leap year

不问归期 提交于 2019-11-26 06:37:11
问题 How can I get the code below to work when I have a month of february? Currently it is getting to the day and then stopping before getting to the if to determine whether it is a leap year. if (month == 2) { if (day == 29) { if (year % 4 != 0 || year % 100 == 0 && year % 400 != 0) { field.focus(); field.value = month +\'/\' + \'\'; } } else if (day > 28) { field.focus(); field.value = month +\'/\' + \'\'; } } 回答1: It's safer to use Date objects for datetime stuff, e.g. isLeap = new Date(year, 1

Can I have a textfield inside a label?

拈花ヽ惹草 提交于 2019-11-26 05:54:41
问题 What I would like to do is display the following in a form: Open [15] minutes before class Where [15] is a text-field. Is this possible? 回答1: Use a 'composite component' by adding the required parts to a JPanel . E.G. import java.awt.FlowLayout; import javax.swing.*; class TimeBeforeClass { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JPanel gui = new JPanel(new FlowLayout(FlowLayout.LEFT, 3,3)); gui.add(new JLabel("Open")); gui.add

What is the recommended way to make a numeric TextField in JavaFX?

放肆的年华 提交于 2019-11-26 04:37:56
I need to restrict input into a TextField to integers. Any advice? Evan Knowles Very old thread, but this seems neater and strips out non-numeric characters if pasted. // force the field to be numeric only textField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (!newValue.matches("\\d*")) { textField.setText(newValue.replaceAll("[^\\d]", "")); } } }); Burkhard I know this is a rather old thread, but for future readers here is another solution I found quite intuitive:

Hide textfield blinking cursor

岁酱吖の 提交于 2019-11-26 02:37:46
问题 I have a textfield is there a way to hide the blinking text cursor? I say this because I am doing a horror/mystery website and one of the clues is to start typing anywhere. Maybe I can do it with javascript? 回答1: Try this: $(document).ready( function() { $("textarea").addClass("-real-textarea"); $(".textarea-wrapper").append("<textarea class=\"hidden\"></textarea>"); $(".textarea-wrapper textarea.hidden").keyup( function() { $(".textarea-wrapper textarea.-real-textarea").val($(this).val()); }

What is the recommended way to make a numeric TextField in JavaFX?

与世无争的帅哥 提交于 2019-11-26 01:00:10
问题 I need to restrict input into a TextField to integers. Any advice? 回答1: Very old thread, but this seems neater and strips out non-numeric characters if pasted. // force the field to be numeric only textField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (!newValue.matches("\\d*")) { textField.setText(newValue.replaceAll("[^\\d]", "")); } } }); 回答2: I know this is a