Re: imageJ front panel fonts size
Posted by Gabriel Landini on Oct 31, 2007; 2:28pm
URL: http://imagej.273.s1.nabble.com/imageJ-front-panel-fonts-size-tp3697649p3697650.html
> I have hight screen resolution (1920x1200) and ImageJ-fonts results very
> small.
> Exist any possibilities to make them bigger? (maybe in some way changing
> the script)
We discussed this some time ago. I also have that screen size and it is almost
unreadable...
I use the plugin below, run from the startupmacros.txt file.
I cannot remember who wrote it... (Dscho? Wayne? Albert? if somebody knows,
please let me know).
Mind the line breaks:
//----------------------
import ij.IJ;
import ij.ImageJ;
import ij.Menus;
import ij.gui.GenericDialog;
import ij.plugin.PlugIn;
import java.awt.Font;
import java.awt.Menu;
import java.awt.MenuBar;
public class Menu_Font implements ij.plugin.PlugIn {
public void run(String arg) {
GenericDialog gd = new GenericDialog("New Menu Font Size");
gd.addNumericField("menuFontSize", 16, 0);
gd.addCheckbox("Bold", true);
gd.showDialog();
if (gd.wasCanceled())
return;
int size = (int)gd.getNextNumber();
String bold="";
if (gd.getNextBoolean())
bold="bold-";
MenuBar menuBar = Menus.getMenuBar();
Font font = menuBar.getFont();
int oldSize = font.getSize();
// this does not work, because default is "fixed"
//menuBar.setFont(font.deriveFont(size));
menuBar.setFont(Font.decode("sansserif-"+bold + size));
// work around AWT not recalculating the menu bar size
int i, count = menuBar.getMenuCount();
Menu[] menus = new Menu[count];
for (i = 0; i < count; i++) {
menus[i] = menuBar.getMenu(0);
menuBar.remove(menus[i]);
}
for (i = 0; i < count; i++)
menuBar.add(menus[i]);
ImageJ ij = IJ.getInstance();
ij.pack();
ij.setSize(new java.awt.Dimension(ij.getWidth() *size /
oldSize, ij.getHeight()));
}
}
//----------------------