Toggle和例如后面的RadioButton吗? [英] Link between Toggle and e.g. the RadioButton behind it?

查看:90
本文介绍了Toggle和例如后面的RadioButton吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如2个单选按钮共享一个ToggleGroup.使用

Imaging e.g. 2 RadioButtons which share one ToggleGroup. Using

ToggleGroup.getToggles()

一个人可以访问ToggleGroup的所有Toggles.但是,从切换到链接到的RadioButton是否有任何引用?

one can access all Toggles of the ToggleGroup. But is there any reference from a Toggle to the RadioButton that is linked to?

推荐答案

如果我正确理解了您要查找的问题:

If I understood the question correctly you're looking for:

RadioButton button = (RadioButton) toggleGroup.getSelectedToggle();

不幸的是,ToggleGroup尚未通用化",因此您需要演员表.

Unfortunatly, the ToggleGroup isn't "generified" yet, so you need the cast.

但是从Toggle到RadioButton是否有任何引用, 链接到?

But is there any reference from a Toggle to the RadioButton that is linked to?

或者换句话说:RadioButton是一个(实现)切换,没有任何引用.

Or in other words: RadioButton is a (implements) Toggle, there isn't any reference.

这篇关于Toggle和例如后面的RadioButton吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆