Questions tagged as 'jbutton'

1
answer

JButton how to get the Button Text inside event

Hello, I need to create n JButtons, the creation criteria is a table in the database that has n items. I have to create a button for each item and when I click the button it has to show me a message of the number of that item. Creating the butto...
asked by 11.06.2016 / 20:37
1
answer

Create button with java icon?

I'm having trouble creating a button with an icon in java, I've looked at several tutorials, but I can not get it to work. Note: I am using eclipse, Windows 10. The folder that is in the image is src where the Main class file is. import...
asked by 18.05.2017 / 21:17
1
answer

How to align JButton text to the left of the icon?

I need to align the text of JButton to the left of the icon as I do? I tried using the button.setHorizontalAlignment(SwingConstants.LEFT); But this method does not align the text the way I want it. It's getting the same as the...
asked by 21.02.2018 / 19:33
1
answer

Enable and disable JButton

I have two JButton in my window, btnCalcular and btnConfirmar . btnCalcular computes some values in the window, and btnConfirmar takes those values and stores them elsewhere. The issue is that obligatorily I...
asked by 16.04.2016 / 17:10
1
answer

How to disable / enable buttons in one JFrame depending on the option from another JFrame?

I currently have two buttons in a JFrame : one to save and the other to update. In other JFrame , I have to register and edit. When I click on the register, I want the save to be on and update off, and when to edit, vice versa. I...
asked by 17.10.2017 / 16:11
1
answer

Add functions to graphic application buttons

I'm having trouble putting functions for buttons in java. Can anyone help? Follow the code: import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Insets; import javax.swing.JButton; import javax.swing.JFra...
asked by 02.10.2016 / 22:14
1
answer

Execute an action when a button is clicked for the first time and another one otherwise

I would like to know how to do an if when the button is clicked. For example: private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) { ProdutosDAO produtoDAO = new ProdutosDAO();...
asked by 07.07.2016 / 01:34
1
answer

How to change the color of a button?

I'm doing some experiments to get a better understanding of Netbeans IDE and I had this doubt about the color of a button. By right-clicking on any jButton and selecting Properties, I set the background item to green, for example, but only...
asked by 31.12.2017 / 15:45
1
answer

Trigger two different events with JButton

I'd like to know how to trigger different events using the same button. What I wanted was for the next click to give jButton1.setText("Créditos"); and return to btnGerar.setVisible(true); The idea is that when I click on "Credit...
asked by 04.06.2017 / 06:14
1
answer

How to differentiate buttons within the same event?

I'd like to know a method to differentiate a button that generated event, in my method that will handle events. In the example below I add the same class that handles events to 2 buttons, but I can not differentiate the buttons in my method...
asked by 13.05.2017 / 03:36