有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

当应用程序在mac上打开时,java SWT选项卡项会从页面上消失

我有一个用SWT构建的应用程序。在Mac上测试时,选项卡文件夹中的选项卡项会从显示屏边缘跑掉,除非应用程序已完全屏蔽。有没有办法阻止这种情况发生?我在谷歌搜索中找不到任何东西

如果出现SWT bug,最好的解决方法是什么?我在考虑把标签文件夹放在一个可滚动的组合中,这样标签项目仍然可以在一个较小的显示屏上查看

谢谢

public FeedMonitorComposite(Composite parent, int style) {
    super(parent, style);
    setLayout(new FillLayout(SWT.HORIZONTAL));

    Composite cmpMain = new Composite(this, SWT.NONE);
    GridLayout gl_cmpMain = new GridLayout(1, false);
    gl_cmpMain.marginHeight = 0;
    gl_cmpMain.marginWidth = 0;
    cmpMain.setLayout(gl_cmpMain);

    cmpSummaries = new Composite(cmpMain, SWT.NONE);
    cmpSummaries.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
    cmpSummaries.setLayout(new FillLayout(SWT.VERTICAL));

    Composite cmpTabs = new Composite(cmpMain, SWT.NONE);
    cmpTabs.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    cmpTabs.setLayout(new FillLayout(SWT.HORIZONTAL));

    queueTabFolder = new TabFolder(cmpTabs, SWT.NONE);
}

enter image description here

private void makeTab(String description, FeedEventsFilter filter) {

    TabItem tabItem = new TabItem(view.getTabFolder(), SWT.NONE);
    tabItem.setText(description);

    Composite composite = new Composite(view.getTabFolder(), SWT.NONE);
    composite.setLayout(new FillLayout());
    tabItem.setControl(composite);

    FeedEventsTabComposite tabView = new FeedEventsTabComposite(composite, SWT.NONE);

    FeedEventsTabController controller = new FeedEventsTabController(context, filter, this, tabItem, tabView);

    tabControllers.add(controller);

共 (1) 个答案

  1. # 1 楼答案

    我也面临同样的问题

    我找到的唯一解决办法是使用CTabFolder(org.eclipse.swt.custom.CTabFolder)而不是TabFolder