@Test public void testSetFontBold() { UtilsTest.LOGGER.info("testSetFontBold"); try { GeneralConfig.loadConfig(GeneralConfig.getConfig()); final Properties config = GeneralConfig.getConfig(); final JComboBox jComboBox = new JComboBox(); final JPanel jPanel = new JPanel(); jPanel.setBorder(BorderFactory.createTitledBorder("Test")); final JToolBar jToolBar = new JToolBar(); final JButton jButton = new JButton("Test"); jToolBar.add(jButton); config.setProperty(AccessibilityOptionsPane.MAIN_FONT_STYLE, "true"); GeneralConfig.loadConfig(config); Assert.assertTrue(this.fontBoldJComboBox(jComboBox)); Assert.assertTrue(this.fontBoldJPanel(jPanel)); Assert.assertTrue(this.fontBoldJToolBar(jToolBar)); config.setProperty(AccessibilityOptionsPane.MAIN_FONT_STYLE, "false"); GeneralConfig.loadConfig(config); Assert.assertTrue(this.fontBoldJComboBox(jComboBox)); Assert.assertTrue(this.fontBoldJPanel(jPanel)); Assert.assertTrue(this.fontBoldJToolBar(jToolBar)); } catch (final java.awt.HeadlessException e) { } }
public static void setFontBold(final JComponent component){ if(component instanceof JPanel){ if (component.getBorder()!=null && component.getBorder().getClass().getName().equals("javax.swing.border.TitledBorder")) { final TitledBorder titledBorder = (TitledBorder)component.getBorder(); if (titledBorder != null){ if (GeneralConfig.isFontBold()){ titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } else { titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } else { if (GeneralConfig.isFontBold()){ if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } }
Utils { public static void setFontBold(final JComponent component){ if(component instanceof JPanel){ if (component.getBorder()!=null && component.getBorder().getClass().getName().equals("javax.swing.border.TitledBorder")) { final TitledBorder titledBorder = (TitledBorder)component.getBorder(); if (titledBorder != null){ if (GeneralConfig.isFontBold()){ titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } else { titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } else { if (GeneralConfig.isFontBold()){ if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } }
Utils { public static void setFontBold(final JComponent component){ if(component instanceof JPanel){ if (component.getBorder()!=null && component.getBorder().getClass().getName().equals("javax.swing.border.TitledBorder")) { final TitledBorder titledBorder = (TitledBorder)component.getBorder(); if (titledBorder != null){ if (GeneralConfig.isFontBold()){ titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } else { titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } else { if (GeneralConfig.isFontBold()){ if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } private  Utils(); }
Utils { public static void setFontBold(final JComponent component){ if(component instanceof JPanel){ if (component.getBorder()!=null && component.getBorder().getClass().getName().equals("javax.swing.border.TitledBorder")) { final TitledBorder titledBorder = (TitledBorder)component.getBorder(); if (titledBorder != null){ if (GeneralConfig.isFontBold()){ titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } else { titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } else { if (GeneralConfig.isFontBold()){ if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } private  Utils(); static void openFile(final String filepath); static void openFile(final File file); static char getLanguageMnemonic(final List<Character> mnemonicList, final String actualLanguage); static void remarcar(final JComponent component); static void setContrastColor(final JComponent component); static void setFontBold(final JComponent component); static String remarkMnemonic( final String text, final int key); static FileFilter getRepositoryFileFilterPkcs12(); static FileFilter getRepositoryFileFilterPkcs11(); static void showToolTip(final boolean show, final JWindow tip, final JButton boton, final JLabel tipText); }
Utils { public static void setFontBold(final JComponent component){ if(component instanceof JPanel){ if (component.getBorder()!=null && component.getBorder().getClass().getName().equals("javax.swing.border.TitledBorder")) { final TitledBorder titledBorder = (TitledBorder)component.getBorder(); if (titledBorder != null){ if (GeneralConfig.isFontBold()){ titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } else { titledBorder.setTitleFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } else { if (GeneralConfig.isFontBold()){ if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.BOLD , component.getFont().getSize())); } } else { if (component instanceof JToolBar){ for (int i=0;i<component.getComponentCount();i++){ component.getComponent(i).setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } else { component.setFont(new Font(component.getFont().getName(),Font.PLAIN , component.getFont().getSize())); } } } } private  Utils(); static void openFile(final String filepath); static void openFile(final File file); static char getLanguageMnemonic(final List<Character> mnemonicList, final String actualLanguage); static void remarcar(final JComponent component); static void setContrastColor(final JComponent component); static void setFontBold(final JComponent component); static String remarkMnemonic( final String text, final int key); static FileFilter getRepositoryFileFilterPkcs12(); static FileFilter getRepositoryFileFilterPkcs11(); static void showToolTip(final boolean show, final JWindow tip, final JButton boton, final JLabel tipText);  }