1 package org.simantics.modeling.ui.diagram.monitor;
3 import java.awt.GraphicsEnvironment;
4 import java.util.ArrayList;
5 import java.util.Arrays;
8 import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;
9 import org.simantics.db.ReadGraph;
10 import org.simantics.db.exception.DatabaseException;
11 import org.simantics.utils.datastructures.Pair;
13 public class AvailableFontFactory extends ReadFactoryImpl<Object, List<Pair<String, Object>>> {
16 public List<Pair<String, Object>> perform(ReadGraph graph, Object input) throws DatabaseException {
18 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
19 String[] fonts = ge.getAvailableFontFamilyNames();
21 ArrayList<Pair<String, Object>> result = new ArrayList<Pair<String, Object>>();
22 for(String font : fonts) {
23 result.add(Pair.make(font, (Object)font));