单击选项卡按钮不显示组件
有一个 Tabs
组件,它有两个选项卡:
private Tabs tabClient = new Tabs();
...
tabClient.addTab("Fiche", cFicheClient); // cFicheClient is a Container
tabClient.addTab("Crédits", cClientEtCredits); // cClientEtCredits is a Container
tabClient.addTabsFocusListener(this);
public void focusGained(Component arg0) {
String noms = Formatage.getColumnValueAt(String.valueOf(fichesignalitique.elementAt(0)).toUpperCase(), 11);
if (tabClient.getSelectedIndex() == 0)
{
setTitle("Fiche signalétique de " + noms);
photosBtn.requestFocus();
}
else
{
setTitle("Liste des crédits de " + noms);
recapClient.requestFocus();
}
repaint();
}
在运行时我无法单击“Crédits”选项卡:选项卡不显示 cClientEtCredits
容器的组件!而且,当显示 Form
时,Form
的标题也不会显示,但我必须单击一个选项卡按钮才能显示 Form
'的标题!
那么为什么呢?
There is a Tabs
component which has two tab :
private Tabs tabClient = new Tabs();
...
tabClient.addTab("Fiche", cFicheClient); // cFicheClient is a Container
tabClient.addTab("Crédits", cClientEtCredits); // cClientEtCredits is a Container
tabClient.addTabsFocusListener(this);
public void focusGained(Component arg0) {
String noms = Formatage.getColumnValueAt(String.valueOf(fichesignalitique.elementAt(0)).toUpperCase(), 11);
if (tabClient.getSelectedIndex() == 0)
{
setTitle("Fiche signalétique de " + noms);
photosBtn.requestFocus();
}
else
{
setTitle("Liste des crédits de " + noms);
recapClient.requestFocus();
}
repaint();
}
In runtime I cannot click the "Crédits" tab : the Tabs doesn't show the components of the cClientEtCredits
Container ! And also the Form
's title is not displayed when the Form
is shown but I must click one tab button in order to show the Form
's title !
So why ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜测这是因为焦点侦听器内的请求焦点调用。
您可能应该在在将焦点移动到不同的组件之前使用
setSelectedIndex
之类的方法更改选项卡选择。I'm guessing its because of the request focus call within a focus listener.
You should probably change the tab selection before moving the focus to a different component by using something like
setSelectedIndex
.