This is the mail archive of the
cygwin-xfree
mailing list for the Cygwin XFree86 project.
Java SWT app fails to render from AIX on Cygwin X
- From: Stephen McCants <stephenmccants at yahoo dot com>
- To: cygwin-xfree at cygwin dot com
- Date: Tue, 3 Feb 2009 16:19:17 -0800 (PST)
- Subject: Java SWT app fails to render from AIX on Cygwin X
- Reply-to: cygwin-xfree at cygwin dot com
Hello,
I've run into a problem with Cygwin X that I'm at a loss as to how
to debug further. I have a trivial test case that uses Java and SWT,
and it creates a simple dialog box (source code provided below - I
found it as an example on the internet). I have two other machines -
one is a Linux box (RHEL 4) and the other is an AIX machine (AIX 5.3).
I start my Cygwin X server so that it displays its windows side by
side on the desktop with Windows' windows. I then ssh with X11
tunnelling (using Putty) to the Linux and AIX boxes. Both can send
back xterm windows without problem. However, when I run my simple test
program, it works on Linux and fails on AIX (draws an ugly unresponsive
gray box that I can drag around the screen but not close - it doesn't
have the buttons). If I run both the applications to display on my
Linux box, then they both work correctly, so it isn't AIX that is
failing by itself or with a Linux X server, but an AIX/Cygwin
interaction seems to be going awry.
So, what are some of the obvious differences between AIX and Linux here:
1) Different Java binaries (they are the same Java version, so I think this is unlikely to be the problem)
2) Different graphics libraries. Both use SWT, but on Linux SWT uses GTK. On AIX, SWT uses Motif.
Possibly related bugs I found:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=36806
At this point, I'm at a loss as to how to further debug the problem. I'd appreciate any thoughts. Thanks!
Sincerely,
Stephen McCants
Steps to reproduce:
0) Log into an AIX box from a Windows machine with SSH (X11 tunneling on) and Cygwin X.
1) Create a file named DialogClass.java containing:
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class DialogClass {
static boolean deleteFlag = false;
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Dialog Example");
shell.setSize(300, 200);
shell.open();
final Button button = new Button(shell, SWT.PUSH);
button.setText("Delete File");
button.setBounds(20, 40, 80, 25);
final Text text = new Text(shell, SWT.SHADOW_IN);
text.setBounds(140, 40, 100, 25);
final Shell dialog = new Shell(shell, SWT.APPLICATION_MODAL
| SWT.DIALOG_TRIM);
dialog.setText("Delete File");
dialog.setSize(250, 150);
final Button buttonOK = new Button(dialog, SWT.PUSH);
buttonOK.setText("OK");
buttonOK.setBounds(20, 55, 80, 25);
Button buttonCancel = new Button(dialog, SWT.PUSH);
buttonCancel.setText("Cancel");
buttonCancel.setBounds(120, 55, 80, 25);
final Label label = new Label(dialog, SWT.NONE);
label.setText("Delete the file?");
label.setBounds(20, 15, 100, 20);
Listener listener = new Listener() {
public void handleEvent(Event event) {
if (event.widget == buttonOK) {
deleteFlag = true;
} else {
deleteFlag = false;
}
dialog.close();
}
};
buttonOK.addListener(SWT.Selection, listener);
buttonCancel.addListener(SWT.Selection, listener);
Listener buttonListener = new Listener() {
public void handleEvent(Event event) {
dialog.open();
}
};
button.addListener(SWT.Selection, buttonListener);
while (!dialog.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
if (deleteFlag) {
text.setText("File deleted.");
} else {
text.setText("File not deleted.");
}
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
2) Set your CLASSPATH to contain the SWT jar files:
export CLASSPATH=<path to
SWT>/org.eclipse.swt_3.3.0.v3446.jar:<path to
SWT>/org.eclipse.swt.motif.aix.ppc_3.3.0.v3346.jar:.
3) Compile the program:
javac DialogClass.java
4) Run the program:
java DialogClass
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/