I have a class Task that takes field values from the database and is displayed as a row in the table. There is a controller that fills the rows of the table with objects of the Task class. I need to listen for clicks on buttons in cells. But those buttons are not present as fields in the controller. How
Tag: actionlistener
How to create an array with random numbers and send it to listener without randomizing it again?
So i’m trying to create a program that create an array of 100 random numbers (without changing everytime user reacts to it), and allow users to check the numbers by entering the index of it. However, the array keep randomizing everytime the user pressed the Show Element button. I also tried to create the array on the main program, but
How to trigger another action listener after completion of ActionListener
I created a GUI with a Jframe, JPanel, JLabel and a JButton. // JFrame Jframe f = new JFrame(“”); // JButton JButton b = new JButton(“button1”); // JLabel JLabel …
Is there a way to skip a mouse click for ActionListener?
I have a Tic Tac Toe GUI that lets a user play against a computer. I use an actionListener to receive the users mouse clicks on where they want to put their “X” on the board. The problem I …
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()…
Getters and setters not working as it should
I need help im working on an assignment and getters and setters are not working. so im using an action listener when add amount is clicked it should add the amount that was entered to deposit amount …
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 …
Adding a listener to a variable in Java/JavaFX which gets called on variable change
I know that there are listeners in JavaFX, and i’m sure Java. But I’m confused as how to implement them. I have a boolean variable that is changed throughout my program. Everytime the boolean is …
How can I find out which button was clicked?
I’ve got my buttons working right, and I’m a listener to each button like this: for(int i = 0; i <= 25; ++i) { buttons[i] = new Button(Character.toString(letters[i])); buttons[i]….