本文整理匯總了Java中org.eclipse.swt.custom.CLabel.setAlignment方法的典型用法代碼示例。如果您正苦於以下問題:Java CLabel.setAlignment方法的具體用法?Java CLabel.setAlignment怎麽用?Java CLabel.setAlignment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.custom.CLabel
的用法示例。
在下文中一共展示了CLabel.setAlignment方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createLabel
import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
/**
* Creates a label for a knob
* @param root
* @param knob
*/
private CLabel createLabel(final Composite root,
final Knob<Double> knob) {
// Label
String text = "100%"; //$NON-NLS-1$
final CLabel label = new CLabel(root, SWT.NONE);
label.setText(text);
label.setAlignment(SWT.LEFT);
label.setLayoutData(SWTUtil.createFillGridData());
label.setToolTipText(text);
// Listen
knob.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
updateLabel(knob, label);
}
});
// Return
return label;
}
示例2: buildViewForm
import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
static ViewForm buildViewForm( final String title, final ItemModel model, final Composite parent){
final ViewForm vForm = new ViewForm(parent, SWT.NONE);
// -- Label(vForm)
final CLabel label = new CLabel(vForm, SWT.NONE);
label.setText(CoreConstants.TITLE_SPACE + title + CoreConstants.TITLE_SPACE);
label.setAlignment(SWT.LEFT);
label.setBackground(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.TITLE_LINE));
label.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick( MouseEvent e){
int eventType = ModelEvent.UNKNOWN;
if (CoreConstants.TITLE_HEADERS.equals(title)) {
eventType = ModelEvent.HEADERS_RESIZED;
} else if (CoreConstants.TITLE_PARAMETERS.equals(title)) {
eventType = ModelEvent.PARAMS_RESIZED;
} else if (CoreConstants.TITLE_BODY.equals(title)) {
eventType = ModelEvent.BODY_RESIZED;
} else if (CoreConstants.TITLE_REQUEST.equals(title)) {
eventType = ModelEvent.REQUEST_RESIZED;
} else if (CoreConstants.TITLE_RESPONSE.equals(title)) {
eventType = ModelEvent.RESPONSE_RESIZED;
}
model.fireExecute(new ModelEvent(eventType, model));
}
});
vForm.setTopLeft(label);
return vForm;
}
示例3: createTextSearchComposite
import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
/**
* Search Composite을 생성한다.
*/
private void createTextSearchComposite(Composite cmpMain) {
Label labelText = new Label(cmpMain, SWT.LEAD);
labelText.setText(UMLMessage.LABEL_MODELSEARCH_LABELTEXT);
labelText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
labelText.setFont(cmpMain.getFont());
cmbText = new Combo(cmpMain, SWT.SINGLE | SWT.BORDER);
cmbText.setFont(cmpMain.getFont());
GridData cmbTextGridData = new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1);
cmbText.setLayoutData(cmbTextGridData);
chkCaseSensitive = new Button(cmpMain, SWT.CHECK);
chkCaseSensitive.setText(UMLMessage.LABEL_MODELSEARCH_CASESENSITIVE);
chkCaseSensitive.setSelection(isCaseSensitive);
chkCaseSensitive.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
chkCaseSensitive.setFont(cmpMain.getFont());
CLabel statusLabel = new CLabel(cmpMain, SWT.LEAD);
statusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
statusLabel.setText(UMLMessage.LABEL_MODELSEARCH_STATUSLABEL);
statusLabel.setAlignment(SWT.LEFT);
cmbText.setItems(getPreviousSearchPatterns());
if (getPreviousSearchPatterns().length > 0) {
cmbText.select(0);
}
}
示例4: initGUI
import org.eclipse.swt.custom.CLabel; //導入方法依賴的package包/類
private void initGUI() {
try {
GridLayout thisLayout = new GridLayout(4, true);
thisLayout.numColumns = 4;
this.setLayout(thisLayout);
this.setSize(374, 256);
{
shopLabel = new CLabel(this, SWT.NONE);
shopLabel.setText("$SHOP$");
shopLabel.setLayout(null);
GridData shopLabelLData = new GridData();
shopLabel.setAlignment(SWT.CENTER);
shopLabelLData.heightHint = 19;
shopLabelLData.horizontalSpan = 4;
shopLabelLData.grabExcessHorizontalSpace = true;
shopLabelLData.horizontalAlignment = GridData.FILL;
shopLabel.setLayoutData(shopLabelLData);
}
{
shopPanel = new Group(this, SWT.NONE);
RowLayout shopPanelLayout = new RowLayout(org.eclipse.swt.SWT.HORIZONTAL);
GridData shopPanelLData = new GridData();
shopPanelLData.horizontalSpan = 4;
shopPanelLData.verticalAlignment = GridData.FILL;
shopPanelLData.horizontalAlignment = GridData.FILL;
shopPanelLData.grabExcessHorizontalSpace = true;
shopPanelLData.grabExcessVerticalSpace = true;
shopPanel.setLayoutData(shopPanelLData);
shopPanel.setLayout(shopPanelLayout);
shopPanel.setText("$Items$");
}
{
jButton1 = new Button(this, SWT.NONE);
jButton1.setText("Cancel");
GridData jButton1LData = new GridData();
jButton1LData.widthHint = 79;
jButton1LData.heightHint = 22;
jButton1.setLayoutData(jButton1LData);
}
{
jButton2 = new Button(this, SWT.NONE);
jButton2.setText("Checkout");
GridData jButton2LData = new GridData();
jButton2LData.widthHint = 79;
jButton2LData.heightHint = 22;
jButton2.setLayoutData(jButton2LData);
}
{
jButton3 = new Button(this, SWT.NONE);
jButton3.setText("Add...");
GridData jButton3LData = new GridData();
jButton3LData.widthHint = 79;
jButton3LData.heightHint = 22;
jButton3.setLayoutData(jButton3LData);
}
{
jButton4 = new Button(this, SWT.NONE);
jButton4.setText("Remove");
GridData jButton4LData = new GridData();
jButton4LData.widthHint = 79;
jButton4LData.heightHint = 22;
jButton4.setLayoutData(jButton4LData);
}
} catch (Exception e) {
e.printStackTrace();
}
}