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

Is there a way to split JTextField into integer

I am currently making a calculator, which do the calculations for The Runge-Kutta method to solve differentialequation. I want the user to input their differentialequation in a JTextField (DiffEqua), and then convert this from a String to Integer…
Aagaard
  • 1
  • 1
0
votes
1 answer

Making a text field in a java pop up menu/tray icon

I have made a Java tray Icon. When the user clicks the icon, a pop up appears. I want to add a text field on the pop up. I have tried some code, it does not work for some reason. public void actionPerformed(ActionEvent e) { …
s1eym_vrs
  • 1
  • 2
0
votes
1 answer

Let JTextField resize automatically

I want to show an Two-Dimensional Array of JTextFields to be editet by the user. After initilisation(with text) they show up in good size. When Text is editet, they don't resize. I place them in a JPanel with GridbagLayout inside a JSrolePane.…
0
votes
1 answer

How do I change the background colour of a JTextField once I press a button?

im making a loan calculator for a school project and i cant figure out how to change the background colour of txtMonthlyPayment and txtTotalPayment to yellow once I press the button ComputePayment. And as a bonus if you can, how do you change the…
5KRU6
  • 5
  • 4
0
votes
0 answers

client-server connection using interface

I am working on a client-server app in java.. Simple interface contain textField to write message and textarea to show messages exchanged. however, the problem is how to get the input from the textfield and send it? I mean it must wait until I enter…
0
votes
3 answers

Validation of input integer

How can i validate an input in the JTEXTfield? If I want it in the ff: 1. An integer 2. Only contains 0-12 For example of valid input (hour and minute), Hour = 12 Minute = 30 Example of invalid input (hour and minute), Hour != 14 Minute != 78
0
votes
1 answer

Why is my JTextField in JFrame not working?

Simple question. I've been trying to block/disable my textfield in my JFrame, but unfortunately it just doesn't work! Suppose the name of my disable textfield is "fnTxt", so in the code I wrote fnTxt.setEnabled(false);. And when I run it, nothing…
0
votes
1 answer

How to make JTextFields clickable?

I posted a similar question a year ago, but it was not really well written and I didn't get an answer I could work with. Now I stand in front of the same problem. I got a JPanel (my content pane), where a MouseListener is implemented. Everywhere I…
0
votes
1 answer

Include JTextArea or JTextPane in JSP?

I want to embed a text are to show the log information of my web application in my jsp file. I am totally new to JSP. I even don't know, which one is more suitable JTextArea, or JTexTPane. Users will not write anything to that area, they will just…
emrahsamdan
  • 203
  • 4
  • 13
0
votes
1 answer

JFrame not displaying panel content

I just got started learning JFrame and is trying to create a frame containing JLabels and JTextFields frame using grouplayout, but the contents inside my panel aren't appearing when I run the program. All help is appreciated. package…
X and Y
  • 91
  • 1
  • 7
0
votes
1 answer

How to make JTextField as wide as the window

I want to make the text automatically as wide as the window. I tried using text.setSize(window.getWidth(),20) and text.setBounds(window.getWidth(),20), (where text is JTextfield), but the only way that seems to work is: static JTextField text = new…
Marian
  • 25
  • 7
0
votes
2 answers

creating a JTextField to receive input from user

System.out.println("Please enter the website :"); Scanner scan2 = new Scanner(System.in); String word2 = scan2.nextLine(); try { URL my_url = new URL("http://" + word2 + "/"); BufferedReader br = new BufferedReader(new…
jasper
  • 1
  • 1
  • 1
0
votes
1 answer

How can I clear the JTextField and have it ready for input immediately without requiring a click or other action?

I posted my full code below so you guys could have a solid understanding of what I want. When I click send, the text field clears but is not ready for input. I have to click for the input. I want it to be ready for the input immediately and…
0
votes
1 answer

Java jFrame toBack() and focusable

I got a Jframe which has a JTextField and a JButton which opens a popup. The popup has to be always in front of the JFrame. Is it possible to write on the JTextField while the popup is still in front of the JFrame?
Tailor
  • 193
  • 1
  • 12
0
votes
1 answer

JTextField not accepting more than 1 input

I want to make it so that when I run this program I can keep entering input from the text field and it will print to the file which we are trying to write. The code I have so far only works the first time I hit 'Enter'. After that when I do it…
Ell
  • 51
  • 6