在 JTabbedPane 中将选项卡置于最前面 [英] Bringing tab to front in JTabbedPane

查看:51
本文介绍了在 JTabbedPane 中将选项卡置于最前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 JTabbedPane 对象上使用 setSelectedComponentsetSelectedIndex 时,面板总是出现在我的 UI 中.但是,有时与面板关联的选项卡仍处于隐藏状态.换句话说,选项卡不会滚动到选项卡式窗格的可见部分.

When I use setSelectedComponent or setSelectedIndex on a JTabbedPane object, the panel always comes up in my UI. However, sometimes the tab associated with the panel remains hidden. In other words, the tab does not scroll to a visible portion of the tabbed pane.

我该如何解决这个问题?我已经尝试了俗气的选择一个索引,然后选择所需的索引,以及其他一些更优雅的东西,但是 arrrrgh!!

How can I fix this? I have tried the cheesy select one index, then select desired index, as well as several other more elegant things, but arrrrgh!!

如果可以,请帮助我.

谢谢,托德

推荐答案

我认为您的电话不是在 EDT 上完成的.用 SwingUtilities.invokeLater

I think your call is not done on EDT. Wrap it with SwingUtilities.invokeLater

这篇关于在 JTabbedPane 中将选项卡置于最前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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