[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] label containing unicode copyright sign not shown on certain Motif
|
- From: exquisitus <nick58@xxxxxxxxxx>
- Date: Fri, 08 Jul 2005 11:54:01 +0100
- Newsgroups: eclipse.platform.swt
- Organization: EclipseCorner
- User-agent: Mozilla Thunderbird 0.8 (X11/20040913)
I have a program with an "About" dialog that contains a copyright notice.
The dialog contains a couple of labels, one of which includes a copyright
symbol, expressed as "\u00a9".
When I run this on Linux/GTK or Win32 or Solaris 5.9 Motif, it works OK, but
on HP-UX11.0 and Solaris 5.8 (both Motif), the label containing the copyright
symbol does not appear at all (i.e. it's not just the symbol that is missing,
or drawn incorrectly). The following example demonstrates this; the dialog
shown has two labels, but only the second appears on the problematic
platforms.
A Swing program that contains a copyright symbol works OK, so I don't think
there's a fundamental problem with Motif. Any ideas what might be wrong?
///// SWT example
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class SWTCopyrightDialog extends Dialog {
protected Object result;
protected Shell shell;
public SWTCopyrightDialog(Shell parent, int style) {
super(parent, style);
}
public SWTCopyrightDialog(Shell parent) {
this(parent, SWT.NONE);
}
public Object open() {
createContents();
shell.open();
shell.layout();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
return result;
}
protected void createContents() {
shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setSize(500, 375);
shell.setText("SWT Dialog");
final Label label1 = new Label(shell, SWT.NONE);
label1.setText("Here's a copyright : \u00a9");
label1.setBounds(40, 105, 305, 100);
final Label label2 = new Label(shell, SWT.NONE);
label2.setText("Here's some text");
label2.setBounds(40, 205, 305, 100);
//
}
public static void main(String[] args)
{
SWTCopyrightDialog o = new SWTCopyrightDialog(new Shell(Display.getCurrent()));
o.open();
}
}
/// Swing example
import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.Font;
import javax.swing.JDialog;
import javax.swing.JLabel;
public class CopyrightDialog extends JDialog {
public static void main(String args[]) {
try {
CopyrightDialog dialog = new CopyrightDialog();
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
public CopyrightDialog() {
super();
setBounds(100, 100, 500, 375);
final JLabel heresACopyrightLabel = new JLabel();
heresACopyrightLabel.setFont(new Font("Monospaced",Font.PLAIN,18));
heresACopyrightLabel.setText("Here's a copyright sign: \u00a9");
getContentPane().add(heresACopyrightLabel, BorderLayout.CENTER);
//
}
}