Package javax.swing.UIManager

Examples of javax.swing.UIManager.LookAndFeelInfo


    }   
   
    private void fillSystemLFCombo() {
        LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();
        for (int i = 0; i < lafs.length; i++) {
            LookAndFeelInfo laf = lafs[i];
            if (laf.getName().toLowerCase().indexOf("nimbus") == -1)
                comboSystemLF.addItem(new DcLookAndFeel(laf.getName(), laf.getClassName(), null, DcLookAndFeel._LAF));
        }
    }
View Full Code Here


    public void setSelectedItem(final Object anObject)
    {
      // based on classname (or if that fails, try based on LNF name)
      for (int i = 0; anObject != null && i < lnfs.length; i++)
      {
        final LookAndFeelInfo lnf = lnfs[i];
        if (lnf.getClassName().equalsIgnoreCase(anObject.toString()))
        {
          selectedIndex = i;
          return;
        }
      }
      for (int i = 0; anObject != null && i < lnfs.length; i++)
      {
        final LookAndFeelInfo lnf = lnfs[i];
        if (lnf.getName().equalsIgnoreCase(anObject.toString()))
        {
          selectedIndex = i;
          return;
        }
      }
View Full Code Here

//        System.setProperty("Quaqua.tabLayoutPolicy", "wrap");
        try {
            LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
            menusLnF = new JCheckBoxMenuItem[installedLookAndFeels.length];
            for (int i = 0; i < installedLookAndFeels.length; i++) {
                LookAndFeelInfo info = installedLookAndFeels[i];
                final JCheckBoxMenuItem jCheckBoxMenuItem = new JCheckBoxMenuItem(info.getName());
                jCheckBoxMenuItem.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent e) {
                        if (e.getStateChange() == ItemEvent.SELECTED) {
                            try {
                                LookAndFeelInfo findLookAndFeel = findLookAndFeel(jCheckBoxMenuItem.getText());
                                if (UIManager.getLookAndFeel().getName().contains(jCheckBoxMenuItem.getText())
                                        || UIManager.getLookAndFeel().getID().contains(jCheckBoxMenuItem.getText())
                                        || UIManager.getLookAndFeel().getClass().getName().equals(findLookAndFeel.getClassName())) {
                                    return;
                                }
                                setLookAndFeel(findLookAndFeel);
                                for (JCheckBoxMenuItem menuItem : menusLnF) {
                                    if (menuItem != jCheckBoxMenuItem && menuItem.isSelected()) {
                                        menuItem.setSelected(false);
                                    }
                                }
                                updateTelasLookAndFeel();
                            } catch (Exception ex) {
                                Logger.getLogger(Carregador.class.getName()).log(Level.SEVERE, null, ex);
                            }
                        }
                    }
                });
                menusLnF[i] = jCheckBoxMenuItem;
            }

            String lnfSalvo = Configuracoes.LOOK_AND_FEEL.getValor();
            //            UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");

            boolean achou = false;
            if (lnfSalvo != null && !lnfSalvo.isEmpty()) {
                LookAndFeelInfo findLookAndFeel = findLookAndFeel(lnfSalvo);
                if (findLookAndFeel != null) {
                    achou = true;
                    setLookAndFeel(findLookAndFeel);

                } else {
                    achou = false;
                }
            }
            if (!achou) {

                String[] lnfPreferido = {"nimbus", "gtk+"};
                for (String nome : lnfPreferido) {
                    LookAndFeelInfo lookAndFeelInfo = findLookAndFeel(nome);
                    if (lookAndFeelInfo != null) {
                        setLookAndFeel(lookAndFeelInfo);
//                    UIDefaults defaults = UIManager.getLookAndFeel().getDefaults();
//                   
//                    for (Map.Entry<Object, Object> entry : defaults.entrySet()) {
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    LookAndFeelInfo lafi = new LookAndFeelInfo("name", "class.name");
    harness.check(lafi.getName(), "name");
    harness.check(lafi.getClassName(), "class.name");
   
    // try null name
    lafi = new LookAndFeelInfo(null, "class.name");
    harness.check(lafi.getName(), null);  

    // try null class
    lafi = new LookAndFeelInfo("name", null);
    harness.check(lafi.getClassName(), null);
  }
View Full Code Here

    try {
      LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels() ;
      int index = 0, maxIndex = lafs.length ;
      boolean lafFound = false ;
      while ((index < maxIndex) && !lafFound) {
        LookAndFeelInfo info = lafs[index] ;
        if (PREFEREED_LAF_NAME.equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName()) ;
          SwingUtilities.updateComponentTreeUI(this) ;
          lafFound = true ;
        }// if
        ++index ;
      }// while
View Full Code Here

      public void itemStateChanged(ItemEvent e) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            String selected = (String) lafSwitchCombo
                .getSelectedItem();
            LookAndFeelInfo matchingLafInfo = null;
            for (int i = 0; i < lafs.length; i++) {
              if (lafs[i].getName().equals(selected)) {
                matchingLafInfo = lafs[i];
                break;
              }
            }

            if (selected.startsWith("Substance")) {
              SubstanceLookAndFeel.setSkin(matchingLafInfo
                  .getClassName());
            } else {
              try {
                UIManager.setLookAndFeel(matchingLafInfo
                    .getClassName());
                for (Window w : Window.getWindows()) {
                  SwingUtilities.updateComponentTreeUI(w);
                }
              } catch (Exception exc) {
                System.out.println("Look-and-feel "
                    + matchingLafInfo.getName()
                    + " not found");
              }
            }
          }
        });
View Full Code Here

    setModal(true);

    LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels();
    SwingLookAndFeel[] lafs = new SwingLookAndFeel[infos.length];
    for (int i = 0; i < infos.length; i++) {
      LookAndFeelInfo info = infos[i];
      lafs[i] = new SwingLookAndFeel(info.getName(), info.getClassName());
    }
    lookAndFeelComboBox = new JComboBox<>(lafs);
    lookAndFeelComboBox.setRenderer(new SwingLAFRenderer());
    try {
      SwingLookAndFeel look = SwingLookAndFeel.forName(configManager
View Full Code Here

  public void setSelectedLookAndFeelClassName(String selectedLafClassName)
  {
    if (selectedLafClassName != null)
    {
      LookAndFeelInfo info =_lafsByClassName.get(selectedLafClassName);
      if (info != null)
      {
        setSelectedLookAndFeelName(info.getName());
      }
    }
  }
View Full Code Here

    }
   
    // Need to populate the list with the Substance placeholder, to allow the user to select substance,
    // and then the skin, which is the actual look and feel.
    SubstanceLafPlaceholder substanceLaf = new SubstanceLafPlaceholder();
    LookAndFeelInfo substanceLafInfo = substanceLaf.getLookAndFeelInfo();
    _lafsByName.put(substanceLaf.getName(), substanceLafInfo);
    _lafsByClassName.put(SubstanceLafPlaceholder.class.getName(), substanceLafInfo);

    // Add the names of all LAF objects to control. By doing thru the Map
    // these will be sorted.
View Full Code Here

        try
        {
          LookAndFeel laf = (LookAndFeel) lafClass.newInstance();
          if (laf.isSupportedLookAndFeel())
          {
            LookAndFeelInfo info = new LookAndFeelInfo(laf.getName(), lafClass.getName());
            UIManager.installLookAndFeel(info);
          }
        }
        catch (Throwable th)
        {
View Full Code Here

TOP

Related Classes of javax.swing.UIManager.LookAndFeelInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.