Browse Source

Code tidy for font increase/decrease feature in GUI.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@487 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 18 years ago
parent
commit
e8b96bbe1b
  1. 36
      prism/src/userinterface/GUIPrism.java

36
prism/src/userinterface/GUIPrism.java

@ -72,22 +72,6 @@ public class GUIPrism extends JFrame
private boolean doExit; private boolean doExit;
public void adjustFont( int adjust )
{
Object[] objs = UIManager.getLookAndFeel().getDefaults().keySet().toArray();
for( int i = 0; i < objs.length; i++ )
{
if( objs[i].toString().toUpperCase().indexOf( ".FONT" ) != -1 )
{
Font font = UIManager.getFont( objs[i] );
font = font.deriveFont( (float)(font.getSize() + adjust ));
UIManager.put( objs[i], new FontUIResource(font) );
}
}
SwingUtilities.updateComponentTreeUI(this);
repaint();
}
//STATIC METHODS //STATIC METHODS
/** The entry point of the program from the command line. /** The entry point of the program from the command line.
@ -378,6 +362,26 @@ public class GUIPrism extends JFrame
} }
} }
/**
* Adjust the main font for the GUI (+1 = one size up, -1 = one size down)
*/
public void adjustFont(int adjust)
{
Object[] objs = UIManager.getLookAndFeel().getDefaults().keySet().toArray();
for (int i = 0; i < objs.length; i++)
{
if (objs[i].toString().toUpperCase().indexOf(".FONT") != -1)
{
Font font = UIManager.getFont(objs[i]);
font = font.deriveFont((float)(font.getSize() + adjust));
UIManager.put(objs[i], new FontUIResource(font));
}
}
SwingUtilities.updateComponentTreeUI(this);
repaint();
}
//EXITERS //EXITERS
public void exit() public void exit()
{ {

Loading…
Cancel
Save