Example usage for javax.swing UIManager getDefaults

List of usage examples for javax.swing UIManager getDefaults

Introduction

In this page you can find the example usage for javax.swing UIManager getDefaults.

Prototype

public static UIDefaults getDefaults() 

Source Link

Document

Returns the defaults.

Usage

From source file:fr.duminy.jbackup.swing.ConfigurationManagerPanel.java

private static FormBuilder<BackupConfiguration> createBuilder(final JComponent parent,
        final ArchiveFactory... factories) {
    return new DefaultFormBuilder<BackupConfiguration>(BackupConfiguration.class) {
        @Override/*from   ww  w . j av  a2s  .c  om*/
        protected void configureBuilder(org.formbuilder.FormBuilder<BackupConfiguration> builder) {
            super.configureBuilder(builder);
            builder.useForProperty("sources", new SourceListTypeMapper(parent));
            builder.useForProperty("archiveFactory", new ArchiveFactoryTypeMapper(factories));
            builder.useForProperty("targetDirectory", new StringPathTypeMapper(DIRECTORIES_BUILDER));
            UIManager.getDefaults().put(BackupConfiguration.class.getSimpleName() + ".xmlVersion.hidden", true);
        }
    };
}

From source file:jshm.gui.GuiUtil.java

/**
 * This sets the default L&F as well as sets some icons
 *//*from   w w w  . ja  v a 2s .  c o  m*/
public static void init() {
    try {
        // Set the Look & Feel to match the current system
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
    }

    // http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingaJOptionPaneLookandFeel.htm
    UIManager.put("OptionPane.errorIcon",
            new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/delete.png")));
    UIManager.put("OptionPane.informationIcon",
            new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/infoabout.png")));
    UIManager.put("OptionPane.questionIcon",
            new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/help.png")));
    UIManager.put("OptionPane.warningIcon",
            new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/pause.png")));
    UIManager.put("OptionPane.yesIcon",
            new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/accept32.png")));
    UIManager.put("OptionPane.noIcon",
            new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/delete32.png")));

    float scale = Config.getFloat("font.scale");

    if (1f != scale) {
        LOG.finest("setting ui font scale to + " + scale);

        Enumeration<Object> keys = UIManager.getDefaults().keys();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);

            if (value instanceof FontUIResource) {
                FontUIResource f = (FontUIResource) value;
                f = new FontUIResource(f.deriveFont(scale * f.getSize2D()));
                UIManager.put(key, f);
            }
        }
    }

    // hook into the wizard displayer
    System.setProperty("WizardDisplayer.default", "jshm.gui.wizards.displayer.WizardDisplayerImpl");
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java

public void createUI() {

    // set the layout
    getContentPane().setLayout(new BorderLayout());

    // set singletons
    theCanvas = new AnnotationReportCanvas(new AnnotationReportDocument(), false);
    theCanvas.getDocument().addDocumentChangeListener(this);

    // initialize the action set
    createActions();/*from  w  ww.ja va  2  s .  c  o m*/

    // set the MenuBar
    theMenuBar = createMenuBar();
    setJMenuBar(theMenuBar);

    // set the toolbars
    UIManager.getDefaults().put("ToolTip.hideAccelerator", Boolean.TRUE);
    theToolBar = createToolBar();
    getContentPane().add(theToolBar, BorderLayout.NORTH);

    // set the drawing pane         
    theScrollPane = new JScrollPane(theCanvas);
    theCanvas.setScrollPane(theScrollPane);
    getContentPane().add(theScrollPane, BorderLayout.CENTER);

    // finish setting up

    theCanvas.addMouseListener(this);
    theCanvas.addSelectionChangeListener(this);

    setSize(900, 700);

    updateActions();
}

From source file:MainProgram.MainProgram.java

public static void setUIFont(javax.swing.plaf.FontUIResource f) {
    java.util.Enumeration keys = UIManager.getDefaults().keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof javax.swing.plaf.FontUIResource) {
            UIManager.put(key, f);
        }/*  ww w.  j a v a 2 s.  com*/
    }
}

From source file:com.hp.alm.ali.idea.content.taskboard.BacklogItemPanel.java

public BacklogItemPanel(Project project, Entity item, TaskBoardFilter filter) {
    super(new BorderLayout());

    this.project = project;
    this.item = item;
    this.filter = filter;
    entityLabelService = project.getComponent(EntityLabelService.class);
    entityService = project.getComponent(EntityService.class);
    activeItemService = project.getComponent(ActiveItemService.class);
    taskBoardConfiguration = project.getComponent(TaskBoardConfiguration.class);
    taskBoardFlow = project.getComponent(TaskBoardFlow.class);
    aliProjectConfiguration = project.getComponent(AliProjectConfiguration.class);

    header = new Header();
    header.setBorder(new EmptyBorder(0, 5, 0, 5));
    add(header, BorderLayout.NORTH);
    entityName = new JTextPane();
    entityName.setBackground(getBackground());
    entityName.setEditable(false);//from w  w w.j  a  v  a  2 s.co  m
    add(entityName, BorderLayout.CENTER);
    content = new Content();
    content.setBorder(new EmptyBorder(0, 5, 10, 5));
    add(content, BorderLayout.SOUTH);

    tasks = new HashMap<Integer, TaskPanel>();

    taskContainers = new HashMap<String, TaskContainerPanel>();
    taskContainers.put(TaskPanel.TASK_NEW, new TaskContainerPanel(this, TaskPanel.TASK_NEW, item));
    taskContainers.put(TaskPanel.TASK_IN_PROGRESS,
            new TaskContainerPanel(this, TaskPanel.TASK_IN_PROGRESS, item));
    taskContainers.put(TaskPanel.TASK_COMPLETED, new TaskContainerPanel(this, TaskPanel.TASK_COMPLETED, item));

    taskContent = new JPanel(new GridLayout(1, 3));
    taskContent.add(getTaskContainer(TaskPanel.TASK_NEW));
    taskContent.add(getTaskContainer(TaskPanel.TASK_IN_PROGRESS));
    taskContent.add(getTaskContainer(TaskPanel.TASK_COMPLETED));

    Color gridColor = UIManager.getDefaults().getColor("Table.gridColor");
    taskContent.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 0, gridColor));
    setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, gridColor));

    // we don't use gap in grid layout to avoid trailing line (on the right)
    getTaskContainer(TaskPanel.TASK_IN_PROGRESS)
            .setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, gridColor));
    getTaskContainer(TaskPanel.TASK_COMPLETED)
            .setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, gridColor));

    simpleHighlight = new SimpleHighlight(entityName);

    setPreferredSize(DIMENSION);

    update(item);
}

From source file:NwFontChooserS.java

static public void setDefaultFont(Font f) {
    FontUIResource fui = new FontUIResource(f);
    Enumeration<Object> keys = UIManager.getDefaults().keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof FontUIResource)
            UIManager.put(key, fui);
    }//w w  w  . ja va 2s .  c  o m

}

From source file:net.sf.keystore_explorer.gui.CreateApplicationGui.java

private static void setDefaultSize(int size) {
    Set<Object> keySet = UIManager.getLookAndFeelDefaults().keySet();
    Object[] keys = keySet.toArray(new Object[keySet.size()]);

    for (Object key : keys) {
        if (key != null && key.toString().toLowerCase().contains("font")) {
            Font font = UIManager.getDefaults().getFont(key);
            if (font != null) {
                font = font.deriveFont((float) size);
                UIManager.put(key, font);
            }/*  w  w w. j av a 2  s.c  o m*/
        }
    }
}

From source file:UI.MainUI.java

public static void setUIFont(javax.swing.plaf.FontUIResource f) {
    java.util.Enumeration keys = UIManager.getDefaults().keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value != null && value instanceof javax.swing.plaf.FontUIResource)
            UIManager.put(key, f);
    }//w w  w. ja va 2  s  .  co m
}

From source file:fi.hoski.remote.ui.Admin.java

public Admin(ServerProperties serverProperties) throws EntityNotFoundException, IOException, SMSException {
    this.serverProperties = serverProperties;
    server = serverProperties.getServer();
    creator = serverProperties.getUsername();
    UIManager.getDefaults().addResourceBundle("fi.hoski.remote.ui.ui");
    creators = new EventEditor[EventType.values().length];
    int index = 0;
    for (EventType eventType : EventType.values()) {
        creators[index++] = new EventEditor(eventType, this.getFrame());
    }//from   www .j a  v a2s. c o  m
    if (serverProperties.isZonerSMSSupported()) {
        int credits = dss.messagesLeft();
        if (credits < 100) {
            String smsLeftString = TextUtil.getText("SMS LEFT");
            JOptionPane.showMessageDialog(frame, smsLeftString + " " + credits);
        }
    }
    privileged = serverProperties.isSuperUser();
    isRaceAdmin = dss.isRaceAdmin(creator + "@gmail.com");
    try {
        checkJavaVersion(serverProperties.getProperties());
        new SqlConnection(serverProperties.getProperties());
        accessUser = true;
    } catch (ClassNotFoundException | SQLException ex) {
        if (privileged) {
            ex.printStackTrace();
        }
    }
    initFrame();
}

From source file:LayeredPaneDemo.java

protected Object findDefaultResource(String id) {
    Object obj = null;/*ww  w  . ja  v  a  2 s  .  co m*/
    try {
        UIDefaults uiDef = UIManager.getDefaults();
        obj = uiDef.get(id);
    } catch (Exception ex) {
        System.err.println(ex);
    }
    if (obj == null)
        obj = myDefaults.get(id);
    return obj;
}