Questions tagged [jtextfield]

JTextField is a Java Swing component that allows the editing of a single line of text.

JTextField is a lightweight component that allows the editing of a single line of text. For information on and examples of using text fields, see How to Use Text Fields in The Java Tutorial.

2960 questions
5
votes
3 answers

Java: Add Place Holder on JTextField

Is there a way or method in which we can add placeholder in j text field. I want to add placeholder "Enter Your Number" in field but how can I do this. I check all methods but didn't working. Code: public class Loop extends JFrame{ private…
user4935991
5
votes
1 answer

Copy text to clipboard from a JTextfield with press of a button

After working on a GUI that prints your Text backwards (Hello = olleH), Now I want to create a little Button that lets you copy the Outcome in a way you can paste it anywhere else (example in any Editor). I am using a JTextfield called jtxtoutcome.…
fihdi
  • 145
  • 1
  • 1
  • 12
5
votes
3 answers

How to set Text like Placeholder in JTextfield in swing

I want to put some texts in text-Field when the form is load which instruct to user and when user click on that text-filed the texts remove automatically. txtEmailId = new JTextField(); txtEmailId.setText("Email ID"); i have wrote above code but…
Uday A. Navapara
  • 1,237
  • 5
  • 20
  • 40
5
votes
1 answer

set a JTextField width in maner to wrap a given text

I have an uneditable and disabled JtextField in which I will put a String obtained after requesting a Database, and I want that this JtextField wraps All my String. I saw the setColumn() and setSize() methods but I don't know first my String…
RiadSaadi
  • 391
  • 2
  • 7
  • 16
5
votes
3 answers

JPanel Action Listener

I have a JPanel with a bunch of different check boxes and text fields, I have a button that's disabled, and needs to be enabled when specific configurations are setup. What I need is a listener on the the whole JPanel looking for events, whenever…
Ronin
  • 93
  • 1
  • 2
  • 11
5
votes
2 answers

Limit number input JTextField

I'm working on a sudoku solver and I'm trying to limit the amount of numbers a user can enter into a cell as well as ONLY being able to enter numbers, currently it also accepts letters. At the moment it works like this: If a user enters…
Rob
  • 315
  • 4
  • 15
5
votes
2 answers

Form validation for JTextfield in Java?

Is there an easy way to validate a group of JTextFields in Java. I am currently using sqlite manager, neatbeans IDE to create a simple form that collects information to add a job into the database. I realise there is too many JTextFields. How can I…
Hoody
  • 2,942
  • 5
  • 28
  • 32
5
votes
3 answers

Swing - Thread.sleep() stop JTextField.setText() working

Possible Duplicate: using sleep() for a single thread I'm having issues with JTextField.setText() when using Thread.sleep(). This is for a basic calculator I'm making. When the input in the input field is not of the correct format I want "INPUT…
PElshen
  • 135
  • 1
  • 1
  • 10
5
votes
2 answers

Positioning components in Swing GUIs

I have some questions on positioning components and some questions on text fields and text areas (Java Swing). Any help is greatly appreciated. Right now I am trying to have two text fields beside each other with a different label above each…
Saad Attieh
  • 1,396
  • 3
  • 21
  • 42
5
votes
1 answer

How To Add ShortCut Keys to JTextField?

I am Stuck in some Step that I Can't Add a Shorcut Key like: CTRL+SPACE to my program , I am Searching for one week and I could'd find any answers .
Azad
  • 5,047
  • 20
  • 38
5
votes
2 answers

JTextField not showing up in JPanel on launch

The JTextField is there because when I move the mouse over where it's supposed to be the mouse icon changes to a cursor, then when I click it shows up. But it's invisible at launch. What am I missing? public class JavaSwingTextfield extends JFrame…
tazboy
  • 1,685
  • 5
  • 23
  • 39
5
votes
1 answer

Is it possible to have a single document listener to multiple text fields in Swing

I have a 12 filters for 12 columns on a JTable. Each filter is a TextField of type JTextField. Every time a user enters the data in the text box filter then search happens. Example: Suppose say, I have 3 columns and 3 text boxes above them as…
Amarnath
  • 8,736
  • 10
  • 54
  • 81
5
votes
3 answers

JTextPane/JTextField strange behaviour with rare characters

I've discovered a strange bug in JTextPane/JTextField (or somewhere in the font rendering underneath them). I wonder if anyone else has encountered the same and might have a solution for this. I'm trying to display some "special" or rare characters…
n00bster
  • 2,525
  • 2
  • 16
  • 15
5
votes
7 answers

JTextField limiting character amount input and accepting numeric only

here's the code that i have on how to limit the character input length class JTextFieldLimit extends PlainDocument { private int limit; // optional uppercase conversion private boolean toUppercase = false; JTextFieldLimit(int limit) { …
Weddy
  • 543
  • 6
  • 10
  • 21
5
votes
1 answer

Implement search textField into jTable

Now I have a search textField implemented with KeyReleased event, which don't found/update jTable when I start typing for example "An" from "Andrew", and just after I finish to type exactly (caseSensitive) the name which I want to find. So, what I…