欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SWT(JFace) 體驗(yàn)之FontRegistry

 更新時間:2009年06月25日 09:20:39   作者:  
測試代碼如下:
復(fù)制代碼 代碼如下:

package swt_jface.demo;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class FontRegistryExample {
Display display = new Display();
Shell shell = new Shell(display);

FontRegistry fontRegistry;
public FontRegistryExample() {

init();
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
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;
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"));
}
public static void main(String[] args) {
new FontRegistryExample();
}
}

相關(guān)文章

  • 如何使用JavaMail發(fā)送郵件

    如何使用JavaMail發(fā)送郵件

    這篇文章主要教大家如何使用JavaMail發(fā)送郵件在web應(yīng)用中,實(shí)現(xiàn)用戶注冊成功之后,將用戶的注冊信息以Email的形式發(fā)送到用戶的注冊郵箱當(dāng)中,感興趣的小伙伴們可以參考一下
    2015-12-12
  • 關(guān)于國際化、OGNL表達(dá)式語言

    關(guān)于國際化、OGNL表達(dá)式語言

    本篇文章,小編為大家介紹關(guān)于國際化、OGNL表達(dá)式語言,有需要的朋友可以參考一下
    2013-04-04
  • Java程序結(jié)構(gòu)與常量變量難點(diǎn)解析

    Java程序結(jié)構(gòu)與常量變量難點(diǎn)解析

    JAVA的基本結(jié)構(gòu)就是順序結(jié)構(gòu),除非特別指明,否則就按照順序一句一句執(zhí)行順序結(jié)構(gòu)是最簡單的算法結(jié)構(gòu),語句與語句之間,框與框之間是按從上到下的順序進(jìn)行的,它是由若干個依次執(zhí)行的處理步驟組成的,它是任何一個算法都離不開的一種基本算法結(jié)構(gòu)
    2021-10-10
  • Spring原生Rpc六種的正確打開方式實(shí)現(xiàn)示例

    Spring原生Rpc六種的正確打開方式實(shí)現(xiàn)示例

    這篇文章主要為大家展示了Spring原生Rpc六種的正確打開方式實(shí)現(xiàn)示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助祝大家多多進(jìn)步早日升職加薪
    2022-02-02
  • 詳解Java springboot 整合Shiro框架

    詳解Java springboot 整合Shiro框架

    這篇文章主要為大家介紹了Java springboot 整合Shiro框架,具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助
    2022-01-01
  • MyBatis-Plus動態(tài)返回實(shí)體類示例詳解

    MyBatis-Plus動態(tài)返回實(shí)體類示例詳解

    這篇文章主要為大家介紹了MyBatis-Plus動態(tài)返回實(shí)體類示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-07-07
  • java郵件亂碼的徹底解決方案

    java郵件亂碼的徹底解決方案

    在本篇文章里小編給大家整理的是關(guān)于java郵件亂碼的徹底解決方案,需要的朋友們可以學(xué)習(xí)下。
    2019-12-12
  • Mybatis-plus批量插入的2種方式總結(jié)

    Mybatis-plus批量插入的2種方式總結(jié)

    這篇文章主要給大家總結(jié)介紹了關(guān)于Mybatis-plus批量插入的2種方式,Mybatis-Plus提供了多種方式進(jìn)行批量插入優(yōu)化,文中通過代碼示例將實(shí)現(xiàn)的方法介紹的非常詳細(xì),需要的朋友可以參考下
    2023-08-08
  • 使用Swagger2實(shí)現(xiàn)自動生成RESTful?API文檔

    使用Swagger2實(shí)現(xiàn)自動生成RESTful?API文檔

    在開發(fā)?RESTful?API?的過程中,文檔是非常重要的一部分,可以幫助開發(fā)者了解?API?的功能和使用方法,本文將使用Swagger2?實(shí)現(xiàn)自動生成?RESTful?API?文檔,需要的可以參考一下
    2023-06-06
  • 通過Java實(shí)現(xiàn)對PDF頁面的詳細(xì)設(shè)置

    通過Java實(shí)現(xiàn)對PDF頁面的詳細(xì)設(shè)置

    這篇文章主要介紹了通過Java實(shí)現(xiàn)對PDF頁面的詳細(xì)設(shè)置,下面的示例將介紹通過Java編程來對PDF頁面進(jìn)行個性化設(shè)置的方法,包括設(shè)置頁面大小、頁邊距、紙張方向、頁面旋轉(zhuǎn)等,需要的朋友可以參考下
    2019-07-07

最新評論