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
2 answers

How can I get value from JTextField to JComboBox?

There are 2 JTextField components and 1 JComboBox in my project. When I input data to text fields, the combo box is adding separate items/row for each letter or number. How can I fix that? See the picture: Here's my…
Suavi
  • 9
  • 2
0
votes
3 answers

jTable swing get input problem

I've getInput method that takes string from text field on enter click. I've created while loop to wait until onClickListener returns true (pressed Enter). Here's my code: public String getInput(){ jTextField1.setEditable(true); …
Mario
  • 335
  • 7
  • 20
0
votes
1 answer

Wrapping text in a text box

I have the following line of code that consists of a text box: NameTextCustomers = new JTextField(); NameTextCustomers.setBounds(10, 10, 350, 150); Customers.add( NameTextCustomers); I would like to align the text so it starts at the top…
Mike
  • 2,293
  • 13
  • 42
  • 56
0
votes
0 answers

Unable to update JTextField using RMI

hoping someone can help with this as it's frying my brain now. I am new to RMI so this could be a basic amateurish mistake . So I have a layered system where a userinterface creates an interface for an application layer and calls a getRecord…
sfa20
  • 63
  • 1
  • 8
0
votes
1 answer

How do i get multiple double inputs separated by ; from one JtextField and store them on an array?

I have this problem in JAVA where I need to take multiple doubles separated by; from a single jTextField and store them into an array each time I click save button, I also want to set a limit of 5 inputs for example : 12;13;14;15;16 into my…
Yahya Sef
  • 3
  • 6
0
votes
1 answer

Increment/Decrement inputted value in JTextField

For my assignment, I need to make an application where I can increment or decrement the value in the JTextField and the color will change on the lower panel. The text field is editable so whenever any of the values in the top panel's text box…
Lavin
  • 1
0
votes
1 answer

JTextField input to Double

I am working on an application that gets a shutter speed that a user enters into a text field. The user can type in a shutter speed in the form of a fraction "1/250" or a whole number. From that input I want to convert that to a variable of type…
Kev
  • 33
  • 2
  • 6
0
votes
1 answer

JTextField Not Able to be Referenced

I'm working on a project for employee management with SQL Server and Java. While adding in the functionality for addEmployee I ran into this problem. I cannot reference the JTextField components (txtName, txtAge and txtAddress). I may be completely…
0
votes
1 answer

How to set a range (e.g 1 - 20 ) for numeric values in JTextfield

I wish to know if there's a way to set a minimum value and a maximum value which should be both integers to my Jtextfield input What I succceeded to do is restricting the values entered to numeric only which is this private void…
Labelle Doriane
  • 105
  • 1
  • 3
  • 15
0
votes
1 answer

How am I using KeyListener wrong in this code snippet?

I'm trying to make pressing the enter key go to the next text field (TextField2), instead of (by default) it pressing the ok from JOptionPane's OK_CANCEL_OPTION. JTextField textField1 = new JTextField(""); JTextField textField2 = new…
amzy
  • 1
0
votes
1 answer

How to set size and location of JTextField?

I want to set location and size of my JTextField, how can I do it ? My code doesn't work. public static void main(String[] args) { JTextField txt1; JFrame frame = new JFrame("Hangman"); frame.setSize(1100, 600); …
user9971024
0
votes
1 answer

How to display calculated value in Label without submission? Java

The situation is: I want to use two date values obtained from two jDateChoosers and calculate the number of days between two selected days. The question is: what should I do that after choosing both dates a calculated value would appear in a label…
user9247350
0
votes
1 answer

How to restrict JTextField not taking more than 'x' numbers of inputs

I have a JTextField. That takes in strings. For one JTextField, I want to limit to only two strings. For example 'fa' or '56' or '..' Not more than two. Is there a way to do this?
razshan
  • 1,128
  • 12
  • 41
  • 59
0
votes
1 answer

JTextField is updating String data along with junk

I'm trying to update received ByteBuffer data (converted to String) to JTextField, but text field is printing output data along with junk values, even after trimming the string. But in output console it is printing proper data, when it comes to…
Ravikiran
  • 45
  • 11
0
votes
2 answers

how to limit the rows adding in JTable?

I have a few text fields, A JTable and a Button (ADD). Now, every time the button it gets the JTextFields data and adds a row in JTable. And it adds the unlimited number of rows. I want to add only 10 rows. public void setItemDetailInTable() { …
Karan Malhotra
  • 125
  • 3
  • 11