Answers for "placeholder textarea"

4

textarea placeholder

<!-- Make sure that there is No space and No breaklines between the <textarea></textarea>. Example below: -->
<textarea placeholder="Enter Details..."></textarea>
Posted by: Guest on May-11-2020
1

jtextfield placeholder

txtField = new JTextField();
txtField.setForeground(Color.LIGHT_GRAY);
txtField.addFocusListener(new FocusAdapter() {
			@Override
			public void focusGained(FocusEvent e) {
				if(txtField.getText().trim().equals("Hello World")) {
					txtField.setText("");
				}
				
				txtField.setForeground(Color.BLACK);
			}
			@Override
			public void focusLost(FocusEvent e) {
				if(txtField.getText().trim().equals("")) {
					txtField.setText("Hello World");
				}
				
				txtField.setForeground(Color.LIGHT_GRAY);
			}
		});
Posted by: Guest on December-30-2020

Browse Popular Code Answers by Language