tomrey's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
8 (0.01 per day)
Joined:
22-February 13
Profile Views:
108
Last Active:
User is offline Mar 20 2013 01:22 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   tomrey has not set their status

Posts I've Made

  1. In Topic: How to select default value of jRadioButton inside jTable

    Posted 27 Feb 2013

    View Posttomrey, on 22 February 2013 - 02:02 PM, said:

    View Postpbl, on 22 February 2013 - 01:35 PM, said:

    JRadioButton rb = (JRadioButton) model.getValueAt(0,0);
    if(rb.isSelected()) {
    ...

    after populate the table i need to select the first member, so by default, I wonder if this solve it?

    Finally I found it.

    I use :
    table.setValueAt(true, 0, 1);
    
    

    Thanks a lot.
  2. In Topic: How to select default value of jRadioButton inside jTable

    Posted 22 Feb 2013

    Ok, thanks a lot.
  3. In Topic: How to select default value of jRadioButton inside jTable

    Posted 22 Feb 2013

    View Postpbl, on 22 February 2013 - 03:56 PM, said:

    No relation at all with JTable... so your topic title is really misleading

    Create a ButtonGroup
    ButtonGroup bg = new ButtonGroup();

    each time you create a JRadioButton add it to the ButtonGroup
    JRadioButton rb = new JRadioButton("qwerty");
    bg.add(rb);

    just make sure that the first one you add is setSelected(true);

    Sorry for the misleading title but I'm still a beginner in Java with problems of translation from Spanish to English.
    I'm still not sure how I add a button to the group, because according to me when I add the radio button I already have generated the table. With this instructions:

    TableColumn column = table.getColumnModel().getColumn(1);  
    column.setCellEditor(new RadioButtonCellEditorRenderer());  
    column.setCellRenderer(new RadioButtonCellEditorRenderer());  
    
    
  4. In Topic: How to select default value of jRadioButton inside jTable

    Posted 22 Feb 2013

    View Postpbl, on 22 February 2013 - 03:01 PM, said:

    The first member of a JTable is itsTableModel.getValueAt(0,0) unless you have another definition of what the first member of a JTable is

    I found this sample code:
    import java.applet.Applet;
    import java.awt.Checkbox;
    import java.awt.CheckboxGroup;
    /*
    <applet code="SetSelectedRadioButtonExample" width=200 height=200>
    </applet>
    */
    public class SetSelectedRadioButtonExample extends Applet{
            CheckboxGroup lngGrp = null;
            public void init(){
                    //create group
                    lngGrp = new CheckboxGroup();
                    //create checkboxes and add to group
                    Checkbox java = new Checkbox("Java", lngGrp, false);
                    Checkbox cpp = new Checkbox("C++", lngGrp, false);
                    Checkbox vb = new Checkbox("VB", lngGrp, false);
                    //add radio buttons
                    add(java);
                    add(cpp);
                    add(vb);
                    lngGrp.setSelectedCheckbox(java);
            }
    }
    
    

    My question is how can I do the instruction

    lngGrp.setSelectedCheckbox(java);

    On my code (I use JDBC for populate my jTable with jRadioButtons).
  5. In Topic: How to select default value of jRadioButton inside jTable

    Posted 22 Feb 2013

    View Postpbl, on 22 February 2013 - 01:35 PM, said:

    JRadioButton rb = (JRadioButton) model.getValueAt(0,0);
    if(rb.isSelected()) {
    ...

    after populate the table i need to select the first member, so by default, I wonder if this solve it?

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

tomrey hasn't added any friends yet.

Comments

tomrey has no profile comments yet. Why not say hello?