-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Description
Consider the following snippet:
public class SnippetDrawOverButton {
public static void main(String [] args) {
var display = new Display();
var shell = new Shell(display);
shell.setLayout(new FillLayout());
Button button = new Button(shell, SWT.CHECK);
button.setText("SnippetDrawOverButton");
Font initialFont = button.getFont();
FontData[] fontData = initialFont.getFontData();
for (FontData element : fontData) {
element.setHeight(24);
}
Font newFont = new Font(display, fontData);
button.setFont(newFont);
button.addPaintListener(event -> {
Point rect = button.getSize();
event.gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
event.gc.setLineWidth(5);
event.gc.drawOval(1, 1, rect.x - 2, rect.y - 2);
});
shell.pack();
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}If you run it on GTK3 you get the oval drawn over the control: (win32 looks similar to GTK3)
But on GTK4 it draws under the control:

Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status