欧美成人午夜免费全部完,亚洲午夜福利精品久久,а√最新版在线天堂,另类亚洲综合区图片小说区,亚洲欧美日韩精品色xxx

扣丁學堂Java在線教程之SWT(JFace) 體驗之FontRegistry

2018-06-05 14:06:38 1245瀏覽

本篇文章扣丁學堂Java培訓小編主要和大家分享一下SWT(JFace) 體驗之FontRegistry,喜歡Java開發(fā)的小伙伴可以隨著小編一起來了解下。


扣丁學堂Java在線教程之SWT(JFace) 體驗之FontRegistry


測試代碼如下:



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(); 
} 
}




以上就是扣丁學堂Java在線教程小編給大家分享的SWT(JFace) 體驗之FontRegistry,希望對小伙伴們有所幫助,想要了解更多內(nèi)容的小伙伴可以登錄扣丁學堂官網(wǎng)咨詢??鄱W堂是專業(yè)的Java培訓機構(gòu),不僅有專業(yè)的老師和與時俱進的課程體系,還有大量的Java在線教程供學員觀看學習,想要學習Java的小伙伴快快行動吧??鄱W堂Java技術(shù)交流群:670348138。


扣丁學堂微信公眾號

【關(guān)注微信公眾號獲取更多學習資料】



查看更多關(guān)于“Java開發(fā)資訊的相關(guān)文章>>



標簽: 扣丁學堂Java在線教程 SWT(JFace) 體驗之FontRegistry Java培訓 Java基礎教程 Java學習視頻 Java教學視頻 java入門教程 Java教程視頻 java在線學習 java在線視頻 java在線教程

熱門專區(qū)

暫無熱門資訊

課程推薦

微信
微博
15311698296

全國免費咨詢熱線

郵箱:codingke@1000phone.com

官方群:148715490

北京千鋒互聯(lián)科技有限公司版權(quán)所有   北京市海淀區(qū)寶盛北里西區(qū)28號中關(guān)村智誠科創(chuàng)大廈4層
京ICP備2021002079號-2   Copyright ? 2017 - 2022
返回頂部 返回頂部