Search in sources :

Example 1 with FontDialog

use of org.eclipse.swt.widgets.FontDialog in project cubrid-manager by CUBRID.

the class QueryPropertyComposite method createContent.

/**
	 * create the content.
	 * 
	 */
private void createContent() {
    setLayout(new GridLayout());
    setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    final Group autocommitGroup = new Group(this, SWT.NONE);
    final GridData gdAutocommitGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
    autocommitGroup.setLayoutData(gdAutocommitGroup);
    autocommitGroup.setLayout(new GridLayout());
    autocommitBtn = new Button(autocommitGroup, SWT.CHECK);
    final GridData gdAutocommitBtn = new GridData(SWT.FILL, SWT.CENTER, true, false);
    autocommitBtn.setLayoutData(gdAutocommitBtn);
    autocommitBtn.setText(Messages.autoCommitLabel);
    final Group groupFirst = new Group(this, SWT.NONE);
    groupFirst.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    groupFirst.setLayout(gridLayout);
    searchUnitBtn = new Button(groupFirst, SWT.CHECK);
    final GridData gdSearchUnitBtn = new GridData(SWT.LEFT, SWT.CENTER, true, false);
    searchUnitBtn.setLayoutData(gdSearchUnitBtn);
    searchUnitBtn.setText(Messages.searchUnitInstances);
    searchUnitBtn.addSelectionListener(new SelectionAdapter() {

        /**
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
			 * @param event an event containing information about the selection
			 */
        public void widgetSelected(SelectionEvent event) {
            unitCountSpinner.setEnabled(searchUnitBtn.getSelection());
        }
    });
    unitCountSpinner = new Spinner(groupFirst, SWT.BORDER);
    unitCountSpinner.setMaximum(2147483647);
    final GridData gdUnitCountSpinner = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
    gdUnitCountSpinner.widthHint = 129;
    unitCountSpinner.setLayoutData(gdUnitCountSpinner);
    unitCountSpinner.setIncrement(100);
    final Label label = new Label(groupFirst, SWT.NONE);
    label.setText(Messages.pageUnitInstances);
    pageUnitCountSpinner = new Spinner(groupFirst, SWT.BORDER);
    pageUnitCountSpinner.setMaximum(2147483647);
    final GridData gdPageUnitSpinner = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
    gdPageUnitSpinner.widthHint = 129;
    pageUnitCountSpinner.setLayoutData(gdPageUnitSpinner);
    pageUnitCountSpinner.setIncrement(10);
    final Label lobSizeLabel = new Label(groupFirst, SWT.NONE);
    lobSizeLabel.setText(Messages.lblLobLoadSize);
    loadSizeSpinner = new Spinner(groupFirst, SWT.BORDER);
    loadSizeSpinner.setMaximum(1024 * 1024);
    final GridData gdlobSizeSpinner = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
    gdlobSizeSpinner.widthHint = 129;
    loadSizeSpinner.setLayoutData(gdPageUnitSpinner);
    loadSizeSpinner.setIncrement(8);
    multiPageConfirmBtn = new Button(groupFirst, SWT.CHECK);
    multiPageConfirmBtn.setText(Messages.showMultiPageConfirm);
    {
        final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.horizontalSpan = 2;
        multiPageConfirmBtn.setLayoutData(gd);
    }
    keywordLowerBtn = new Button(groupFirst, SWT.CHECK);
    keywordLowerBtn.setText(Messages.btnKeywordLowercase);
    final GridData gdKeywordBtn = new GridData(GridData.FILL_HORIZONTAL);
    gdKeywordBtn.horizontalSpan = 2;
    keywordLowerBtn.setLayoutData(gdKeywordBtn);
    autoNoUppercaseKeywordBtn = new Button(groupFirst, SWT.CHECK);
    autoNoUppercaseKeywordBtn.setText(Messages.btnNoAutoUppercase);
    final GridData gdAutoUppercaseKeywordBtn = new GridData(GridData.FILL_HORIZONTAL);
    gdAutoUppercaseKeywordBtn.horizontalSpan = 2;
    autoNoUppercaseKeywordBtn.setLayoutData(gdAutoUppercaseKeywordBtn);
    withoutPromptSaveBtn = new Button(groupFirst, SWT.CHECK);
    withoutPromptSaveBtn.setText(Messages.btnWithoutPromptSave);
    final GridData gdPromptSaveBtn = new GridData(GridData.FILL_HORIZONTAL);
    gdPromptSaveBtn.horizontalSpan = 2;
    withoutPromptSaveBtn.setLayoutData(gdPromptSaveBtn);
    useScientificNotationBtn = new Button(groupFirst, SWT.CHECK);
    useScientificNotationBtn.setText(Messages.btnUseScientificNotation);
    useScientificNotationBtn.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
    final Group changeFontGroup = new Group(this, SWT.NONE);
    changeFontGroup.setText(Messages.changeFont);
    final GridData gdChangeFontGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
    changeFontGroup.setLayoutData(gdChangeFontGroup);
    changeFontGroup.setLayout(new GridLayout());
    final Group exampleGroup = new Group(changeFontGroup, SWT.NONE);
    exampleGroup.setText(Messages.fontExample);
    final GridData gdExmplaeGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
    exampleGroup.setLayoutData(gdExmplaeGroup);
    exampleGroup.setLayout(new GridLayout());
    fontExampleTxt = new Text(exampleGroup, SWT.CENTER | SWT.BORDER);
    fontExampleTxt.setEditable(false);
    fontExampleTxt.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 30));
    fontExampleTxt.setText("CUBRID");
    Menu menu = new Menu(getShell(), SWT.POP_UP);
    fontExampleTxt.setMenu(menu);
    final Composite btnComposite = new Composite(changeFontGroup, SWT.NONE);
    btnComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
    final GridLayout gridLayoutBtnComposite = new GridLayout();
    gridLayoutBtnComposite.numColumns = 2;
    btnComposite.setLayout(gridLayoutBtnComposite);
    Button changeBtn = new Button(btnComposite, SWT.PUSH);
    final GridData gdChangeBtn = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
    changeBtn.setLayoutData(gdChangeBtn);
    changeBtn.setText(Messages.change);
    changeBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            FontDialog dlg = new FontDialog(getShell());
            FontData fontdata = null;
            if (fontString == null || fontString.trim().length() == 0) {
                fontdata = new FontData();
                String[] fontStr = QueryOptions.getDefaultFont();
                fontdata.setName(fontStr[0]);
                fontdata.setHeight(Integer.parseInt(fontStr[1]));
                fontdata.setStyle(Integer.parseInt(fontStr[2]));
            } else {
                fontdata = new FontData(fontString);
            }
            FontData[] fontList = new FontData[1];
            fontList[0] = fontdata;
            dlg.setRGB(new RGB(fontColorRed, fontColorGreen, fontColorBlue));
            dlg.setFontList(fontList);
            fontdata = dlg.open();
            if (fontdata != null) {
                fontString = fontdata.toString();
                RGB rgb = dlg.getRGB();
                if (rgb != null) {
                    fontColorRed = rgb.red;
                    fontColorBlue = rgb.blue;
                    fontColorGreen = rgb.green;
                }
                changeExampleFont();
            }
        }
    });
    Button restoreBtn = new Button(btnComposite, SWT.PUSH);
    restoreBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    restoreBtn.setText(Messages.restoreDefault);
    restoreBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            fontString = "";
            FontData[] fData = Display.getDefault().getSystemFont().getFontData();
            if (fData != null && fData.length > 0) {
                fontString = fData[0].toString();
            }
            fontColorRed = 0;
            fontColorGreen = 0;
            fontColorBlue = 0;
            changeExampleFont();
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) FontDialog(org.eclipse.swt.widgets.FontDialog) Composite(org.eclipse.swt.widgets.Composite) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) FontData(org.eclipse.swt.graphics.FontData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) RGB(org.eclipse.swt.graphics.RGB) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu)

Example 2 with FontDialog

use of org.eclipse.swt.widgets.FontDialog in project eclipse.platform.swt by eclipse.

the class DialogTab method createButtonSelected.

/**
 * Handle the create button selection event.
 *
 * @param event org.eclipse.swt.events.SelectionEvent
 */
void createButtonSelected(SelectionEvent event) {
    /* Compute the appropriate dialog style */
    int style = getDefaultStyle();
    if (okButton.getEnabled() && okButton.getSelection())
        style |= SWT.OK;
    if (cancelButton.getEnabled() && cancelButton.getSelection())
        style |= SWT.CANCEL;
    if (yesButton.getEnabled() && yesButton.getSelection())
        style |= SWT.YES;
    if (noButton.getEnabled() && noButton.getSelection())
        style |= SWT.NO;
    if (retryButton.getEnabled() && retryButton.getSelection())
        style |= SWT.RETRY;
    if (abortButton.getEnabled() && abortButton.getSelection())
        style |= SWT.ABORT;
    if (ignoreButton.getEnabled() && ignoreButton.getSelection())
        style |= SWT.IGNORE;
    if (iconErrorButton.getEnabled() && iconErrorButton.getSelection())
        style |= SWT.ICON_ERROR;
    if (iconInformationButton.getEnabled() && iconInformationButton.getSelection())
        style |= SWT.ICON_INFORMATION;
    if (iconQuestionButton.getEnabled() && iconQuestionButton.getSelection())
        style |= SWT.ICON_QUESTION;
    if (iconWarningButton.getEnabled() && iconWarningButton.getSelection())
        style |= SWT.ICON_WARNING;
    if (iconWorkingButton.getEnabled() && iconWorkingButton.getSelection())
        style |= SWT.ICON_WORKING;
    if (primaryModalButton.getEnabled() && primaryModalButton.getSelection())
        style |= SWT.PRIMARY_MODAL;
    if (applicationModalButton.getEnabled() && applicationModalButton.getSelection())
        style |= SWT.APPLICATION_MODAL;
    if (systemModalButton.getEnabled() && systemModalButton.getSelection())
        style |= SWT.SYSTEM_MODAL;
    if (sheetButton.getSelection())
        style |= SWT.SHEET;
    if (saveButton.getEnabled() && saveButton.getSelection())
        style |= SWT.SAVE;
    if (openButton.getEnabled() && openButton.getSelection())
        style |= SWT.OPEN;
    if (multiButton.getEnabled() && multiButton.getSelection())
        style |= SWT.MULTI;
    /* Open the appropriate dialog type */
    String name = dialogCombo.getText();
    if (name.equals(ControlExample.getResourceString("ColorDialog"))) {
        ColorDialog dialog = new ColorDialog(shell, style);
        if (usePreviousResultButton.getSelection()) {
            dialog.setRGB(colorDialogResult);
            dialog.setRGBs(colorDialogCustomColors);
        }
        dialog.setText(ControlExample.getResourceString("Title"));
        RGB result = dialog.open();
        textWidget.append(ControlExample.getResourceString("ColorDialog") + Text.DELIMITER);
        textWidget.append(ControlExample.getResourceString("Result", "" + result) + Text.DELIMITER);
        textWidget.append("getRGB() = " + dialog.getRGB() + Text.DELIMITER);
        textWidget.append("getRGBs() =" + Text.DELIMITER);
        RGB[] rgbs = dialog.getRGBs();
        if (rgbs != null) {
            for (RGB rgbColor : rgbs) {
                textWidget.append("\t" + rgbColor + Text.DELIMITER);
            }
        }
        textWidget.append(Text.DELIMITER);
        colorDialogResult = result;
        colorDialogCustomColors = rgbs;
        return;
    }
    if (name.equals(ControlExample.getResourceString("DirectoryDialog"))) {
        DirectoryDialog dialog = new DirectoryDialog(shell, style);
        if (usePreviousResultButton.getSelection()) {
            dialog.setFilterPath(directoryDialogResult);
        }
        dialog.setMessage(ControlExample.getResourceString("Example_string"));
        dialog.setText(ControlExample.getResourceString("Title"));
        String result = dialog.open();
        textWidget.append(ControlExample.getResourceString("DirectoryDialog") + Text.DELIMITER);
        textWidget.append(ControlExample.getResourceString("Result", "" + result) + Text.DELIMITER + Text.DELIMITER);
        directoryDialogResult = result;
        return;
    }
    if (name.equals(ControlExample.getResourceString("FileDialog"))) {
        FileDialog dialog = new FileDialog(shell, style);
        if (usePreviousResultButton.getSelection()) {
            dialog.setFileName(fileDialogResult);
            dialog.setFilterIndex(fileDialogIndexResult);
        }
        dialog.setFilterNames(FilterNames);
        dialog.setFilterExtensions(FilterExtensions);
        dialog.setText(ControlExample.getResourceString("Title"));
        String result = dialog.open();
        textWidget.append(ControlExample.getResourceString("FileDialog") + Text.DELIMITER);
        textWidget.append(ControlExample.getResourceString("Result", "" + result) + Text.DELIMITER);
        textWidget.append("getFilterIndex() =" + dialog.getFilterIndex() + Text.DELIMITER);
        textWidget.append("getFilterPath() =" + dialog.getFilterPath() + Text.DELIMITER);
        textWidget.append("getFileName() =" + dialog.getFileName() + Text.DELIMITER);
        textWidget.append("getFileNames() =" + Text.DELIMITER);
        String[] files = dialog.getFileNames();
        for (String file : files) {
            textWidget.append("\t" + file + Text.DELIMITER);
        }
        textWidget.append(Text.DELIMITER);
        fileDialogResult = result;
        fileDialogIndexResult = dialog.getFilterIndex();
        return;
    }
    if (name.equals(ControlExample.getResourceString("FontDialog"))) {
        FontDialog dialog = new FontDialog(shell, style);
        if (usePreviousResultButton.getSelection()) {
            dialog.setFontList(fontDialogFontListResult);
            dialog.setRGB(fontDialogColorResult);
        }
        dialog.setEffectsVisible(effectsVisibleButton.getSelection());
        dialog.setText(ControlExample.getResourceString("Title"));
        FontData result = dialog.open();
        textWidget.append(ControlExample.getResourceString("FontDialog") + Text.DELIMITER);
        textWidget.append(ControlExample.getResourceString("Result", "" + result) + Text.DELIMITER);
        textWidget.append("getFontList() =" + Text.DELIMITER);
        FontData[] fonts = dialog.getFontList();
        if (fonts != null) {
            for (FontData font : fonts) {
                textWidget.append("\t" + font + Text.DELIMITER);
            }
        }
        textWidget.append("getEffectsVisible() = " + dialog.getEffectsVisible() + Text.DELIMITER);
        textWidget.append("getRGB() = " + dialog.getRGB() + Text.DELIMITER + Text.DELIMITER);
        fontDialogFontListResult = dialog.getFontList();
        fontDialogColorResult = dialog.getRGB();
        return;
    }
    if (name.equals(ControlExample.getResourceString("PrintDialog"))) {
        PrintDialog dialog = new PrintDialog(shell, style);
        if (usePreviousResultButton.getSelection()) {
            dialog.setPrinterData(printDialogResult);
        }
        dialog.setText(ControlExample.getResourceString("Title"));
        PrinterData result = dialog.open();
        textWidget.append(ControlExample.getResourceString("PrintDialog") + Text.DELIMITER);
        textWidget.append(ControlExample.getResourceString("Result", "" + result) + Text.DELIMITER);
        if (result != null) {
            textWidget.append("printerData.scope = " + (result.scope == PrinterData.PAGE_RANGE ? "PAGE_RANGE" : result.scope == PrinterData.SELECTION ? "SELECTION" : "ALL_PAGES") + Text.DELIMITER);
            textWidget.append("printerData.startPage = " + result.startPage + Text.DELIMITER);
            textWidget.append("printerData.endPage = " + result.endPage + Text.DELIMITER);
            textWidget.append("printerData.printToFile = " + result.printToFile + Text.DELIMITER);
            textWidget.append("printerData.fileName = " + result.fileName + Text.DELIMITER);
            textWidget.append("printerData.orientation = " + (result.orientation == PrinterData.LANDSCAPE ? "LANDSCAPE" : "PORTRAIT") + Text.DELIMITER);
            textWidget.append("printerData.copyCount = " + result.copyCount + Text.DELIMITER);
            textWidget.append("printerData.collate = " + result.collate + Text.DELIMITER);
            textWidget.append("printerData.duplex = " + (result.duplex == PrinterData.DUPLEX_LONG_EDGE ? "DUPLEX_LONG_EDGE" : result.duplex == PrinterData.DUPLEX_SHORT_EDGE ? "DUPLEX_SHORT_EDGE" : "NONE") + Text.DELIMITER);
        }
        textWidget.append(Text.DELIMITER);
        printDialogResult = result;
        return;
    }
    if (name.equals(ControlExample.getResourceString("MessageBox"))) {
        MessageBox dialog = new MessageBox(shell, style);
        dialog.setMessage(ControlExample.getResourceString("Example_string"));
        dialog.setText(ControlExample.getResourceString("Title"));
        int result = dialog.open();
        textWidget.append(ControlExample.getResourceString("MessageBox") + Text.DELIMITER);
        /*
			 * The resulting integer depends on the original
			 * dialog style.  Decode the result and display it.
			 */
        switch(result) {
            case SWT.OK:
                textWidget.append(ControlExample.getResourceString("Result", "SWT.OK"));
                break;
            case SWT.YES:
                textWidget.append(ControlExample.getResourceString("Result", "SWT.YES"));
                break;
            case SWT.NO:
                textWidget.append(ControlExample.getResourceString("Result", "SWT.NO"));
                break;
            case SWT.CANCEL:
                textWidget.append(ControlExample.getResourceString("Result", "SWT.CANCEL"));
                break;
            case SWT.ABORT:
                textWidget.append(ControlExample.getResourceString("Result", "SWT.ABORT"));
                break;
            case SWT.RETRY:
                textWidget.append(ControlExample.getResourceString("Result", "SWT.RETRY"));
                break;
            case SWT.IGNORE:
                textWidget.append(ControlExample.getResourceString("Result", "SWT.IGNORE"));
                break;
            default:
                textWidget.append(ControlExample.getResourceString("Result", "" + result));
                break;
        }
        textWidget.append(Text.DELIMITER + Text.DELIMITER);
    }
}
Also used : FontDialog(org.eclipse.swt.widgets.FontDialog) PrintDialog(org.eclipse.swt.printing.PrintDialog) FontData(org.eclipse.swt.graphics.FontData) RGB(org.eclipse.swt.graphics.RGB) MessageBox(org.eclipse.swt.widgets.MessageBox) ColorDialog(org.eclipse.swt.widgets.ColorDialog) PrinterData(org.eclipse.swt.printing.PrinterData) FileDialog(org.eclipse.swt.widgets.FileDialog) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Example 3 with FontDialog

use of org.eclipse.swt.widgets.FontDialog in project eclipse.platform.swt by eclipse.

the class Tab method createColorAndFontGroup.

/**
 * Creates the "Colors and Fonts" group. This is typically
 * a child of the "Control" group. Subclasses override
 * this method to customize color and font settings.
 */
void createColorAndFontGroup() {
    /* Create the group. */
    colorGroup = new Group(controlGroup, SWT.NONE);
    colorGroup.setLayout(new GridLayout(2, true));
    colorGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    colorGroup.setText(ControlExample.getResourceString("Colors"));
    colorAndFontTable = new Table(colorGroup, SWT.BORDER | SWT.V_SCROLL);
    colorAndFontTable.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    TableItem item = new TableItem(colorAndFontTable, SWT.None);
    item.setText(ControlExample.getResourceString("Foreground_Color"));
    colorAndFontTable.setSelection(0);
    item = new TableItem(colorAndFontTable, SWT.None);
    item.setText(ControlExample.getResourceString("Background_Color"));
    item = new TableItem(colorAndFontTable, SWT.None);
    item.setText(ControlExample.getResourceString("Font"));
    Button changeButton = new Button(colorGroup, SWT.PUSH);
    changeButton.setText(ControlExample.getResourceString("Change"));
    changeButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    Button defaultsButton = new Button(colorGroup, SWT.PUSH);
    defaultsButton.setText(ControlExample.getResourceString("Defaults"));
    defaultsButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    /* Add listeners to set/reset colors and fonts. */
    colorDialog = new ColorDialog(shell);
    fontDialog = new FontDialog(shell);
    colorAndFontTable.addSelectionListener(widgetDefaultSelectedAdapter(event -> changeFontOrColor(colorAndFontTable.getSelectionIndex())));
    changeButton.addSelectionListener(widgetSelectedAdapter(event -> changeFontOrColor(colorAndFontTable.getSelectionIndex())));
    defaultsButton.addSelectionListener(widgetSelectedAdapter(e -> resetColorsAndFonts()));
    shell.addDisposeListener(event -> {
        if (foregroundColor != null)
            foregroundColor.dispose();
        if (backgroundColor != null)
            backgroundColor.dispose();
        if (font != null)
            font.dispose();
        foregroundColor = null;
        backgroundColor = null;
        font = null;
        if (colorAndFontTable != null && !colorAndFontTable.isDisposed()) {
            TableItem[] items = colorAndFontTable.getItems();
            for (TableItem currentItem : items) {
                Image image = currentItem.getImage();
                if (image != null)
                    image.dispose();
            }
        }
    });
}
Also used : DisposeEvent(org.eclipse.swt.events.DisposeEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) GC(org.eclipse.swt.graphics.GC) Point(org.eclipse.swt.graphics.Point) TypedEvent(org.eclipse.swt.events.TypedEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) ColorDialog(org.eclipse.swt.widgets.ColorDialog) MenuEvent(org.eclipse.swt.events.MenuEvent) Composite(org.eclipse.swt.widgets.Composite) KeyEvent(org.eclipse.swt.events.KeyEvent) Widget(org.eclipse.swt.widgets.Widget) Method(java.lang.reflect.Method) KeyAdapter(org.eclipse.swt.events.KeyAdapter) SelectionListener.widgetDefaultSelectedAdapter(org.eclipse.swt.events.SelectionListener.widgetDefaultSelectedAdapter) TraverseEvent(org.eclipse.swt.events.TraverseEvent) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) ArmEvent(org.eclipse.swt.events.ArmEvent) Display(org.eclipse.swt.widgets.Display) MouseEvent(org.eclipse.swt.events.MouseEvent) Item(org.eclipse.swt.widgets.Item) MenuItem(org.eclipse.swt.widgets.MenuItem) SWT(org.eclipse.swt.SWT) Label(org.eclipse.swt.widgets.Label) SelectionListener(org.eclipse.swt.events.SelectionListener) TabFolder(org.eclipse.swt.widgets.TabFolder) Image(org.eclipse.swt.graphics.Image) Rectangle(org.eclipse.swt.graphics.Rectangle) Table(org.eclipse.swt.widgets.Table) Event(org.eclipse.swt.widgets.Event) ControlEvent(org.eclipse.swt.events.ControlEvent) SelectionListener.widgetSelectedAdapter(org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter) VerifyEvent(org.eclipse.swt.events.VerifyEvent) Listener(org.eclipse.swt.widgets.Listener) RGB(org.eclipse.swt.graphics.RGB) TreeEvent(org.eclipse.swt.events.TreeEvent) Font(org.eclipse.swt.graphics.Font) GridData(org.eclipse.swt.layout.GridData) TableItem(org.eclipse.swt.widgets.TableItem) Combo(org.eclipse.swt.widgets.Combo) Shell(org.eclipse.swt.widgets.Shell) ShellEvent(org.eclipse.swt.events.ShellEvent) HelpEvent(org.eclipse.swt.events.HelpEvent) FontDialog(org.eclipse.swt.widgets.FontDialog) Group(org.eclipse.swt.widgets.Group) Color(org.eclipse.swt.graphics.Color) FontData(org.eclipse.swt.graphics.FontData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) Control(org.eclipse.swt.widgets.Control) GridLayout(org.eclipse.swt.layout.GridLayout) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) ColorDialog(org.eclipse.swt.widgets.ColorDialog) Table(org.eclipse.swt.widgets.Table) FontDialog(org.eclipse.swt.widgets.FontDialog) Button(org.eclipse.swt.widgets.Button) TableItem(org.eclipse.swt.widgets.TableItem) GridData(org.eclipse.swt.layout.GridData) Image(org.eclipse.swt.graphics.Image)

Example 4 with FontDialog

use of org.eclipse.swt.widgets.FontDialog in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_widgets_FontDialog method setUp.

@Override
@Before
public void setUp() {
    super.setUp();
    fontDialog = new FontDialog(shell, SWT.NULL);
    setDialog(fontDialog);
}
Also used : FontDialog(org.eclipse.swt.widgets.FontDialog) Before(org.junit.Before)

Example 5 with FontDialog

use of org.eclipse.swt.widgets.FontDialog in project archi by archimatetool.

the class ColoursFontsPreferencePage method createFontsTab.

private void createFontsTab() {
    Composite client = new Composite(fTabfolder, SWT.NULL);
    client.setLayout(new GridLayout(2, false));
    TabItem item = new TabItem(fTabfolder, SWT.NONE);
    item.setText(Messages.ColoursFontsPreferencePage_24);
    item.setControl(client);
    fDefaultFontLabel = new Label(client, SWT.NULL);
    fDefaultFontLabel.setText(Messages.ColoursFontsPreferencePage_25);
    fDefaultFontButton = new Button(client, SWT.PUSH);
    fDefaultFontButton.setText(Messages.ColoursFontsPreferencePage_26);
    fDefaultFontButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FontDialog dialog = new FontDialog(getShell());
            dialog.setText(Messages.ColoursFontsPreferencePage_27);
            dialog.setFontList(new FontData[] { fDefaultFontData });
            FontData fd = dialog.open();
            if (fd != null) {
                fDefaultFontData = fd;
                setDefaultFontValues();
            }
        }
    });
    Group fontPreviewGroup = new Group(client, SWT.NULL);
    fontPreviewGroup.setText(Messages.ColoursFontsPreferencePage_28);
    fontPreviewGroup.setLayout(new GridLayout());
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    fontPreviewGroup.setLayoutData(gd);
    fFontPreviewLabel = new CLabel(fontPreviewGroup, SWT.NONE);
    fDefaultFontData = FontFactory.getDefaultUserViewFontData();
    setDefaultFontValues();
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) Group(org.eclipse.swt.widgets.Group) FontDialog(org.eclipse.swt.widgets.FontDialog) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) FontData(org.eclipse.swt.graphics.FontData) CLabel(org.eclipse.swt.custom.CLabel) Label(org.eclipse.swt.widgets.Label) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData)

Aggregations

FontDialog (org.eclipse.swt.widgets.FontDialog)18 FontData (org.eclipse.swt.graphics.FontData)15 GridData (org.eclipse.swt.layout.GridData)10 GridLayout (org.eclipse.swt.layout.GridLayout)10 Button (org.eclipse.swt.widgets.Button)10 Composite (org.eclipse.swt.widgets.Composite)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)8 RGB (org.eclipse.swt.graphics.RGB)8 Label (org.eclipse.swt.widgets.Label)8 Text (org.eclipse.swt.widgets.Text)8 ColorDialog (org.eclipse.swt.widgets.ColorDialog)7 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)6 Group (org.eclipse.swt.widgets.Group)5 SWT (org.eclipse.swt.SWT)4 SelectionListener (org.eclipse.swt.events.SelectionListener)4 Font (org.eclipse.swt.graphics.Font)4 FileDialog (org.eclipse.swt.widgets.FileDialog)4 Combo (org.eclipse.swt.widgets.Combo)3 OPIFont (org.csstudio.opibuilder.util.OPIFont)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2