List of usage examples for org.eclipse.swt.widgets Button setFont
public void setFont(Font font)
From source file:FontRegistry.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new GridLayout(1, false)); FontRegistry fontRegistry = new FontRegistry(display); fontRegistry.put("button-text", new FontData[] { new FontData("Arial", 9, SWT.BOLD) }); fontRegistry.put("code", new FontData[] { new FontData("Courier New", 10, SWT.NORMAL) }); Text text = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.WRAP); text.setFont(fontRegistry.get("code")); text.setForeground(display.getSystemColor(SWT.COLOR_BLUE)); text.setText(""); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2;/* w ww. jav a 2 s. com*/ text.setLayoutData(gd); Button executeButton = new Button(shell, SWT.PUSH); executeButton.setText("Execute"); executeButton.setFont(fontRegistry.get("button-text")); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:FontRegistryExample.java
private void init() { shell.setLayout(new GridLayout(2, false)); fontRegistry = new FontRegistry(display); fontRegistry.put("button-text", new FontData[] { new FontData("Arial", 9, SWT.BOLD) }); fontRegistry.put("code", new FontData[] { new FontData("Courier New", 10, SWT.NORMAL) }); Text text = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.WRAP); text.setFont(fontRegistry.get("code")); text.setForeground(display.getSystemColor(SWT.COLOR_BLUE)); text.setText("public static void main() {\n\tSystem.out.println(\"Hello\"); \n}"); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2;//from ww w . j av a 2 s. c o m text.setLayoutData(gd); Button executeButton = new Button(shell, SWT.PUSH); executeButton.setText("Execute"); executeButton.setFont(fontRegistry.get("button-text")); Button cancelButton = new Button(shell, SWT.PUSH); cancelButton.setText("Cancel"); cancelButton.setFont(fontRegistry.get("button-text")); }
From source file:org.pentaho.di.ui.spoon.trans.TransPerfDelegate.java
/** * Tell the user that the transformation is not running or that there is no monitoring configured. *///w w w . j ava 2 s .co m private void showEmptyGraph() { if (perfComposite.isDisposed()) { return; } emptyGraph = true; Label label = new Label(perfComposite, SWT.CENTER); label.setText(BaseMessages.getString(PKG, "TransLog.Dialog.PerformanceMonitoringNotEnabled.Message")); label.setBackground(perfComposite.getBackground()); label.setFont(GUIResource.getInstance().getFontMedium()); FormData fdLabel = new FormData(); fdLabel.left = new FormAttachment(5, 0); fdLabel.right = new FormAttachment(95, 0); fdLabel.top = new FormAttachment(5, 0); label.setLayoutData(fdLabel); Button button = new Button(perfComposite, SWT.CENTER); button.setText(BaseMessages.getString(PKG, "TransLog.Dialog.PerformanceMonitoring.Button")); button.setBackground(perfComposite.getBackground()); button.setFont(GUIResource.getInstance().getFontMedium()); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { TransGraph.editProperties(spoon.getActiveTransformation(), spoon, spoon.rep, true, TransDialog.Tabs.MONITOR_TAB); } }); FormData fdButton = new FormData(); fdButton.left = new FormAttachment(40, 0); fdButton.right = new FormAttachment(60, 0); fdButton.top = new FormAttachment(label, 5); button.setLayoutData(fdButton); perfComposite.layout(true, true); }