"Select..."));
this.selectFontButton.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
// Create the font-change dialog
FontDialog dlg = new FontDialog(getShell());
dlg.setText(localizationResources.getString(
"Font_Selection"));
dlg.setFontList(new FontData[] {
SWTTitleEditor.this.titleFont });
if (dlg.open() != null) {
// Dispose of any fonts we have created
if (SWTTitleEditor.this.font != null) {
SWTTitleEditor.this.font.dispose();
}
// Create the new font and set it into the title
// label
SWTTitleEditor.this.font = new Font(
getShell().getDisplay(), dlg.getFontList());
//titleField.setFont(font);
SWTTitleEditor.this.fontField.setText(
SWTTitleEditor.this.font.getFontData()[0]
.toString());
SWTTitleEditor.this.titleFont
= SWTTitleEditor.this.font.getFontData()[0];
}
}
}
);
// row 4
new Label(general, SWT.NONE).setText(localizationResources.getString(
"Color"));
// Use a SwtPaintCanvas to show the color, note that we must set the
// heightHint.
final SWTPaintCanvas colorCanvas = new SWTPaintCanvas(general,
SWT.NONE, this.titleColor);
GridData canvasGridData = new GridData(SWT.FILL, SWT.CENTER, true,
false);
canvasGridData.heightHint = 20;
colorCanvas.setLayoutData(canvasGridData);
this.selectColorButton = new Button(general, SWT.PUSH);
this.selectColorButton.setText(localizationResources.getString(
"Select..."));
this.selectColorButton.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
// Create the color-change dialog
ColorDialog dlg = new ColorDialog(getShell());
dlg.setText(localizationResources.getString(
"Title_Color"));
dlg.setRGB(SWTTitleEditor.this.titleColor.getRGB());
RGB rgb = dlg.open();
if (rgb != null) {
// create the new color and set it to the
// SwtPaintCanvas
SWTTitleEditor.this.titleColor = new Color(
getDisplay(), rgb);