]
Eric Williams resolved ERT-765.
-------------------------------
Resolution: Done
[GTK] Nothing is rendered when creating new GC on canvas
[EBZ#551982]
---------------------------------------------------------------------
Key: ERT-765
URL:
https://issues.jboss.org/browse/ERT-765
Project: Eclipse Release Train
Issue Type: Task
Components: Platform
Reporter: Friendly Jira Robot
Assignee: Eric Williams
Priority: Major
Labels: 4.14_M3, SWT, bzira
This is example from
http://www.java2s.com/Tutorial/Java/0300__SWT-2D-Graphics/Graphics.htm
It shows empty window when run on Ubuntu 18.04 with open jdk 1.8
Mac and Windows works fine.
Also works if use e.gc instead of new GC(...)
It used to work before
Swt used
org.eclipse.swt.gtk.linux.x86_64_3.111.0.v20190605-1801.jar
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class GCCreateFrom {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Canvas Example");
shell.setLayout(new FillLayout());
final Canvas canvas = new Canvas(shell, SWT.NONE);
canvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
GC gc = new GC(canvas);
gc.setForeground(e.display.getSystemColor(SWT.COLOR_RED));
gc.drawFocus(5, 5, 200, 10);
gc.drawText("You can draw text directly on a canvas", 60, 60);
gc.dispose();
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}