Member Avatar for Moirae

Hello everyone!
I'm working on a project in C# and I have program already written in Java some time ago. I've worked with JToggleButton and have this setSelected method that can be set to true/false. Can someone explain me what this function does because I'm affraid that I will have to write similar in C#.
I used it like this:

btnArr[i][j] = new JToggleButton();
btnArr[i][j].addMouseListener(this);
btnArr[i][j].setFocusable(false);
if (table.getElement(i, j) == false)
	btnArr[i][j].setSelected(true);
else
	btnArr[i][j].setSelected(false);
add(btnArr[i][j], c);

Thanks :)
Cheers!!

Recommended Answers

All 3 Replies

setSelected(true) would make a check box checked, setSelected(false) would make the check box unchecked. It does the equivalent for a JToggleButton, so I imagine it'd make it appear pressed if you set it to true.

Member Avatar for Moirae

Thanks...I assume that means that it will change color in order to look like pressed

It'll probably just look indented. Like it is currently being pressed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.