Questions tagged [jbutton]

A JButton is a common button in Java Swing.

A JButton is a common button in Java Swing that allows users to execute actions and events which have been tied to that button. It is designed to be used with ActionListener and Action classes for interacting with a gui.

Relevant Java Tutorials:

4918 questions
1
vote
1 answer

JButton font appears different on different pc's

I make a .exe file and send it to my friend. It contains a jbutton with a cool font on it that does some things. In my pc, the font appears normal but on his pc its doesn't show, showing the default that is not so cool. Why is that so? The font I…
user2276872
1
vote
0 answers

swing Jbutton listener not working

While trying to read data from JTextField it says: cannot refer to non final variable declared in inner class in another method CODE: import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import…
1
vote
2 answers

How Do I Make These JLabels of JButtons invisible

I have a class called BoardSquare that is an inherited class of JButton. Each of the BoardSquare objects is stored in an array BoardSquare[][] boardsquares. I have used the following code BoardSquare.boardSquares[j][i].add(new…
aidandeno
  • 307
  • 1
  • 2
  • 16
1
vote
1 answer

How do I resize these ImageIcons to my checkers?

I have these four class variables: private static final ImageIcon redKing = new ImageIcon("Images/redKingImage.png"); private static final ImageIcon blackKing = new ImageIcon("Images/blackKingImage.png"); private static final ImageIcon redChecker =…
aidandeno
  • 307
  • 1
  • 2
  • 16
1
vote
2 answers

Unable to add JButtons wrapped in JPanel into JTable

I am having a JTable, where the final column of the table is for adding 2 buttons. Below is the format of my JTable. Below is my code private class ViewLawyersDisplayData extends ComponentAdapter { @Override public void…
PeakGen
  • 21,894
  • 86
  • 261
  • 463
1
vote
1 answer

How to add panels in a JFrame using Swing

Components are not displayed in my JFrame using Swing. Actually my aim is: Add Frame In the frame add panel Panel cantains 3 buttons But it didn't show. Here is my code public class Panels { JFrame frame; JPanel panel; private JButton…
Symon Kt
  • 69
  • 2
  • 4
1
vote
6 answers

Trying to add ActionListener to JButtons

I cannot figure out how to add Actionlisteners to the JButtons, any help would be much appreciated. public class Translator extends JPanel implements MouseListener, ActionListener { private JButton french = new JButton(); private…
1
vote
3 answers

How to get Variable Name of button on press?

I have a problem with obtaining ID / Variable Name of buttons. Generally I want create lights out game. I created panel of buttons (NxN, N from combo box) but I don't know how to get single button's ID after press. Any idea? private void…
venik
  • 13
  • 1
  • 3
1
vote
2 answers

RE-enable a button after closing a frame java

so im making a program for my project. and when i clicked a button it must open anohter frame and make the button unclickable. and when you closed the popup frame the button must re enable. so this is my main frame package Option2; import…
1
vote
2 answers

Hide jButton in Netbeans

Is there a way to hide a jButton in Netbeans? (similar to button.visible = false in VS)
mouthpiec
  • 3,923
  • 18
  • 54
  • 73
1
vote
1 answer

Open new window for Action Listener class for a JButton click

In my ActionListener class I have my if statements prompting the user to enter a string. When I try to execute the program, nothing happens. Before I added the JButton, the spelling game would appear in a small window and text could be entered, and…
traderjosh
  • 321
  • 5
  • 16
1
vote
2 answers

Common property for JButtons

I am new to swing core functionalities. I have experience in web designing. There is id for uniqueness and class for commonality.
If i want to set property for all the divs, i ll use…
Gibbs
  • 21,904
  • 13
  • 74
  • 138
1
vote
1 answer

JRadiobuttons combining JButtons implemetation. Error method not abstract and does not override abstract method

Am trying to implement a set of 3 JRadiobuttons that are detected using 3 ItemListeners and a set of 2 JButtons that are selected by 2 ActionListeners. When the "OK" JButton is pressed the current JRadioButton selection should be detected. I have…
TommyH
  • 23
  • 5
1
vote
1 answer

Using MigLayout, why is a JButton following a JTable unresponsive and how to fix this?

I am having a mind-boggling problem regarding the use of a JButton following a JTable with MigLayout. It is totally unresponsive unless I push it far enough past the JTable (then it can behave correctly). I have tried running the code with both the…
Joanis
  • 1,669
  • 3
  • 20
  • 32
1
vote
2 answers

Change JButton color and move JTextArea Caret Simultaneously

I'm writing a program where there is a keyboard and a JTextArea. Once a button is pressed, the color of the button should change as well as the caret position. I used Key Binding. Now if I first change the color then move the caret, only the caret…
user3574486
1 2 3
99
100