summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
index 05538d4272..aa12ffabaa 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
@@ -260,6 +260,9 @@ NSAttributedString createString() {
NSMutableParagraphStyle paragraphStyle = (NSMutableParagraphStyle)new NSMutableParagraphStyle ().alloc ().init ();
paragraphStyle.autorelease ();
paragraphStyle.setLineBreakMode (OS.NSLineBreakByClipping);
+ if ((style & SWT.RIGHT) != 0) paragraphStyle.setAlignment(OS.NSRightTextAlignment);
+ if ((style & SWT.LEFT) != 0) paragraphStyle.setAlignment(OS.NSLeftTextAlignment);
+ if ((style & SWT.CENTER) != 0) paragraphStyle.setAlignment(OS.NSCenterTextAlignment);
dict.setObject (paragraphStyle, OS.NSParagraphStyleAttributeName);
}
@@ -409,17 +412,14 @@ void setBackground (float [] color) {
}
void _setAlignment() {
- if ((style & SWT.RIGHT) != 0) {
- textView.setAlignment(OS.NSRightTextAlignment);
- imageView.setImageAlignment(OS.NSImageAlignRight);
+ if (image != null) {
+ if ((style & SWT.RIGHT) != 0) imageView.setImageAlignment(OS.NSImageAlignRight);
+ if ((style & SWT.LEFT) != 0) imageView.setImageAlignment(OS.NSImageAlignLeft);
+ if ((style & SWT.CENTER) != 0) imageView.setImageAlignment(OS.NSImageAlignCenter);
}
- if ((style & SWT.LEFT) != 0) {
- textView.setAlignment(OS.NSLeftTextAlignment);
- imageView.setImageAlignment(OS.NSImageAlignLeft);
- }
- if ((style & SWT.CENTER) != 0) {
- textView.setAlignment(OS.NSCenterTextAlignment);
- imageView.setImageAlignment(OS.NSImageAlignCenter);
+ if (text != null) {
+ NSCell cell = new NSCell(textView.cell());
+ cell.setAttributedStringValue(createString());
}
}