1 19 20 package edu.umd.cs.findbugs.gui2; 21 22 import java.awt.Component ; 23 import java.awt.Container ; 24 import java.awt.Dialog ; 25 import java.awt.Frame ; 26 import java.io.IOException ; 27 28 import javax.imageio.ImageIO ; 29 import javax.swing.JDialog ; 30 import javax.swing.JFrame ; 31 32 37 @SuppressWarnings ("serial") 38 public class FBDialog extends JDialog { 39 40 public FBDialog(){ 41 super(MainFrame.getInstance()); 42 } 43 44 public FBDialog(Frame f){ 45 super(f); 46 } 47 48 public FBDialog(Dialog d){ 49 super(d); 50 } 51 52 56 protected void setFontSize(float size){ 57 setFont(this.getFont().deriveFont(size)); 58 59 setFontSizeHelper(this.getComponents(), size); 60 } 61 62 65 protected void setFontSizeHelper(Component [] comps, float size){ 66 if(comps.length <= 0) 67 return; 68 69 for(Component comp : comps){ 70 comp.setFont(comp.getFont().deriveFont(size)); 71 if(comp instanceof Container ) 72 setFontSizeHelper(((Container )comp).getComponents(), size); 73 } 74 } 75 76 public void addNotify(){ 77 super.addNotify(); 78 79 setFontSize(Driver.getFontSize()); 80 } 81 82 } | Popular Tags |