PageRenderTime 241ms CodeModel.GetById 239ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/org/gjt/sp/jedit/bsh/commands/setFont.bsh

#
Unknown | 25 lines | 18 code | 7 blank | 0 comment | 0 complexity | 4921b7f9007bbc2bad08aefac17c328b MD5 | raw file
 1/**
 2	Change the point size of the font on the specified component, to ptsize.
 3	This is just a convenience for playing with GUI components.
 4*/
 5
 6bsh.help.setFont = "usage: setFont( Component comp, int size )";
 7
 8Font setFont(Component comp, String family, int style, int size) {
 9		
10    this.font = comp.getFont();
11	
12    this.family = (family==null) ? font.family : family;
13    this.style = (style==-1) ? font.style : style;
14	this.size = (size==-1) ? font.size : size;
15	
16    font = new Font(family, style, size);
17    comp.setFont(font);
18	comp.validate();
19    return font;	
20}
21
22Font setFont(Component comp, int size) {
23	return setFont(comp, null, -1, size);
24}
25