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

leave a blank jtextfield field in java

I have this error: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "" at Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "" at…
0
votes
4 answers

JTextfield, how to verify content in the getText() method

I have a textfield called x. When the textfield contains " ", I want to do something. If it does not, do something else. I tried doing String test = x.getText(); if(test.startsWith("…
razshan
  • 1,128
  • 12
  • 41
  • 59
0
votes
1 answer

On-Screen Keyboard Java

I'm developing a java application with some buttons, eventually I need to make a version for touch screen monitors. The problem I have right now is JTextFields are not opening an on-screen keyboard and also closing it is a problem. If I use windows…
J0ki
  • 302
  • 2
  • 20
0
votes
0 answers

Get a variable in CaretListener (like getActionCommand)

I want to pass a variable into a CaretListener when my JTextFiled is update. My listener work perfectly thanks to "caretUpdate". However, I don't know how to pass a variable to my "caretUpdate", like "e.getActionCommand()" when I used…
Nooby
  • 115
  • 1
  • 2
  • 12
0
votes
1 answer

How to populate Textfields with selected values from JTable on another window?

I have two windows: PatientWindow and CreateEditPatientWindow. In PatientWindow I have JTable which is populated from text files. Also, on the PatientWindow I have button 'Update' which open CreateEditPatientWindow. So I want to populate TextFields…
Nitrus Brio
  • 89
  • 2
  • 15
0
votes
1 answer

How to overlap a JPanel(background) and a JTextField

I am creating a log in application for someones graduation, I need several text fields and a background, I have added the background and now need to add the text fields, the problem is that they won't seem to go on top of each other. I have tried…
0
votes
1 answer

My for loop isnt pointing to the correct attribute

I want the for loop to point to the price once it finds which menu it is set equal to. once i find which menu the cashier selects, it will use the getPrice() method and set it equal a string whcih is then set to the JtTextField (totalText). the…
user1015127
  • 99
  • 2
  • 4
  • 6
0
votes
1 answer

Why won't the string "getPriceDisplay" appear in my JTextField, "totalTextField"?

Why won't the string "getPriceDisplay" appear in my JTextField, totalTextField? // NamesFrame.java // // Informatics 45 Spring 2010 // Code Example: GridBagLayouts, JLists, and ListModels // Version 2 // // This version of NamesFrame employs…
user1015127
  • 99
  • 2
  • 4
  • 6
0
votes
1 answer

how to print text from a JtextField by clicking a JButton

I'm creating a little program for my self to learn Java now I did make a GUI with 12 JTextFields and now I want to use the text that's in the text fields in another class where I print them out. When I press the button class print is successful,…
Jason
  • 3
  • 5
0
votes
2 answers

Accessing JTextField Text

I have a simple program, I am trying to access the data from the textfield but I am always getting null or empty field. For an example. public class income { JButton save = new JButton("save"); public JTextField setIncomeValue() { .. .. …
user2805507
0
votes
1 answer

Cannot validate JTextField's value using Regular expression while using Java Swing components

I am creating a simple Java Swing application to validate an IP Address. I added a JTextField, JButton, JLabel. JTextField should accept AlphaNumeric values, ie - user can enter the name of a system or IP address of a system. I have added 2…
AbiSaran
  • 2,538
  • 3
  • 9
  • 15
0
votes
1 answer

Method called from first JFrame does nothing in second

I set JTextField "rfid" to setEnabled(false) in MainGUI class and created method setRfidEnabled to be able to enable textfield from another class called CardLayout. When I try to call it from CardLayout by button event listener it does nothing, I…
Stab Ones
  • 1
  • 2
0
votes
1 answer

Running Non-Standard Evaluations based of input from JTextField (sin, cos, tan)

I am writing a program that utilizes the provided library ScriptEngineManager to try and write a math calculator that goes beyond the basic functions of +, -, / and *. How would I be able to go about implementing this in the existing code. I have…
0
votes
1 answer

code doesn't see value of JTextField, despite it displays in the interface

I want to get int value from the nrZamowieniaJTF (TextField). It is initialized in another window (OknoListaZamowien) by this code: if (e.getSource() == zapiszJB) { OknoEdycjaZamowienia ob = new OknoEdycjaZamowienia(); ob.setVisible(true); try { …
0
votes
1 answer

Is there a way to split JTextField with substrings into a double?

Is there a way you can split up a JTextField using substrings and return it has a double. The problem is i will recieve an input from the user i.e 3+x+5*7+y or 5*y-x/4 in a JTextField and this will be a String. But in order to use it in my…
Aagaard
  • 1
  • 1