Codota Logo
SVGGlyphLoader
Code IndexAdd Codota to your IDE (free)

How to use
SVGGlyphLoader
in
com.jfoenix.svg

Best Java code snippets using com.jfoenix.svg.SVGGlyphLoader (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: jfoenixadmin/JFoenix

/**
 * load a single svg icon from a file
 *
 * @param url of the svg icon
 * @return SVGGLyph node
 * @throws IOException
 */
public static SVGGlyph loadGlyph(URL url) throws IOException {
  String urlString = url.toString();
  String filename = urlString.substring(urlString.lastIndexOf('/') + 1);
  int startPos = 0;
  int endPos = 0;
  while (endPos < filename.length() && filename.charAt(endPos) != '-') {
    endPos++;
  }
  int id = Integer.parseInt(filename.substring(startPos, endPos));
  startPos = endPos + 1;
  while (endPos < filename.length() && filename.charAt(endPos) != '.') {
    endPos++;
  }
  String name = filename.substring(startPos, endPos);
  return new SVGGlyph(id, name, extractSvgPath(getStringFromInputStream(url.openStream())), Color.BLACK);
}
origin: jfoenixadmin/JFoenix

private ScrollPane allGlyphs() {
  List<SVGGlyph> glyphs = SVGGlyphLoader.getAllGlyphsIDs()
    .stream()
    .map(glyphName -> {
      try {
        return SVGGlyphLoader.getIcoMoonGlyph(glyphName);
      } catch (Exception e) {
        return null;
      }
    })
    .collect(Collectors.toList());
  glyphs.sort(Comparator.comparing(SVGGlyph::getName));
  glyphs.forEach(glyph -> glyph.setSize(16));
  List<Button> iconButtons = glyphs.stream().map(this::createIconButton).collect(Collectors.toList());
  // important to improve the performance of animation in scroll pane so buttons are treated as images
  iconButtons.forEach(button -> button.setCache(true));
  Platform.runLater(()->iconButtons.get(0).fire());
  FlowPane glyphLayout = new FlowPane();
  glyphLayout.setHgap(10);
  glyphLayout.setVgap(10);
  glyphLayout.setPadding(new Insets(10));
  glyphLayout.getChildren().setAll(iconButtons);
  glyphLayout.setPrefSize(600, 300);
  ScrollPane scrollableGlyphs = new ScrollPane(glyphLayout);
  scrollableGlyphs.setFitToWidth(true);
  return scrollableGlyphs;
}
origin: jfoenixadmin/JFoenix

/**
 * init fxml when loaded.
 */
@PostConstruct
public void init() throws Exception {
  final Stage stage = (Stage) context.getRegisteredObject("Stage");
  glyphDetailViewer = new GlyphDetailViewer();
  detailsContainer.getChildren().add(glyphDetailViewer);
  ScrollPane scrollableGlyphs = allGlyphs();
  scrollableGlyphs.setStyle(FX_BACKGROUND_INSETS_0);
  iconsContainer.getChildren().add(scrollableGlyphs);
  browseFont.setOnAction((action) -> {
    FileChooser fileChooser = new FileChooser();
    FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("SVG files (*.svg)", "*.svg");
    fileChooser.getExtensionFilters().add(extFilter);
    File file = fileChooser.showOpenDialog(stage);
    if (file != null) {
      SVGGlyphLoader.clear();
      try {
        SVGGlyphLoader.loadGlyphsFont(new FileInputStream(file), file.getName());
        ScrollPane newglyphs = allGlyphs();
        newglyphs.setStyle(FX_BACKGROUND_INSETS_0);
        iconsContainer.getChildren().clear();
        iconsContainer.getChildren().add(newglyphs);
      } catch (IOException ioExc) {
        ioExc.printStackTrace();
      }
    }
  });
}
origin: jfoenixadmin/JFoenix

private void viewGlyphDetail(SVGGlyph glyph) {
  try {
    glyphDetailViewer.setGlyph(SVGGlyphLoader.getIcoMoonGlyph(fileName + "." + glyph.getName()));
  } catch (Exception e) {
  }
}
origin: jfoenixadmin/JFoenix

new Thread(() -> {
  try {
    SVGGlyphLoader.loadGlyphsFont(MainDemo.class.getResourceAsStream("/fonts/icomoon.svg"),
      "icomoon.svg");
  } catch (IOException ioExc) {
origin: jfoenixadmin/JFoenix

suggestions.put("Glass", new MyShape("Glass", SVGGlyphLoader.getIcoMoonGlyph("icomoon.svg.glass")));
suggestions.put("Star", new MyShape("Star", SVGGlyphLoader.getIcoMoonGlyph("icomoon.svg.star")));
suggestions.put("Music", new MyShape("Music", SVGGlyphLoader.getIcoMoonGlyph("icomoon.svg.music")));
final SVGGlyph icoMoonGlyph = SVGGlyphLoader.getIcoMoonGlyph("icomoon.svg.heart");
icoMoonGlyph.getStyleClass().add("heart");
suggestions.put("Heart", new MyShape("Heart", icoMoonGlyph));
suggestions.put("Film", new MyShape("Film", SVGGlyphLoader.getIcoMoonGlyph("icomoon.svg.film")));
origin: com.jfoenix/jfoenix

/**
 * load a single svg icon from a file
 *
 * @param url of the svg icon
 * @return SVGGLyph node
 * @throws IOException
 */
public static SVGGlyph loadGlyph(URL url) throws IOException {
  String urlString = url.toString();
  String filename = urlString.substring(urlString.lastIndexOf('/') + 1);
  int startPos = 0;
  int endPos = 0;
  while (endPos < filename.length() && filename.charAt(endPos) != '-') {
    endPos++;
  }
  int id = Integer.parseInt(filename.substring(startPos, endPos));
  startPos = endPos + 1;
  while (endPos < filename.length() && filename.charAt(endPos) != '.') {
    endPos++;
  }
  String name = filename.substring(startPos, endPos);
  return new SVGGlyph(id, name, extractSvgPath(getStringFromInputStream(url.openStream())), Color.BLACK);
}
com.jfoenix.svgSVGGlyphLoader

Javadoc

will load icomoon svg font file, it will create a map of the available svg glyphs. the user can retrieve the svg glyph using its name.

Most used methods

  • extractSvgPath
  • getStringFromInputStream
  • clear
    clear all loaded svg icons
  • getAllGlyphsIDs
  • getIcoMoonGlyph
    will retrieve icons from the glyphs map for a certain glyphName
  • loadGlyphsFont
    will load SVG icons from icomoon font file (e.g font.svg)

Popular in Java

  • Making http requests using okhttp
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • requestLocationUpdates (LocationManager)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now