简体   繁体   English

如何将滚动标签的布局设置为JTabbedPane?

[英]How can I set scroll tab layout to my JTabbedPane?

I have a JTabbedPane . 我有一个JTabbedPane I drag it from the palette and paste it in my form. 我从调色板中将其拖动并粘贴到表单中。 I put 5 panel on it. 我在上面放了5个面板。 It is OK but when I put 6, panel on it it does not seen on the form because the place is not enough width. 可以,但是当我在面板上放置6时,因为位置宽度不够,所以在窗体上看不到它。 I put this code 我把这段代码

tab_group.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

But doesn't affect my code. 但不会影响我的代码。 How can I fix it? 我该如何解决?

在此处输入图片说明

try this it will help. 试试这个会有所帮助。

JScrollPane pane = new JScrollPane(panel,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    add(pane);

add Jscrollpane to panel. 将Jscrollpane添加到面板。 problem solve 问题解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM