# How to display text using addRadioButton?

**URL:** <https://discourse.processing.org/t/how-to-display-text-using-addradiobutton/29488>\
**Category:** Libraries\
**Created:** [April 19, 2021, 7:19am UTC](https://discourse.processing.org/t/how-to-display-text-using-addradiobutton/29488 "2021-04-19T07:19:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vadimkuzmin](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@Vadimkuzmin](https://discourse.processing.org/u/Vadimkuzmin)\
**Post date:** [April 19, 2021, 7:19am UTC](https://discourse.processing.org/t/how-to-display-text-using-addradiobutton/29488/1 "2021-04-19T07:19:41Z")

</div>

Good afternoon, when I click on the checkbox, the Rebook inscription appears at the bottom, but with Radio1 and Radio2 it does not appear with the NIKE inscription.

> import controlP5.\*;

ControlP5 cp5;

int myColorBackground = color(128);  
Textlabel TEST;  
Textlabel TEST2;

void setup() {  
size(700, 400);  
noStroke();  
cp5 = new ControlP5(this);

cp5.addTab(“extra”)  
.setColorBackground(color(0, 160, 100))  
.setColorLabel(color(255))  
.setColorActive(color(255, 128, 0))  
;

cp5.getTab(“extra”)  
.activateEvent(true)  
.setId(1)  
;

cp5.addCheckBox(“checkBox1”)  
.setPosition(100, 100)  
.setSize(40, 40)  
.setItemsPerRow(3)  
.setSpacingColumn(30)  
.setSpacingRow(20)  
.addItem(“checkBox”, 0)  
.moveTo(“extra”)  
;

TEST = cp5.addTextlabel(“PPP”)  
.setVisible(false)  
.setText(“Rebook”)  
.setColor(color(#00ffff))  
.setPosition(100, 150)  
.moveTo(“extra”)  
;

cp5.addRadioButton(“radioButton”)  
.setPosition(220, 110)  
.setSize(40, 20)  
.setColorForeground(color(120))  
.setColorActive(color(255))  
.setColorLabel(color(255))  
.setItemsPerRow(5)  
.setSpacingColumn(50)  
.addItem(“radio1”, 1)  
.addItem(“radio2”, 2)  
.moveTo(“extra”)  
;

TEST2 = cp5.addTextlabel(“DDD”)  
.setVisible(false)  
.setText(“NIKE”)  
.setColor(color(#00ffff))  
.setPosition(270, 150)  
.moveTo(“extra”)  
;  
}  
public void radioButton (float a)  
{  
if (a[0]==1) {  
TEST2.setVisible(true);  
} else {  
TEST2.setVisible(false);  
}  
println(a);  
}  
public void checkBox1 (float a)  
{  
if (a[0]==1) {  
TEST.setVisible(true);  
} else {  
TEST.setVisible(false);  
}  
println(a);  
}  
void draw() {  
background(myColorBackground);  
} \</\>

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [April 23, 2021, 10:15am UTC](https://discourse.processing.org/t/how-to-display-text-using-addradiobutton/29488/2 "2021-04-23T10:15:19Z")

</div>

Hi! Could you format your code with `</>` button?

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [April 25, 2021, 6:28am UTC](https://discourse.processing.org/t/how-to-display-text-using-addradiobutton/29488/3 "2021-04-25T06:28:03Z")

</div>

Try passing an integer to radioButton(int a).

```auto
public void radioButton (int a) {
if (a==1) {
TEST2.setVisible(true);
} else {
TEST2.setVisible(false);
}
println(a);
}

```
