From: <mwl...@us...> - 2007-07-02 20:01:40
|
Revision: 415 http://svn.sourceforge.net/cishell/?rev=415&view=rev Author: mwlinnem Date: 2007-07-02 13:01:38 -0700 (Mon, 02 Jul 2007) Log Message: ----------- Changed text wrap in dialog boxes to work correctly on Windows. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java Modified: trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java 2007-07-02 18:31:24 UTC (rev 414) +++ trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java 2007-07-02 20:01:38 UTC (rev 415) @@ -41,6 +41,8 @@ * @author Bruce Herr (bh...@bh...) */ public class SWTGui implements GUI, UpdateListener { + public static final int TEXT_WRAP_LENGTH = 350; + private Shell shell; private SWTGuiComposite composite; private SelectionListener listener; @@ -70,12 +72,15 @@ if(message != null && !message.equals("")){ Label msg = new Label(shell, SWT.WRAP); msg.setText(message); - msg.pack(); - msg.update(); - + msg.pack(true); GridData labelData = new GridData(); - labelData.horizontalAlignment = SWT.FILL; + labelData.horizontalAlignment = GridData.CENTER; labelData.grabExcessHorizontalSpace = true; + System.out.println(msg.getSize().x); + if (msg.getSize().x > TEXT_WRAP_LENGTH) { + System.out.println(msg.getSize().x); + labelData.widthHint = TEXT_WRAP_LENGTH; + } msg.setLayoutData(labelData); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |