SWT使复合完全填充父级

时间:2016-04-05 16:36:37

标签: java swt

我的SWT GUI有问题:
我有一个TabFolder,其中包含一个ScrolledComposite,其中包含Composite,而Composites又包含更多Composites。问题是这些Composite并未完全采用ScrolledCompositeComposite的大小。

The problem
如您所见,具有边框的内部GridLayout完全没有填充它的父级 家长使用GridData,因此我已经尝试通过设置Composite base = new Composite(parent, SWT.BORDER); base.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

来获得我想要的内容
base.setSize(parent.getSize())

但是你可以看到这并不起作用。

有谁知道怎么做?
(在创作时我现在不是父母的最终尺寸,因此我不能start <- as.POSIXlt("2015-10-10 00:00:00") end <- as.POSIXlt("2016-03-31 00:00:00") DateSeq <- seq(from=start, to=end, by="mins") #Holidays defined using a vector with by start and end date H1 <- c("2015-10-26", "2015-11-3") #October half term H2 <- c("2015-12-16", "2016-01-05") #Christmas holiday H3 <- c("2016-02-15", "2016-02-19") #Feb half term H4 <- c("2016-03-24", "2016-03-31") #Easter holiday date_table <- data.frame(Time = DateSeq) if ((round(date_table$Time, units = "days")== H1[1] <> H1[2]) | (round(date_table$Time, units = "days") == H2[1] <> H2[2])) { date_table$Holiday <- "Holiday" } else { date_table$Holiday <- "Term" }

1 个答案:

答案 0 :(得分:1)

使用

GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
yourComposite.setLayout(layout);

去掉你不想要的边距。

您可能需要将其应用于多个父母。

相关问题