Example usage for javax.swing UIManager put

List of usage examples for javax.swing UIManager put

Introduction

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

Prototype

public static Object put(Object key, Object value) 

Source Link

Document

Stores an object in the developer defaults.

Usage

From source file:net.sf.jabref.gui.JabRefFrame.java

private void initLayout() {
    tabbedPane.putClientProperty(Options.NO_CONTENT_BORDER_KEY, Boolean.TRUE);

    setProgressBarVisible(false);/*from w ww . j a  va2s.  com*/

    pushExternalButton = new PushToApplicationButton(this, PushToApplications.getApplications());
    fillMenu();
    createToolBar();
    getContentPane().setLayout(gbl);
    splitPane.setDividerSize(2);
    splitPane.setBorder(null);
    //getContentPane().setBackground(GUIGlobals.lightGray);
    con.fill = GridBagConstraints.HORIZONTAL;
    con.anchor = GridBagConstraints.WEST;
    con.weightx = 1;
    con.weighty = 0;
    con.gridwidth = GridBagConstraints.REMAINDER;

    //gbl.setConstraints(mb, con);
    //getContentPane().add(mb);
    setJMenuBar(mb);
    con.anchor = GridBagConstraints.NORTH;
    //con.gridwidth = 1;//GridBagConstraints.REMAINDER;;
    gbl.setConstraints(tlb, con);
    getContentPane().add(tlb);

    Component lim = Box.createGlue();
    gbl.setConstraints(lim, con);
    //getContentPane().add(lim);
    /*
      JPanel empt = new JPanel();
      empt.setBackground(GUIGlobals.lightGray);
      gbl.setConstraints(empt, con);
       getContentPane().add(empt);
            
      con.insets = new Insets(1,0,1,1);
      con.anchor = GridBagConstraints.EAST;
      con.weightx = 0;
      gbl.setConstraints(searchManager, con);
      getContentPane().add(searchManager);*/
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weightx = 1;
    con.weighty = 0;
    con.fill = GridBagConstraints.BOTH;
    con.anchor = GridBagConstraints.WEST;
    con.insets = new Insets(0, 0, 0, 0);
    lim = Box.createGlue();
    gbl.setConstraints(lim, con);
    getContentPane().add(lim);
    //tabbedPane.setVisible(false);
    //tabbedPane.setForeground(GUIGlobals.lightGray);
    con.weighty = 1;
    gbl.setConstraints(splitPane, con);
    getContentPane().add(splitPane);

    UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));

    splitPane.setRightComponent(tabbedPane);
    splitPane.setLeftComponent(sidePaneManager.getPanel());
    sidePaneManager.updateView();

    JPanel status = new JPanel();
    status.setLayout(gbl);
    con.weighty = 0;
    con.weightx = 0;
    con.gridwidth = 1;
    con.insets = new Insets(0, 2, 0, 0);
    gbl.setConstraints(statusLabel, con);
    status.add(statusLabel);
    con.weightx = 1;
    con.insets = new Insets(0, 4, 0, 0);
    con.gridwidth = 1;
    gbl.setConstraints(statusLine, con);
    status.add(statusLine);
    con.weightx = 0;
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.insets = new Insets(2, 4, 2, 2);
    gbl.setConstraints(progressBar, con);
    status.add(progressBar);
    con.weightx = 1;
    con.gridwidth = GridBagConstraints.REMAINDER;
    statusLabel.setForeground(GUIGlobals.ENTRY_EDITOR_LABEL_COLOR.darker());
    con.insets = new Insets(0, 0, 0, 0);
    gbl.setConstraints(status, con);
    getContentPane().add(status);

    // Drag and drop for tabbedPane:
    TransferHandler xfer = new EntryTableTransferHandler(null, this, null);
    tabbedPane.setTransferHandler(xfer);
    tlb.setTransferHandler(xfer);
    mb.setTransferHandler(xfer);
    sidePaneManager.getPanel().setTransferHandler(xfer);
}

From source file:com.puzzle.gui.MainFrame.java

/**
 * @param args the command line arguments
 *//*from  w ww  . j a  v a 2s .  c o m*/
public static void main(String args[]) throws Exception {

    //        String path = System.getProperty("user.dir") + File.separator + "config" + File.separator + "kafka" + File.separator + "kafka_client_jaas.conf";
    String path = System.getProperty("user.dir") + File.separator + "config" + File.separator
            + "kafka_client_jaas.conf";
    System.setProperty("java.security.auth.login.config", path);

    if (!FileLockUtil.getFileLock()) {
        Jdialog2.showDialog();
        return;
    }

    //???
    System.setProperty("sun.java2d.noddraw", "true");
    BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.translucencyAppleLike;
    org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF();

    UIManager.put("TabbedPane.tabAreaInsets", new javax.swing.plaf.InsetsUIResource(3, 1, 2, 20));
    UIManager.put("RootPane.setupButtonVisible", false);
    setfont();
    /* Create and display the form */

    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            MainFrame ff = new MainFrame();
            ff.initLog();
            log.info("??");
            ff.setVisible(true);

            ff.startJtableFlushThread();//?
            ff.new setScheckJlabel2Status().start();
            ff.new setScheckJlabel1Status().start();
            ff.new setScheckJlabel4Status().start();
            ff.new setScheckJlabel5Status().start();
            ff.jButton1ActionPerformed(null);
            //                  new UkeyC().start();

            JWindowShow.flag1 = true;
        }
    });

}

From source file:com.puzzle.gui.MainFrame.java

/**
 * UIManagerUIkey/*from  ww  w .ja  v  a  2s  .  c  o  m*/
 */
public static void setfont() {
    String[] DEFAULT_FONT = new String[] { "Table.font", "TableHeader.font", "CheckBox.font", "Tree.font",
            "Viewport.font", "ProgressBar.font", "RadioButtonMenuItem.font", "ToolBar.font",
            "ColorChooser.font", "ToggleButton.font", "Panel.font", "TextArea.font", "Menu.font",
            "TableHeader.font" // ,"TextField.font"
            , "OptionPane.font", "MenuBar.font", "Button.font", "Label.font", "PasswordField.font",
            "ScrollPane.font", "MenuItem.font", "ToolTip.font", "List.font", "EditorPane.font", "Table.font",
            "TabbedPane.font", "RadioButton.font", "CheckBoxMenuItem.font", "TextPane.font", "PopupMenu.font",
            "TitledBorder.font", "ComboBox.font" };
    // 
    for (int i = 0; i < DEFAULT_FONT.length; i++) {
        UIManager.put(DEFAULT_FONT[i], new Font("", Font.PLAIN, 14));
    }
}

From source file:edu.ku.brc.ui.UIRegistry.java

/**
 * Creates the initial font mapping from the base font size to the other sizes.
 * @param clazz the class of the component
 * @param baseFontArg the base font size
 *///  ww  w.  j a va  2 s  .  c  o m
protected static void adjustAllFonts(final Font oldBaseFont, final Font baseFontArg) {
    if (oldBaseFont != null && baseFontArg != null) {
        int fontSize = baseFontArg.getSize();
        int oldFontSize = oldBaseFont.getSize();
        String family = baseFontArg.getFamily();

        UIDefaults uiDefaults = UIManager.getDefaults();
        Enumeration<Object> e = uiDefaults.keys();
        while (e.hasMoreElements()) {
            Object key = e.nextElement();
            if (key.toString().endsWith(".font")) {
                FontUIResource fontUIRes = (FontUIResource) uiDefaults.get(key);
                if (fontSize != fontUIRes.getSize() || !family.equals(fontUIRes.getFamily())) {
                    UIManager.put(key, new FontUIResource(new Font(family, fontUIRes.getStyle(),
                            fontSize + (fontUIRes.getSize() - oldFontSize))));
                }
            }
        }
    }
}

From source file:ru.apertum.qsystem.client.forms.FAdmin.java

/**
     * @param args the command line arguments
     * @throws Exception//from   w  w w. j  a  v a2  s . c  o  m
     */
    public static void main(String args[]) throws Exception {
        QLog.initial(args, 3);
        Locale.setDefault(Locales.getInstance().getLangCurrent());

        //?  ? , ? 
        final Thread tPager = new Thread(() -> {
            FAbout.loadVersionSt();
            String result = "";
            try {
                final URL url = new URL(PAGER_URL + "/qskyapi/getpagerdata?qsysver=" + FAbout.VERSION_);
                final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.setRequestProperty("User-Agent", "Java bot");
                conn.connect();
                final int code = conn.getResponseCode();
                if (code == 200) {
                    try (BufferedReader in = new BufferedReader(
                            new InputStreamReader(conn.getInputStream(), "utf8"))) {
                        String inputLine;
                        while ((inputLine = in.readLine()) != null) {
                            result += inputLine;
                        }
                    }
                }
                conn.disconnect();
            } catch (Exception e) {
                System.err.println("Pager not enabled. " + e);
                return;
            }
            final Gson gson = GsonPool.getInstance().borrowGson();
            try {
                final Answer answer = gson.fromJson(result, Answer.class);
                forPager = answer;
                if (answer.getData().size() > 0) {
                    forPager.start();
                }
            } catch (Exception e) {
                System.err.println("Pager not enabled but working. " + e);
            } finally {
                GsonPool.getInstance().returnGson(gson);
            }
        });
        tPager.setDaemon(true);
        tPager.start();

        Uses.startSplash();
        //     plugins
        Uses.loadPlugins("./plugins/");
        //      ?.
        FLogin.logining(QUserList.getInstance(), null, true, 3, FLogin.LEVEL_ADMIN);
        Uses.showSplash();
        java.awt.EventQueue.invokeLater(() -> {
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
                        .getInstalledLookAndFeels()) {
                    System.out.println(info.getName());
                    /*Metal Nimbus CDE/Motif Windows   Windows Classic  //GTK+*/
                    if ("Windows".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
                if ("/".equals(File.separator)) {
                    final FontUIResource f = new FontUIResource(new Font("Serif", Font.PLAIN, 10));
                    final Enumeration<Object> keys = UIManager.getDefaults().keys();
                    while (keys.hasMoreElements()) {
                        final Object key = keys.nextElement();
                        final Object value = UIManager.get(key);
                        if (value instanceof FontUIResource) {
                            final FontUIResource orig = (FontUIResource) value;
                            final Font font1 = new Font(f.getFontName(), orig.getStyle(), f.getSize());
                            UIManager.put(key, new FontUIResource(font1));
                        }
                    }
                }
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException ex) {
            }
            try {
                form = new FAdmin();
                if (forPager != null) {
                    forPager.showData(false);
                } else {
                    form.panelPager.setVisible(false);
                }
                form.setVisible(true);
            } catch (Exception ex) {
                QLog.l().logger().error(" ? ??  . ", ex);
            } finally {
                Uses.closeSplash();
            }
        });
    }

From source file:com.pironet.tda.TDA.java

/**
 * set the ui SANS_SERIF for all tda stuff (needs to be done for create of objects)
 *
 * @param f the SANS_SERIF to user/*  w w  w. j  av a 2s.  c o m*/
 */
private void setUIFont(FontUIResource f) {
    //
    // sets the default SANS_SERIF for all Swing components.
    // ex.
    //  setUIFont (new javax.swing.plaf.FontUIResource("Serif",Font.ITALIC,12));
    //
    Enumeration keys = UIManager.getDefaults().keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof FontUIResource) {
            UIManager.put(key, f);
        }
    }
}

From source file:jeplus.JEPlusFrameMain.java

private void jMenuItemDefaultLaFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDefaultLaFActionPerformed
    try {/*from w w w  .java2s.c  o  m*/
        switch (jMenuItemDefaultLaF.getActionCommand()) {
        case "default":
            UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            SwingUtilities.updateComponentTreeUI(this);
            jMenuItemDefaultLaF.setActionCommand("platform");
            jMenuItemDefaultLaF.setText("Switch to system Look and Feel (OS)");
            this.pack();
            break;
        case "platform":
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            SwingUtilities.updateComponentTreeUI(this);
            jMenuItemDefaultLaF.setActionCommand("default");
            jMenuItemDefaultLaF.setText("Switch to defaul Look and Feel (Metal)");
            this.pack();
            break;
        }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
            | UnsupportedLookAndFeelException ex) {
        logger.error("Error setting Look-and-Feel.", ex);
    }
}

From source file:base.BasePlayer.Main.java

public static void main(String[] args) {
    try {/*from ww w.j av a  2 s .c  o  m*/
        UIManager.put("Slider.paintValue", false);
        //   UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); 
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        System.setProperty("sun.java2d.d3d", "false");
    } catch (Exception e) {
        e.printStackTrace();
    }
    Main.args = args;
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            //Logo.main(argsit);
            createAndShowGUI();
        }
    });
}

From source file:au.org.ala.delta.intkey.Intkey.java

/**
 * Prompt the user to select the font to use in the application
 *///  w w w  .  ja v  a2s  .c  om
@Action
public void chooseFont() {
    Font f = UIManager.getFont("Label.font");
    Font newFont = JFontChooser.showDialog(getMainFrame(),
            UIUtils.getResourceString("SelectFontPrompt.caption"), f);
    if (newFont != null) {
        FontUIResource fontResource = new FontUIResource(newFont);
        Enumeration<Object> 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, fontResource);
            }
        }
        SwingUtilities.updateComponentTreeUI(getMainFrame());
    }
}

From source file:com.peterbochs.PeterBochsDebugger.java

public void initGlobalFontSetting(Font fnt) {
    FontUIResource fontRes = new FontUIResource(fnt);
    for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof FontUIResource) {
            UIManager.put(key, fontRes);
        }/*from  w  w  w .j a v a2  s. c  o  m*/
    }
    SwingUtilities.updateComponentTreeUI(this);
}