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
1
vote
1 answer

jgoodies binding several jtoggle button

I would like to bind 3 toggle button with my domain object. The 3 toggle should be mutually exclusive, if one of the 3 boolean property in my domain object is true, then the toggle corresponding is selected and the other 2 are unselected. I have a…
xtrem06
  • 253
  • 1
  • 3
  • 10
1
vote
1 answer

SwingX and JToggleButton

In my application i'm using JXButton from the SwingX library, i really like the painter methods. Now i have to change my simple button to toggle button and have different painter for the unselected/selected state. Unfortunately i couldn't find…
LionO
  • 13
  • 2
1
vote
0 answers

Creating a toggle button in java on macOS which clearly displays its toggle state, but without the dark blue gradient

How do you make a variable width toggle button displaying arbitrary width text (known only at runtime), with a border, which indicates state without the default dark blue gradient of a JToggleButton when toggled on on macOS High Sierra through…
Frank
  • 11
  • 1
1
vote
1 answer

JTextPane in JToggleButton, ignore mouse events?

Hi guys I am in a strange situation: there is a JToggleButton with a JTextPane as a child component. If I click on the JTextPane, the relative button's events don't go in action (because he understands that i want to click on the JTextPane, which…
Oneiros
  • 4,328
  • 6
  • 40
  • 69
1
vote
1 answer

Sliding Drawer animation on a JToggle selected state in Java?

I am trying to make a program in which, On Selecting JToggleButton shows a Sliding Drawer animated Panel and on deselecting it Hides it. I want something like this on Clicking Toggle Button, | Toggle button|---->|Panel| Slides the Panel like a…
1
vote
2 answers

Creating multiple instance of an object with same variable in Java

I have a modeless dialog which i need to show multiple instances of it displayed at the same time. I have kept the dialog as a member variable in a class which i new and show the dialog. Here there are multiple instances of dialog visible but i am…
Nitin Kale
  • 45
  • 2
  • 4
1
vote
1 answer

Changing color of a button depending on state of some Array elements

I am trying to program a JToggleButton Listener for my GUI. The JToggleButtons with this Listener basicly expand the UI to show more Elements and can close them again which all works like expected. However some of the hidden elements are JTextAreas,…
1
vote
0 answers

Opening ToggleButtons in Java for MineSweeper

So I would have asked this in the Java chat, but my new overflow account does not have 20 rep yet so I would like to ask it here. So basically my problem is sometimes when I open one of the JToggleButtons in my minesweeper application, it opens but…
Michi
  • 13
  • 4
1
vote
1 answer

How to make this text area show which toggle buttons are selected?

Please can someone help me, I'm trying to make a seat reservation part for my cinema ticket system assignment ... so the problem is i want the text of the button to show in the text area when selected and not show only the specific text when…
Rvn
  • 63
  • 10
1
vote
1 answer

Saving selection in JToggleButton

For a project I have been working on, I have had to create a JTree with a JToggleButton on each row, well two on each row actually. So to make this work, as you will see in the MCVE, I wrote a custom DefaultTreeCellRenderer and a custom…
Dan
  • 7,286
  • 6
  • 49
  • 114
1
vote
2 answers

JToolbar: JToggleButton Alignment

I am attempting to align JToggleButtons in a JToolBar. I want the buttons to be aligned vertically and to the left. My code is as follows: JToolBar toolbar = new JToolBar(); toolbar.setLayout(new…
Joe Balin
  • 177
  • 2
  • 17
1
vote
1 answer

How to make JToggleButton-size fixed upon selection and deselection?

How to make size of JToggleButton fixed and equal for both Selected and Not Selected states? As you see below, I have a variable length button now: Not Selected size: And Selected size I tried setSize() and setPreferedSize() methods, but nothing…
EbraHim
  • 2,279
  • 2
  • 16
  • 28
1
vote
1 answer

Disabling Enabled Effect on JToggleButton

I've got an application that is using Swing for it's UI. I want a button that switch the type of communication that the app is using. I want to use a Toggle Button to identify the type of communication that's selected. My problem is that I don't…
mcheli
  • 35
  • 1
  • 6
1
vote
0 answers

Change the selected state of a JToggleButton (e.g. JCheckBox) without triggering its item listeners

I'm trying to write an undo manager for JToggleButtons (specifically JCheckBoxes). Each check box has an item listener that adds a new edit to an undo manager. However, when I try to undo the selection, the setSelected(boolean) method triggers the…
ricky3350
  • 1,710
  • 3
  • 20
  • 35
1
vote
3 answers

Disable JToggleButton without graying it

I want to set my JToggleButton in a disabled state, i.e. so that the user can't toggle it by clicking. I tried btn.setEnabled(false); but it grays out my icon and I don't want that. Is there any other method which doesn't gray out the icon, but…
user3484582
  • 557
  • 1
  • 6
  • 22
1 2
3
8 9