Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 1 year ago. Improve this question I am having problems changing JScrollPane components. I have an ArrayList named textFields
Tag: jtextfield
JTextField doesn’t appear after switching panel using CardLayout
i have 4 panels associated to a content panel which uses a card layout. If i try to switch between the cards by using the buttons, i can see the JLabels but no JTextFields. I assume they are there because there is space between the JLabels, so i tried to revalidate and repaint the panels after switching to them but
After inserting values in JTextField, their random value is not shown. How can I fix it?
I wrote this Java Application which is used to extract a random value from those entered in the JTextFields after starting a counter. Compiles and gives no errors, but the (“” +randomElement) value is not displayed. I created the randomElement property inside the TimerListener class in the actionPerformed() method which starts the counter. At the end of the count the
How to get text from same Text Field used multiple times in Java Swing
I’m trying to get text from a JTextField iterated through my code (apparently, I can’t add a different text field from a button). Here’s what the “Add Items” button do: It adds two new text fields in the panel using FlowLayout. Now, I want to get the text given by the user from text fields with each one assigned to
ActionListener knowing which component triggered the action
I would like to have an actionlistener to be able to figure out the source as shown in the code below. How should i implement this? JTextField tf1 = new JTextField(); JTextField tf2 = new JTextField()…
how to use JTextField to show a negative or positive result using ActionListener on the JTextField itself
My program is supposed to ask a user to write a number in a JTextField and then show the result if the number is negative or positive in another JTextField that is disabled. All of that must be done without a button. Answer In your example you’ve forget to call the method JavaJTextFieldActionListner. I’ve remove it and move the code
JTextField render bug if Text-Not-Fitting (JDK 7 till 18)
JTextField has wrong text render on RIGHT_TO_LEFT component orientation We need a workaround, since whenever JTextField is filled with text that contains: Right to left text like Arabic, Latin numbers, and Latin text. Then JTextField renders text parts at unexpected locations. (It only renders right if the complete text Fits inside the JTextField.) The text we use to reproduce is:
JTextField size can’t be changed
} I tried to create a form and a JTextField on it. But the problem is, my location and size doesn’t work. The TextField is filling the whole form. How can I fix it? Answer The size is not “working” due to the default layout (FlowLayout) in your JFrame. This layout doesn’t let you change the size or location of
Restrict JTextField to only accept certain characters
I have 4 JTextFields that should only accept certain characters: binary digits (0, 1) octal digits, so (0 – 7) all digits (0 – 9) all hexadecimal characters (0 – 9, a – f, A – F) The user must not be able to input a forbidden character. I know how I could validate the input afterwards, but not how
Java Swing JtextField inset
I am working with Netbeans GUI and I would like to add 3 pixels of space at the beginning of my jTextField : I have tryied with setMargin, setInset in the GUI but it doesn’t change anything. I have another question, why the bottom right border is not rounded ? here is my code : thank you very much, Regards