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
0
votes
1 answer

How do i add a scrollbar with JtextArea and implement JScrollPane in a GUI?

I need help adding a scrollbar to an empty textbox that will output the information that i input into the required textboxes by then clicking the buttons. My issue is im not sure how to implement the scrollbar correctly with the textbox that is in…
0
votes
1 answer

How to get the true x and y coordinates of a JTextField

I had an issue with a piece of code I was writing where I was adding JPanel's inside of others to form a layout. The issue is that after the window is displayed I needed to get the x and y coordinates of one of the text fields but whenever I try…
Hibiflobu
  • 43
  • 7
0
votes
0 answers

JTextField, does not update parsed data from a file/serial port

This is a code that captures the serial port data and transfer it to the GUI frame in the JTextField. I used the terminal console to check if all data were captured, it captured all of the data. When I added the str0.setText(cell[0]) in the…
Jane
  • 1
  • 1
0
votes
0 answers

JTextField inside of an ArrayList only shows the last one

amount = new JTextField(40); amount.setFont(new Font("Arial", Font.PLAIN, 20)); amount.setBounds(_width / 2 + 25, (_height / 5) * 2 - (_height / 5) / 4, 50, 50); content.add(amount); urlBox = new JTextField(40); …
0
votes
0 answers

(Fixed) Fill a jComboBox in JFrame B with a jTextField in JFrame A

I want to send a String value, filling a jTextField and sending the value with a jButton, this is point A (JFrame A). And by sending that value, the jComboBox needs to be filled, by the value we sent, this is point B (JFrame B). This is a test for…
Yourdead
  • 3
  • 4
0
votes
1 answer

java JTextField paintComponent Method called repeatedly. Is that normal?

having subclassed JTextField, I noticed the paintComponent Method is called repeatedly (approximately every half-a-second) when the Field has Focus, even with no user interaction. I read the Oracle article "Painting in AWT and Swing", but didn't…
Dave The Dane
  • 650
  • 1
  • 7
  • 18
0
votes
1 answer

error check the empty textField of int values

Here is the code: String name = txtname.getText(); int id = Integer.parseInt(txtid.getText()); int pass = Integer.parseInt(txtpass.getText()); String day = Date.getSelectedItem().toString(); if…
Zahraa
  • 67
  • 7
0
votes
2 answers

Highlight all words in jTextField that the user puts into search for

Hey all the following code below works with highlighting the supplied word to search for but if there are more than just one (1) of that word in the sentence then it wont find it. It just stops at finding one (1) match. private JFrame frame; private…
StealthRT
  • 10,108
  • 40
  • 183
  • 342
0
votes
0 answers

How can I dynamically resize the font size? (Java, JTextField)

How can I resize the font from a textfield? I have written a paintText method, which is called with paintComponent. The resizing in a smaller font size works like a charm but scaling it up again does not, because I have no minimum width. How can I…
F_Schmidt
  • 902
  • 1
  • 11
  • 32
0
votes
2 answers

Any way to make a top 5 in java displaying the variable names?

I've been trying to make and display in JFrame a top five out of 13 options. It goes something like this: I have a .txt with a bunch of words, let's say apple, banana, orange, etc. And a counter for each word. Then I open the file and scan it with…
0
votes
2 answers

How can I draw a cursor in a custom JTextField?

I have created a rounded JTextField, which overwrites the paintComponent(g: Graphics) method. The shape and the text are properly painting, but I have not implemented anything that shows a cursor. How can I achieve…
F_Schmidt
  • 902
  • 1
  • 11
  • 32
0
votes
1 answer

How to add user input from text field into an array?

I am trying to add the user input from the text field into an array when I click the Add Button. The Display Button displays the whole array. I already initialized the array (array = new String[10]) else where in the program. I initialized the…
0
votes
0 answers

Based on "type", a JTable cell must switch from being a Textfield to being a JComboBox

Even though there are many examples on how to put a JCombobox instead of a textfield on SO (by switching between two editors), what I want is a little bit more complicated. I use the following method to populate my table: public Component…
Jesse James
  • 1,203
  • 5
  • 22
  • 39
0
votes
1 answer

Is there any way in javafx or fxml to validate TextField character's length?

Textfield that not accept any character except number [0-9] and its length also, in my case it is 11 but after adding {11} in regex expression that textfield doesn't accept any thing. Please help! Code here: public class NumberField extends…
user10283830
0
votes
0 answers

Add and remove JTextField

I want to add and remove JTextField controls dynamically using a combo box. I have a combo box from 1 to 10. For example I press 3 to add 3 text field it works great. But when I press a second time (2) I want to delete the last text field. This is…
Ncib Sami
  • 5
  • 3