本文介绍了JTabbedPane的tab区域添加一个按钮,可以显示,但是不能点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个 JTabbedPane,顶部有标签.在选项卡的右侧,我添加了一个按钮.此按钮既不是 JTabbedPane 的一部分,也不是选项卡.不幸的是,它无法点击.我猜这个按钮被 JTabbedPane 覆盖了,因为我将按钮向下移动,它被 JTabbedPane 覆盖了.

谁能给我一些建议,以便我可以点击那个按钮?

这是布局;我无法上传图片,所以我画如下:

|-------------------------------------||标签 |标签 |按钮 ||-------------------------------------||||内容 ||||-------------------------------------|
解决方案

我还没有尝试过,但您可以利用@camickr 在文章组件边框.自定义 TabbedPaneUI 是一种(费力的)替代方法.

I have a JTabbedPane with tabs on the top. To the right of the tabs, I add a button. This button is neither part of JTabbedPane nor is it a tab. Unfortunately, it cannot be clicked. I guess this button is covered by the JTabbedPane, because I moved the button down, it covered by the JTabbedPane.

Can anybody give me some suggestion, so that I can click that button?

This is the layout; I can't upload image, so I draw it like below:

|-------------------------------------|
|   tab   |  tab   |           button |
|-------------------------------------|
|                                     |
|               content               |
|                                     |
|-------------------------------------|
解决方案

I haven't tried it, but you may be able to leverage one of approaches adduced by @camickr in the article Component Border. A custom TabbedPaneUI is a (laborious) alternative.

这篇关于JTabbedPane的tab区域添加一个按钮,可以显示,但是不能点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 19:21