| 1 6 package com.nightlabs.rcp.composite; 7 8 import org.eclipse.swt.SWT; 9 import org.eclipse.swt.layout.GridData; 10 import org.eclipse.swt.widgets.Composite; 11 import org.eclipse.swt.widgets.Label; 12 import org.eclipse.swt.widgets.Text; 13 14 23 public class DisguisedText { 24 25 30 public static Text createText(Composite parent) { 31 Text text = new Text(parent,SWT.NONE); 32 text.setBackground(parent.getBackground()); 33 return text; 34 } 35 36 45 public static LabeledDisguisedText createLabeledText(String title, Composite parent) { 46 Label label = new Label(parent, SWT.NONE); 47 label.setText(title); 48 label.setLayoutData(new GridData()); 49 50 Text text = createText(parent); 51 text.setText(""); 52 text.setEditable(true); 53 GridData gd = new GridData(); 54 gd.grabExcessHorizontalSpace = true; 55 gd.horizontalAlignment = GridData.FILL; 56 text.setLayoutData(gd); 57 LabeledDisguisedText result = new LabeledDisguisedText(); 58 result.setLabelControl(label); 59 result.setTextControl(text); 60 return result; 61 } 62 63 67 public static class LabeledDisguisedText { 68 69 72 public LabeledDisguisedText() { 73 super(); 74 } 75 76 private Label labelControl; 77 private Text textControl; 78 79 public Label getLabelControl() { 80 return labelControl; 81 } 82 public void setLabelControl(Label labelControl) { 83 this.labelControl = labelControl; 84 } 85 public Text getTextControl() { 86 return textControl; 87 } 88 public void setTextControl(Text textControl) { 89 this.textControl = textControl; 90 } 91 92 } 93 } 94 | Popular Tags |