本文整理了Java中org.eclipse.swt.widgets.Button.setFont()
方法的一些代码示例,展示了Button.setFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setFont()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Button
类名称:Button
方法名:setFont
暂无
代码示例来源:origin: pentaho/pentaho-kettle
button.setText( BaseMessages.getString( PKG, "TransLog.Dialog.PerformanceMonitoring.Button" ) );
button.setBackground( perfComposite.getBackground() );
button.setFont( GUIResource.getInstance().getFontMedium() );
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
private Button createButton(Composite parent, int span, int indent, String text) {
Button button = new Button(parent, SWT.CHECK);
button.setText(text);
GridData gd = new GridData();
gd.horizontalSpan = span;
gd.horizontalIndent = indent;
button.setLayoutData(gd);
button.addSelectionListener(fListener);
button.setFont(parent.getFont());
return button;
}
代码示例来源:origin: org.eclipse/org.eclipse.team.ui
protected Button createCheckbox(Composite parent, String label, int span) {
Button button = new Button(parent, SWT.CHECK | SWT.LEFT);
button.setText(label);
button.setFont(parent.getFont());
GridData data = new GridData();
data.horizontalSpan = span;
button.setLayoutData(data);
return button;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui
protected Button createCheckbox(Composite parent, String label, int span) {
Button button = new Button(parent, SWT.CHECK | SWT.LEFT);
button.setText(label);
button.setFont(parent.getFont());
GridData data = new GridData();
data.horizontalSpan = span;
button.setLayoutData(data);
return button;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private Button createSelectionButton(int index, Composite group, SelectionListener listener) {
Button button= new Button(group, fButtonsStyle | SWT.LEFT);
button.setFont(group.getFont());
button.setText(fButtonNames[index]);
button.setEnabled(isEnabled() && fButtonsEnabled[index]);
button.setSelection(fButtonsSelected[index]);
button.addSelectionListener(listener);
button.setLayoutData(new GridData());
return button;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private static Button createButton(Composite composite, String text, final int style) {
final Button button= new Button(composite, SWT.PUSH);
button.setFont(composite.getFont());
button.setText(text);
final GridData gd= new GridData(style);
gd.widthHint= SWTUtil.getButtonWidthHint(button);
button.setLayoutData(gd);
return button;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
protected Button createButton(Composite parent, String label, SelectionListener listener) {
Button button= new Button(parent, SWT.PUSH);
button.setFont(parent.getFont());
button.setText(label);
button.addSelectionListener(listener);
GridData gd= new GridData();
gd.horizontalAlignment= GridData.FILL;
gd.grabExcessHorizontalSpace= true;
gd.verticalAlignment= GridData.BEGINNING;
gd.widthHint = SWTUtil.getButtonWidthHint(button);
button.setLayoutData(gd);
return button;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
protected Button createButton(Composite parent, String label, SelectionListener listener) {
Button button= new Button(parent, SWT.PUSH);
button.setFont(parent.getFont());
button.setText(label);
button.addSelectionListener(listener);
GridData gd= new GridData();
gd.horizontalAlignment= GridData.FILL;
gd.grabExcessHorizontalSpace= true;
gd.verticalAlignment= GridData.BEGINNING;
gd.widthHint= SWTUtil.getButtonWidthHint(button);
button.setLayoutData(gd);
return button;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private static Button createButton(Composite composite, String text, final int style) {
final Button button= new Button(composite, SWT.PUSH);
button.setFont(composite.getFont());
button.setText(text);
final GridData gd= new GridData(style);
gd.widthHint= SWTUtil.getButtonWidthHint(button);
button.setLayoutData(gd);
return button;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui
protected Button createButton(Composite parent, String label, int style) {
Button button = new Button(parent, SWT.PUSH);
button.setText(label);
// we need to explicitly set the font to the parent's font for dialogs
button.setFont(parent.getFont());
GridData data = new GridData(style);
data.heightHint = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_HEIGHT);
int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
button.setLayoutData(data);
return button;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.ide.application
protected void createRefreshWorkspaceOnStartupPref(Composite composite) {
refreshButton = new Button(composite, SWT.CHECK);
refreshButton.setText(IDEWorkbenchMessages.StartupPreferencePage_refreshButton);
refreshButton.setFont(composite.getFont());
refreshButton.setSelection(getIDEPreferenceStore().getBoolean(
IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.ide.application
protected void createExitPromptPref(Composite composite) {
exitPromptButton = new Button(composite, SWT.CHECK);
exitPromptButton.setText(IDEWorkbenchMessages.StartupPreferencePage_exitPromptButton);
exitPromptButton.setFont(composite.getFont());
exitPromptButton.setSelection(getIDEPreferenceStore().getBoolean(
IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW));
}
代码示例来源:origin: openaudible/openaudible
public Button newButton(Composite parent, String title, int style) {
Button button = new Button(parent, style);
button.setText(Translate.getInstance().buttonName(title));
button.setFont(fonts.dialogFont());
/* Apply layoutdata to button */
setButtonLayoutData(button);
if (selectionListener != null)
button.addSelectionListener(selectionListener);
return button;
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
/**
* Returns a width hint for a button control.
*/
public static int getButtonWidthHint(Button button) {
button.setFont(JFaceResources.getDialogFont());
PixelConverter converter = new PixelConverter(button);
int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor
/**
* Returns a width hint for the given button.
*
* @param button the button
* @return the width hint for the button
*/
public static int getButtonWidthHint(Button button) {
button.setFont(JFaceResources.getDialogFont());
PixelConverter converter= new PixelConverter(button);
int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.workbench.texteditor
/**
* Returns a width hint for the given button.
*
* @param button the button
* @return the width hint for the button
*/
public static int getButtonWidthHint(Button button) {
button.setFont(JFaceResources.getDialogFont());
PixelConverter converter= new PixelConverter(button);
int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
代码示例来源:origin: org.eclipse/org.eclipse.ui.workbench.texteditor
/**
* Returns a width hint for the given button.
*
* @param button the button
* @return the width hint for the button
*/
public static int getButtonWidthHint(Button button) {
button.setFont(JFaceResources.getDialogFont());
PixelConverter converter= new PixelConverter(button);
int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Returns a width hint for a button control.
* @param button the button
* @return the width hint
*/
public static int getButtonWidthHint(Button button) {
button.setFont(JFaceResources.getDialogFont());
PixelConverter converter= new PixelConverter(button);
int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Returns a width hint for a button control.
*/
public static int getButtonWidthHint(Button button) {
button.setFont(JFaceResources.getDialogFont());
PixelConverter converter= new PixelConverter(button);
int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private static int getButtonWidthHint(Button button) {
button.setFont(JFaceResources.getDialogFont());
GC gc = new GC(button);
gc.setFont(button.getFont());
FontMetrics fontMetrics= gc.getFontMetrics();
gc.dispose();
int widthHint= Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
}
内容来源于网络,如有侵权,请联系作者删除!