Questions tagged [jtogglebutton]

The JToggleButton represents button that can be toggled, similar to a check box.

JToggleButtons can be placed wherever checkbox functionality is desired in a button. When the user presses a JToggleButton, then the button stays visually pressed. When the user presses again, then it is visually unpressed.

Depending on the user's look and feel, the button may look like a normal button, or it may look completely different.

122 questions
0
votes
1 answer

JToggleButton in java swing not recognizing isSelected() method?

I'm trying to create a gui in java swing that lets the user book seats using a toggle button. I have the default button colour initially to test if the click event works. The button should turn red to signify its been booked and turn yellow to…
Mark O'Hare
  • 147
  • 1
  • 3
  • 17
0
votes
2 answers

Jtogglebutton setting background dynamically

i have a problem with setting background color of Jtogglebutton dynamically. I want Jtogglebutton blink like a led, on and off at a decised time, like 500ms. I tried to override paint and paintComponent method too. But couldn't succeed either. I'm…
f.mike
  • 5
  • 2
0
votes
2 answers

Chrome Extension - input Checkbox checked by default

I developed a Chrome Extension, and added an On/Off toggle to control the injection of the content scripts. In my popup.html, the following div was added with a checkbox:
0
votes
1 answer

How to increment counter and decrement it with Jquery

Hi guys I need assistance with incrementing a variable with just one value for a user and when the user clicks the same button the value decreases by one and this cycles continues. There is a situation similar in the below code: $(function() { …
Dlaw
  • 131
  • 2
  • 14
0
votes
1 answer

There are some method to use toggle buttons without need to create a lot of conditions

I'm developing a program in java for admin orders in a restaurant. I have a screen like this. Frame for admin orders. I want to select any button from left and any button from right and clic in button "Agregar" later. I'm thinking to do a method…
Allanh
  • 465
  • 1
  • 7
  • 19
0
votes
1 answer

JToggleButton that changes two Jlabel's with an ActionListener

I'm trying to get a toggle button to change two Jlabel's named toggled and untoggled with with an ActionListener. I have it working to where if you press the button it shows the toggled Jlabel and hides the untoggled Jlabel. I'm not having any…
javajoejuan
  • 323
  • 3
  • 9
0
votes
2 answers

Action Event with Toggle Buttons in Java - (Program not working)

This program is supposed to save the button value "ab" to the ArrayList whenever the button is pressed, but the if command seems to never work, I tried removing it and seeing if it works, it does and the ArrayList is updated with the new value. So…
0
votes
0 answers

JComboBox shows blank, white box in place of item drop-down list when toggling setEnabled() function

Using Java's WindowBuilder to create a GUI where a JComboBox is changed from enabled to un-enabled when a certain JToggleButton is pressed. Basically, when Button A is toggled on, Button B becomes toggled off, and vice versa. When Button A is…
0
votes
1 answer

JToggleButton - how to get selected state?

I'm making a BMR calculator and one of my panels gives the user an option to change how they wish to enter their height, from cm to ft/inches. Here's the block of code that deals with said panel. // Height JComponents heightLabel = new…
user3186023
0
votes
2 answers

How to untoggle jtogglebuttons on second click that belongs to ButtonGroups

How to untoggle jtogglebuttons that belongs to ButtonGroups on second click? What listener should I use for this? Thanks! JtoggleButton toggleButton; toggleButton.addActionListener? toggleButton.addChangeListener?
Philip Morris
  • 459
  • 1
  • 9
  • 26
0
votes
3 answers

How to make a JButton not selected after clicking it?

I have been created a delete button which delete some text from text field. But when I click this button and delete the text the button still selected. I want to deselect this button after clicking it. I tried this code but it doesn't work private…
Basma Ali
  • 45
  • 7
0
votes
1 answer

Check if all buttons are selected

So I have a custom button that once you select it you can't un-select it. I want to check if 6 buttons on my program are selected and do something after that. Looks messy but I thought that would have worked for me. Suggestions please? …
0
votes
0 answers

Resetting toggle buttons

I am designing an elevator for my software engineering class. I am using toggle buttons on the elevator cars inside panel for floor selection. I cannot figure out how to toggle the button off if the current floor equals the button being toggled. I…
user1184034
  • 71
  • 3
  • 11
0
votes
1 answer

JToggleButton - How to change the color?

I could to set the color of the button, but once the button is pressed its color is blue - standard. I want to be black. How do I change it? Below is the current code: public JPanel gameBoard(){ JPanel pBoard = new JPanel(); …
user3868442
  • 117
  • 1
  • 4
  • 12
0
votes
1 answer

Whats wrong with my ButtonGroup? Compiler error

As the topic says, I am having issues with this snippet of code. On last line I get both; Syntax error on token(s), misplaced construct(s) Syntax error on token UpperCaseButton, VariableDeclaratorId expected after this token: static JToggleButton…
RoarG
  • 793
  • 1
  • 7
  • 20
1 2 3
8 9