001/******************************************************************************* 002 * This software is provided as a supplement to the authors' textbooks on digital 003 * image processing published by Springer-Verlag in various languages and editions. 004 * Permission to use and distribute this software is granted under the BSD 2-Clause 005 * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). 006 * Copyright (c) 2006-2023 Wilhelm Burger, Mark J. Burge. All rights reserved. 007 * Visit https://imagingbook.com for additional details. 008 ******************************************************************************/ 009package Tools_; 010 011import ij.IJ; 012import ij.WindowManager; 013import ij.plugin.PlugIn; 014import ij.text.TextWindow; 015 016import java.awt.Font; 017import java.awt.Window; 018 019/** 020 * Sets the font of the IJ.log window to MONOSPACE. 021 * @author WB 022 */ 023public class Set_Log_Font_Monospace implements PlugIn { 024 private static String FontType = Font.MONOSPACED; 025 private static int FontStyle = Font.PLAIN; 026 private static int FontSize = 16; 027 private static boolean Antialiased = true; 028 029 @Override 030 public void run(String arg0) { 031 Window win = WindowManager.getWindow("Log"); 032 if (win == null) { 033 IJ.log(""); // set up the log window if not available yet 034 } 035 win = WindowManager.getWindow("Log"); 036 TextWindow tw = (TextWindow) win; 037 tw.getTextPanel().setFont(new Font(FontType, FontStyle, FontSize), Antialiased); 038 // IJ.log("This should now be monospaced!"); 039 } 040}