PageRenderTime 46ms CodeModel.GetById 4ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre4/bsh/commands/setFont.bsh

#
Unknown | 25 lines | 18 code | 7 blank | 0 comment | 0 complexity | 4921b7f9007bbc2bad08aefac17c328b MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. bsh.help.setFont = "usage: setFont( Component comp, int size )";
  6. Font setFont(Component comp, String family, int style, int size) {
  7. this.font = comp.getFont();
  8. this.family = (family==null) ? font.family : family;
  9. this.style = (style==-1) ? font.style : style;
  10. this.size = (size==-1) ? font.size : size;
  11. font = new Font(family, style, size);
  12. comp.setFont(font);
  13. comp.validate();
  14. return font;
  15. }
  16. Font setFont(Component comp, int size) {
  17. return setFont(comp, null, -1, size);
  18. }