All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bsh.commands.setFont.bsh Maven / Gradle / Ivy

Go to download

BeanShell is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. BeanShell dynamically executes standard Java syntax and extends it with common scripting conveniences such as loose types, commands, and method closures like those in Perl and JavaScript.

The newest version!
/**
	Change the point size of the font on the specified component, to ptsize.
	This is just a convenience for playing with GUI components.
*/

bsh.help.setFont = "usage: setFont( Component comp, int size )";

Font setFont(Component comp, String family, int style, int size) {
		
    this.font = comp.getFont();
	
    this.family = (family==null) ? font.family : family;
    this.style = (style==-1) ? font.style : style;
	this.size = (size==-1) ? font.size : size;
	
    font = new Font(family, style, size);
    comp.setFont(font);
	comp.validate();
    return font;	
}

Font setFont(Component comp, int size) {
	return setFont(comp, null, -1, size);
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy