+ /**
+ * Changes the size of the font of the specified component by the given amount.
+ *
+ * @param component the component for which to change the font
+ * @param size the change in the font size
+ */
+ public static void changeFontSize(JComponent component, float size) {
+ Font font = component.getFont();
+ font = font.deriveFont(font.getSize2D() + size);
+ component.setFont(font);
+ }
+
+
+ /**
+ * Changes the style of the font of the specified border.
+ *
+ * @param border the component for which to change the font
+ * @param style the change in the font style
+ */
+ public static void changeFontStyle(TitledBorder border, int style) {
+ /*
+ * There's been an NPE caused by the font changing, this is debug for it.
+ */
+ if (border == null) {
+ throw new BugException("border is null");
+ }
+ Font font = border.getTitleFont();
+ if (font == null) {
+ throw new BugException("Border font is null");
+ }
+ font = font.deriveFont(style);
+ if (font == null) {
+ throw new BugException("Derived font is null");
+ }
+ border.setTitleFont(font);
+ }
+
+
+