radio « Button « Java Swing Q&A





1. Word-wrap radio button text in Java?    stackoverflow.com

I have some radio buttons whose text may be very long. Is there an easy way to word-wrap them? Yes, wrapping them in <html> tags and inserting <br> tags would work, ...

2. JRadioButton border/padding/insets/margin... whatever you call it    stackoverflow.com

In my Java app I am trying to create a very simple form with a label and a set of controls on each row of the form. Imagine something like this ...

3. Detecting a JRadioButton state change    stackoverflow.com

How can I detect when a JRadioButton is changed from 'unselected' to 'selected' when clicked with the mouse? I've tried using an ActionListener on the button, but that gets fired every ...

4. Binding enum values to RadioButton in Java    stackoverflow.com

I am stuck in binding values from enum to RadioButton. Lets say I have a bean:

public class ValueObject {
  public enum ValueEnum {
    FIRST_VALUE,
    ...

5. Redefine the behavior of the Tab key in a JRadioButton?    stackoverflow.com

I'm trying to redefine the behavior of the Tab key in a JRadioButton so it behaves like radio buttons in other GUI applications, that is:

  • Arrow keys cycle through the radio buttons ...

6. Unselecting RadioButtons in Java Swing    stackoverflow.com

When displaying a group of JRadioButtons, initially none of them is selected (unless you programmatically enforce that). I would like to be able to put buttons back into that state even ...

7. How to make radio buttons change text dynamically in Java    stackoverflow.com

I'm fairly new to GUI. I'm trying to make it so that depending on which radio button is selected, a JLabel changes its value. For example, if "id" is selected, it'll ...

8. pass radiobutton value that selected to another class     stackoverflow.com

is there any example for me to pass radiobutton value that selected to another class?

jr1 = new JRadioButton ("11.40 AM");
    jr2 = new JRadioButton ("12.00 PM");
   ...

9. java swing aligning radiobuttons    stackoverflow.com

I want to center my radibuttons in the panel, but when I center it centers according to the lenght of the text of the button, so yes they are centered but ...





10. Rectangular Java Swing Radio buttons?    stackoverflow.com

I'd like to create a set of buttons in a Java Swing application like you get in a typical tool palette in a paint program. That is, a set of small ...

11. Java JGoodies radio button problem    stackoverflow.com

I have been using JGoodies for a long time now, but I find myself having a weird problem with radio buttons. My print statements show me that my bean is in ...

12. Use radio buttons to allow user to display a frame from another class    stackoverflow.com

I have this JRadioButton program, but I am not sure what to enter after

public void actionPerformed(ActionEvent e)
{
    if (e.getSource() == r1)
}
so that a frame from another class ...

13. Disabling GUI accessibility of Radio Buttons    forums.netbeans.org

I have developed a software in which I use radiobuttons to implement LEDs which have two states: ON and OFF. I set the LEDS as on and off by code using the setSelected() method and the display changes images to indicate the LED being on or off. I do not want a user to be able change the state the of ...

14. radio buttons and button groups    coderanch.com

15. How to write Actionlistener for dynamically created radio buttons    coderanch.com

import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; public class ButtonArrayTest extends JFrame implements ActionListener { JButton [] b = new JButton [15]; ButtonArrayTest (){ int x = 3; byte b1 = (byte) x; Container c = getContentPane (); c.setLayout (new FlowLayout ()); for (int i = 0; i < b.length; i++) { b [i] = new JButton ("x"); c.add (b ...

16. re-using radio buttons    coderanch.com





17. Radio Buttons not Displayed    coderanch.com

Basically i am trying display two radio buttons. But i dont know why the following code displays only label but no radio buttons. So, definetly i am doing some mistake somewhere. Please correct me. public class RadioAddDialog extends TXBaseDialog { private GridBagLayout paramsLayout = new GridBagLayout(); private GridBagConstraints paramsGC = new GridBagConstraints(); protected JPanel paramsPane = new JPanel(new BorderLayout()); protected JPanel ...

18. radio buttons being non focusable    coderanch.com

i have a panel in a main content pane, it contains three radio buttons and takes the focus away from the content pain of the main applet when the radio buttons are pressed. I need to keep the focus on the applets content pane in order to allow the animations i have going on to still be activated by the key ...

19. radio buttons not focusable...continued    coderanch.com

my previous thread was closed, don't know why? i have an applet with a set of animations that are activated by keys, the focus must stay on the contentPane of the applet in order for the animations to still be activated by the keys. I have a couple of radioButtons that when i press one of the options the focus remains ...

20. How to group radio buttons    coderanch.com

21. Radio Buttons    coderanch.com

Actually I have developed the TIC TAC TOE application in which user plays with computer my question is I want to have a window displayed first asking whether the user have to play first or the computer. Which should have 2 radio buttons and one yes button and one cancel button and the window should return either user or computer to ...

22. Toggling radio buttons    coderanch.com

Originally posted by Bhavna Maratkar: I want to toggle the radio buttons using left right arrow key. The radio buttons are getting toggled using the tab key. Do you really mean "toggle"? Radio buttons don't really toggle to begin with, since you unselect one by selecting another in the same group. But more than that, the tab key doesn't select or ...

23. Making radio buttons noneditable    coderanch.com

Originally posted by Bai Shen: Is there any way to make a radio button noneditable? I want to use them as an indicator of what's selected, but I don't want people to click and change the selection. Do you mean JRadioButton or JCheckBox? No matter, either way this is what setEnabled(false) does. That will also cause the LnF to give an ...

24. Radio Buttons with JScroll Pane    coderanch.com

Hi, I am new to Swing and want to write a simple panel using swing. The requiremnets are as follows: 1) will have 3 radio buttons 2) just below that have a scroll panel and based on which radio button is selected, show different text in the scroll panel. Kindly help me with the code or guide me to some tutorial ...

26. Deselect Radio Buttons    java-forums.org

Deselect Radio Buttons Hi! I made a Unit Converter Program, but theres one problem... When I run it everything works, but when i press the button clear (look in the screenshot) the text field gets cleared, but the buttons stay the same. so what i am asking, is how whould make it so when I press clear both the ...

27. How can i setString when i use radio buttons?    java-forums.org

I have realy simple but very stupid problem. I would like to know how to set string? I have JTextarea created. Also i have 3 JRadioButtons created. They control what text JTextArea displays. I did it using this method: public void itemStateChanged(ItemEvent event){ text.setText(string); } But my problem showsup then i use another 3 JRadioButtons. I want to set them to ...

28. Selecting Radio Buttons to change frames?    java-forums.org

29. Select one of X radio buttons    java-forums.org

30. Help with Radio Buttons    java-forums.org

Hi Guys Wondering if any of you would be able to help me. I have a ButtonGroup with five radio buttons. button1 button2 button3 button4 button5 At the bottom I need to include two JButtons with up and down. The idea is to move the selected radio buttom up and down using the JButtons at the bottom. Any help would be ...