java控制臺輸出字體大小設(shè)置方法:\x0d\x0a1.打開Eclipse或者M(jìn)yeclipse,選擇windows(系統(tǒng))選項(xiàng);\x0d\x0a2.點(diǎn)擊preferences(首選項(xiàng));\x0d\x0a3.彈出首選項(xiàng)的窗口,點(diǎn)擊Appearance(外觀);\x0d\x0a4.點(diǎn)擊color and font (顏色和字體);\x0d\x0a5.點(diǎn)擊Debug展開,點(diǎn)擊console font(控制臺字體);\x0d\x0a6.再點(diǎn)擊Edit進(jìn)行編輯,進(jìn)入設(shè)置大小,然后點(diǎn)擊確定即可。
西峰網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)公司等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營維護(hù)。創(chuàng)新互聯(lián)自2013年起到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)。
1、對字體的操作
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setFontFamily(attr, family);
setCharacterAttributes(editor, attr, false);
family為字體
2、對字體大小的操作
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setFontSize(attr, size);
setCharacterAttributes(editor, attr, false);
size為字號
3、是否是粗體的操作
StyledEditorKit kit = getStyledEditorKit(editor);
MutableAttributeSet attr = kit.getInputAttributes();
boolean bold = (StyleConstants.isBold(attr)) ? false : true;
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setBold(sas, bold);
setCharacterAttributes(editor, sas, false);
4、是否是斜體的操作
StyledEditorKit kit = getStyledEditorKit(editor);
MutableAttributeSet attr = kit.getInputAttributes();
boolean italic = (StyleConstants.isItalic(attr)) ? false : true;
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setItalic(sas, italic);
setCharacterAttributes(editor, sas, false);
5、是否有下劃線的操作
StyledEditorKit kit = getStyledEditorKit(editor);
MutableAttributeSet attr = kit.getInputAttributes();
boolean underline = (StyleConstants.isUnderline(attr)) ? false
: true;
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setUnderline(sas, underline);
setCharacterAttributes(editor, sas, false);
6、左中右對齊的處理
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setAlignment(attr, a);
setParagraphAttributes(editor, attr, false);
public static final void setParagraphAttributes(JEditorPane editor,
AttributeSet attr, boolean replace) {
int p0 = editor.getSelectionStart();
int p1 = editor.getSelectionEnd();
StyledDocument doc = getStyledDocument(editor);
doc.setParagraphAttributes(p0, p1 - p0, attr, replace);
}
a:0:左,1:中,2:右
7、文本字體顏色的設(shè)置
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setForeground(attr, fg);
setCharacterAttributes(editor, attr, false);
fg:為color
8、文本背景顏色的設(shè)置
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setBackground(attr, bg);
setCharacterAttributes(editor, attr, false);
1、打開Myeclipse的相關(guān)界面,在Window那里點(diǎn)擊Preferences。
2、彈出設(shè)置的對話框,選擇General下的Appearance進(jìn)入。
3、點(diǎn)擊Colors and Fonts按鈕,需要在右側(cè)選擇Java。
4、選擇Java Editor Text Font,并點(diǎn)擊Edit。
5、通過設(shè)置對應(yīng)的參數(shù)以后,直接確定返回。
6、這樣一來會看到圖示的結(jié)果,即可設(shè)置JLabel的字體樣式,大小,顏色了。
Java
Swing中可以給每個控件設(shè)置字體格式和其他屬性的設(shè)置,示例如下:
submit=
new
JButton("登陸");
submit.setFont(new
Font("宋體",
Font.PLAIN,
16));
三個參數(shù)分別表示:
字體,樣式(粗體,斜體等),字號
submit.setForeground(Color.RED);
這個表示給組件上的文字設(shè)置顏色Color.RED表示紅色
當(dāng)然你也可以自己給RGB的值
比如
submit.setForeground(new
Color(215,215,200));
Java Swing中可以給每個控件設(shè)置字體格式和其他屬性的設(shè)置,示例如下:
submit= new JButton("登陸");
submit.setFont(new Font("宋體", Font.PLAIN, 16));
三個參數(shù)分別表示: 字體,樣式(粗體,斜體等),字號
submit.setForeground(Color.RED);
這個表示給組件上的文字設(shè)置顏色Color.RED表示紅色
當(dāng)然你也可以自己給RGB的值 比如 submit.setForeground(new Color(215,215,200));
文章題目:設(shè)置java代碼字體,java默認(rèn)字體
URL地址:http://www.chinadenli.net/article44/dseoehe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計公司、服務(wù)器托管、云服務(wù)器、靜態(tài)網(wǎng)站、App開發(fā)、App設(shè)計
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)