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

How to fix readJavaFormatString error?

I have to use netbeans GUI builder for this assignment, so I only included the code that I created. I did not include any of the pre-generated stuff. My main issue is that I don't know why my code keeps generating error messages like: (I'm not…
jlyn
  • 31
  • 1
1
vote
0 answers

Problems with html in JToggleButton

My case is simple: I am using html formatting for jtogglebutton text, but when any button is selected, it's text simply disappears: This bug exists only for text like sss fff, but not like "any usual text" Is there a way to fix…
maxpovver
  • 1,580
  • 14
  • 25
1
vote
2 answers

How to access components in a JFrame from an Internal frame

I've created java Swing app where it consist of a jDesktoppane, inside it I'm loading/calling some jinternal frames from toggle buttons in the main frame (JFrame). And I've used jButton group to all the toggle buttons so only one frame will when a…
TRomesh
  • 4,323
  • 8
  • 44
  • 74
1
vote
4 answers

How to capture the amount of clicks over a group of loop generated JToggleButtons?

I have 20 loop-generated JToggleButtons and I need to count how many of them are active. private void generarBotones(){ JToggleButton b; this.panelCuerpo.setLayout(new GridLayout(4,5)); for(int i = 1; i<=20; i++){ b =…
Andrés Buitrago
  • 205
  • 1
  • 2
  • 9
1
vote
2 answers

How do I get each of my toggle buttons to do something different?

Okay so I am programming a GUI using java swing and I have been using some old code that I used to create a moving square, but now I have to use toggle buttons to make some shapes appear and disappear from the window. My program is supposed to have…
Servanh
  • 45
  • 8
1
vote
1 answer

How can I toggle shapes on and off screen in Java Swing?

Okay so I am trying to build a program using swing in which I have to to be able to draw an oval and rectangle in the bottom right corner of the screen. I am currently trying to use a prior program in which the program starts and stops a square…
Servanh
  • 45
  • 8
1
vote
2 answers

Java JToggleButton freezes in While loop

public void playMet() { int tempo = Integer.parseInt(met_speed.getText()); tempo = tempo/60; int delay = tempo*1000; if(Play.isSelected()) { try { FileInputStream in = new FileInputStream(new…
user3562657
  • 167
  • 3
  • 15
1
vote
1 answer

Using a JToggleButton without firing it.

Is there a way to set a JToggleButton as selected or deselected without actually firing the itemevent linked to it. I have a jtogglebutton that I want fired in certain instances, but for ui purposes I would like to occasionally change it's selected…
SGWF
  • 51
  • 1
  • 3
  • 10
1
vote
2 answers

Listening for rollover on a JToggleButton in ChangeListener?

Keeping in mind that MouseListeners for Swing buttons is a big nono, how can my JToggleButton listen for rollover/mouseOver events? The code below does not print out "rollover". import java.awt.event.ItemEvent; import…
user2651804
  • 1,464
  • 4
  • 22
  • 45
1
vote
3 answers

How can I set the toggled state of JToggleButton?

I've added some JToggleButtons to a JPanel with a BoxLayout. The buttons have been placed in a ButtonGroup. Now I want to toggle some attributes for the currently selected button, only while it is selected. I'm looking for something like…
user2651804
  • 1,464
  • 4
  • 22
  • 45
1
vote
1 answer

how to set toggle button text value from db on jtable

how to set toggle button text value (depend on database) on jtable Here is the code private class CheckBoxCellEditor extends AbstractCellEditor implements TableCellEditor, ItemListener { protected JToggleButton toggle; private String…
Prasanth A R
  • 4,046
  • 9
  • 48
  • 76
1
vote
1 answer

Why is my JToggleButton not accepting my setDisabledIcon()?

I'm trying to skin a JToggleButton with 2 icons for the default and the toggle state. Why would it not change its display anyways, although I set an icon for both states? package gui; import java.awt.Image; import javax.swing.Action; import…
nakih
  • 63
  • 6
1
vote
1 answer

setFont() issue

I have two buttons to edit the font in a text. Bold button and Italic button, separately, they work fine but not togheter. How do I get my buttons to work togheter? (Bold+Italic) final JToggleButton boldbuttonpage1 = new JToggleButton(""); …
MrSilent
  • 564
  • 10
  • 28
1
vote
1 answer

Having JToggleButton with no border?

I'm trying to have JToggleButton buttons that don't have a border normally, and just show the icons I provide. But then when they are clicked, I want the selected button to show. I know that by using setLayout(null). The initial state works, but…
bforcer
  • 147
  • 3
  • 13
1
vote
2 answers

Possible bug in JToggleButton API?

I got an example for JToggleButton from java2s. In the code, I see that a toggle button does not display text properly if the text is "West". West is shown as We.. . Everything else is okay. But there is no problem when text = "west", ie w small. Is…
SuperStar
  • 495
  • 2
  • 9
  • 22
1 2 3
8 9