Java tutorial
/** * */ package mt.com.southedge.jclockwork.plugin.preferences.fieldeditors; /* ****************************************************************************** * Copyright (c) 2011 SouthEdge Software and Consultancy. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Carl Frendo - initial design and implementation * ******************************************************************************/ import org.eclipse.jface.preference.FieldEditor; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; /** * @author cfrendo * */ public class LabelFieldEditor extends FieldEditor { private Label label; public LabelFieldEditor(String value, Composite parent) { super("label", value, parent); } @Override protected void adjustForNumColumns(int numColumns) { ((GridData) label.getLayoutData()).horizontalSpan = numColumns; } @Override protected void doFillIntoGrid(Composite parent, int numColumns) { label = getLabelControl(parent); GridData gridData = new GridData(); gridData.horizontalSpan = numColumns; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = false; gridData.verticalAlignment = GridData.CENTER; gridData.grabExcessVerticalSpace = false; label.setLayoutData(gridData); } @Override protected void doLoad() { } @Override protected void doLoadDefault() { } @Override protected void doStore() { } @Override public int getNumberOfControls() { return 1; } }