public Font GetFont(String opt1, String opt2, Font previous) { Font newfont = previous; int actual = -1; int pstyle = previous.getStyle(); int psize = previous.getHeight(); FontFamily fontFamily[] = FontFamily.getFontFamilies(); for (int x = 0; x < fontFamily.length; x++) { if (fontFamily[x].getName().equalsIgnoreCase(opt1)) { actual = x; break; } } if (actual == -1) { for (int x = 0; x < fontFamily.length; x++) { if (fontFamily[x].getName().equalsIgnoreCase(opt2)) { actual = x; break; } } } if (actual == -1) { newfont = Font.getDefault().derive(pstyle, psize); } else { newfont = fontFamily[actual].getFont(pstyle, psize); } return newfont; }