Package org.pushingpixels.substance.api.fonts

Examples of org.pushingpixels.substance.api.fonts.FontPolicy


            public void run() {
              SubstanceLookAndFeel.setFontPolicy(null);
              final FontSet substanceCoreFontSet = SubstanceLookAndFeel
                  .getFontPolicy().getFontSet("Substance",
                      null);
              FontPolicy newFontPolicy = new FontPolicy() {
                public FontSet getFontSet(String lafName,
                    UIDefaults table) {
                  return new WrapperFontSet(
                      substanceCoreFontSet, newValue);
                }
              };

              SubstanceLookAndFeel.setFontPolicy(newFontPolicy);

              fontSizeLabel.setText(SubstanceLookAndFeel
                  .getFontPolicy().getFontSet("Substance",
                      null).getControlFont().getSize()
                  + " pt.");
            }
          });
        }
      }
    });
    builder.append(fontSizeSlider);

    Icon zoomInIcon = new ImageIcon(Thread.currentThread()
        .getContextClassLoader().getResource(
            "test/check/icons/16/zoom_in.png"));
    JLabel zoomInLabel = new JLabel(zoomInIcon);
    zoomInLabel.putClientProperty(
        SubstanceLookAndFeel.USE_THEMED_DEFAULT_ICONS, Boolean.TRUE);
    builder.append(zoomInLabel);

    JButton tahoma = new JButton("Tahoma 11");
    tahoma.putClientProperty(
        SubstanceLookAndFeel.BUTTON_NO_MIN_SIZE_PROPERTY, Boolean.TRUE);
    tahoma.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            SubstanceLookAndFeel.setFontPolicy(null);
            FontPolicy newFontPolicy = new FontPolicy() {
              public FontSet getFontSet(String lafName,
                  UIDefaults table) {
                return new Tahoma11FontSet();
              }
            };
View Full Code Here


        if (currLaf instanceof SubstanceLookAndFeel) {
          SubstanceLookAndFeel.resetLabelBundle();
          if ("CN".equals(countryCode)) {
            final FontSet currFontSet = SubstanceLookAndFeel
                .getFontPolicy().getFontSet("Substance", null);
            SubstanceLookAndFeel.setFontPolicy(new FontPolicy() {
              public FontSet getFontSet(String lafName,
                  UIDefaults table) {
                return new DialogFontSet(currFontSet);
              }
            });
View Full Code Here

   * @return Control font size.
   */
  public static int getControlFontSize() {
    if (controlFontSize > 0)
      return controlFontSize;
    FontPolicy fPolicy = SubstanceLookAndFeel.getFontPolicy();
    FontSet fSet = fPolicy.getFontSet("Substance", null);
    controlFontSize = fSet.getControlFont().getSize();
    return controlFontSize;
  }
View Full Code Here

              // Get the default font set
              final FontSet substanceCoreFontSet = SubstanceLookAndFeel
                  .getFontPolicy().getFontSet("Substance",
                      null);
              // Create the wrapper font set
              FontPolicy newFontPolicy = new FontPolicy() {
                public FontSet getFontSet(String lafName,
                    UIDefaults table) {
                  return new WrapperFontSet(
                      substanceCoreFontSet, newValue);
                }
              };

              try {
                GetFontPolicy.this
                    .setCursor(Cursor
                        .getPredefinedCursor(Cursor.WAIT_CURSOR));
                // set the new font policy
                SubstanceLookAndFeel
                    .setFontPolicy(newFontPolicy);
                GetFontPolicy.this.setCursor(Cursor
                    .getDefaultCursor());
              } catch (Exception exc) {
                exc.printStackTrace();
              }
            }
          });
        }
      }
    });
    panel.add(fontSizeSlider);

    JButton jb = new JButton("Show font info");
    jb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        FontPolicy fontPolicy = SubstanceLookAndFeel.getFontPolicy();
        FontSet fontSet = fontPolicy.getFontSet("Substance", null);
        String[] infoArray = new String[] {
            "Control: " + fontSet.getControlFont(),
            "Menu: " + fontSet.getMenuFont(),
            "Message: " + fontSet.getMessageFont(),
            "Small: " + fontSet.getSmallFont(),
View Full Code Here

              // Get the default font set
              final FontSet substanceCoreFontSet = SubstanceLookAndFeel
                  .getFontPolicy().getFontSet("Substance",
                      null);
              // Create the wrapper font set
              FontPolicy newFontPolicy = new FontPolicy() {
                public FontSet getFontSet(String lafName,
                    UIDefaults table) {
                  return new WrapperFontSet(
                      substanceCoreFontSet, newValue);
                }
View Full Code Here

            SubstanceLookAndFeel.setFontPolicy(null);
            // Get the default font set
            final FontSet substanceCoreFontSet = SubstanceLookAndFeel.getFontPolicy().getFontSet("Substance", null); //$NON-NLS-1$

            // Create the wrapper font set
            final FontPolicy newFontPolicy = new FontPolicy() {
              @Override
              public FontSet getFontSet(final String lafName, final UIDefaults table) {
                return new WrapperFontSet(substanceCoreFontSet, value);
              }
            };
View Full Code Here

      SubstanceLookAndFeel.setFontPolicy(null);
      // Get the default font set
      final FontSet substanceCoreFontSet = SubstanceLookAndFeel.getFontPolicy().getFontSet("Substance", null); //$NON-NLS-1$

      // Create the wrapper font set
      final FontPolicy newFontPolicy = new FontPolicy() {
        @Override
        public FontSet getFontSet(final String lafName, final UIDefaults table) {
          return new WrapperFontSet(substanceCoreFontSet, data.getFontSizeOffset());
        }
      };
View Full Code Here

    CustomSettingsPolicy(FontPolicy wrappedPolicy) {
      this.wrappedPolicy = wrappedPolicy;
    }

    public FontSet getFontSet(String lafName, UIDefaults table) {
      FontPolicy customPolicy = getCustomPolicy(lafName);
      if (customPolicy != null) {
        return customPolicy.getFontSet(null, table);
      }
      FontSet customFontSet = getCustomFontSet(lafName);
      if (customFontSet != null) {
        return customFontSet;
      }
View Full Code Here

              // Get the default font set
              final FontSet substanceCoreFontSet = SubstanceLookAndFeel
                  .getFontPolicy().getFontSet("Substance",
                      null);
              // Create the wrapper font set
              FontPolicy newFontPolicy = new FontPolicy() {
                public FontSet getFontSet(String lafName,
                    UIDefaults table) {
                  return new WrapperFontSet(
                      substanceCoreFontSet, newValue);
                }
View Full Code Here

              // Get the default font set
              final FontSet substanceCoreFontSet = SubstanceLookAndFeel
                  .getFontPolicy().getFontSet("Substance",
                      null);
              // Create the wrapper font set
              FontPolicy newFontPolicy = new FontPolicy() {
                public FontSet getFontSet(String lafName,
                    UIDefaults table) {
                  return new WrapperFontSet(
                      substanceCoreFontSet, newValue);
                }
              };

              try {
                GetFontPolicy.this
                    .setCursor(Cursor
                        .getPredefinedCursor(Cursor.WAIT_CURSOR));
                // set the new font policy
                SubstanceLookAndFeel
                    .setFontPolicy(newFontPolicy);
                GetFontPolicy.this.setCursor(Cursor
                    .getDefaultCursor());
              } catch (Exception exc) {
                exc.printStackTrace();
              }
            }
          });
        }
      }
    });
    panel.add(fontSizeSlider);

    JButton jb = new JButton("Show font info");
    jb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        FontPolicy fontPolicy = SubstanceLookAndFeel.getFontPolicy();
        FontSet fontSet = fontPolicy.getFontSet("Substance", null);
        String[] infoArray = new String[] {
            "Control: " + fontSet.getControlFont(),
            "Menu: " + fontSet.getMenuFont(),
            "Message: " + fontSet.getMessageFont(),
            "Small: " + fontSet.getSmallFont(),
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.api.fonts.FontPolicy

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.