Example usage for javax.swing JLabel setFont

List of usage examples for javax.swing JLabel setFont

Introduction

In this page you can find the example usage for javax.swing JLabel setFont.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.")
public void setFont(Font font) 

Source Link

Document

Sets the font for this component.

Usage

From source file:org.foxbpm.engine.impl.diagramview.svg.SVGUtils.java

/**
 * ??????/*from w w w . ja  v a  2 s  .c om*/
 * 
 * @param font
 *            ?
 * @param text
 *            
 * @return 
 */
public final static int getTextWidth(Font font, String text) {
    JLabel label = new JLabel(text);
    label.setFont(font);
    FontMetrics metrics = label.getFontMetrics(label.getFont());
    return metrics.stringWidth(label.getText());
}

From source file:org.gtdfree.GTDFree.java

private Component getOverviewPane() {
    if (overview == null) {
        overview = new JPanel();
        overview.setLayout(new GridBagLayout());

        int row = 0;

        JLabel l = new JLabel(Messages.getString("GTDFree.OW.Workflow")); //$NON-NLS-1$
        l.setFont(l.getFont().deriveFont((float) (l.getFont().getSize() * 5.0 / 4.0)).deriveFont(Font.BOLD));
        overview.add(l, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, new Insets(18, 18, 7, 18), 0, 0));

        overview.add(/*from   ww w.j ava  2  s . c  o  m*/
                new OverviewTabPanel(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_collecting),
                        TAB_COLECT, Messages.getString("GTDFree.Collect")), //$NON-NLS-1$
                new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));
        overview.add(
                new OverviewTabPanel(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_processing),
                        TAB_PROCESS, Messages.getString("GTDFree.Process")), //$NON-NLS-1$
                new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));
        overview.add(
                new OverviewTabPanel(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_review),
                        TAB_ORGANIZE, Messages.getString("GTDFree.Organize")), //$NON-NLS-1$
                new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));
        overview.add(
                new OverviewTabPanel(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_queue_execute),
                        TAB_EXECUTE, Messages.getString("GTDFree.Execute")), //$NON-NLS-1$
                new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        l = new JLabel(Messages.getString("GTDFree.OW.Summary")); //$NON-NLS-1$
        l.setFont(l.getFont().deriveFont((float) (l.getFont().getSize() * 5.0 / 4.0)).deriveFont(Font.BOLD));
        overview.add(l, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, new Insets(14, 18, 7, 18), 0, 0));

        SummaryLabel sl = new SummaryLabel("inbucketCount") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                tabbedPane.setSelectedIndex(TAB_PROCESS);
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (getSummaryBean().getInbucketCount() > 0) {
                    label.setText(
                            getSummaryBean().getInbucketCount() + " " + Messages.getString("GTDFree.OW.Bucket") //$NON-NLS-1$//$NON-NLS-2$
                                    + " " + Messages.getString("GTDFree.OW.Process")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(true);
                } else {
                    label.setText(getSummaryBean().getInbucketCount() + " " //$NON-NLS-1$
                            + Messages.getString("GTDFree.OW.Bucket")); //$NON-NLS-1$
                    button.setVisible(false);
                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        sl = new SummaryLabel("pastActions") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                tabbedPane.setSelectedIndex(TAB_ORGANIZE);
                organizePane.openTicklerForPast();
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (getSummaryBean().getPastActions() > 0) {
                    label.setText(
                            getSummaryBean().getPastActions() + " " + Messages.getString("GTDFree.OW.Reminder") //$NON-NLS-1$//$NON-NLS-2$
                                    + " " + Messages.getString("GTDFree.OW.Update")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(true);
                } else {
                    label.setText(getSummaryBean().getPastActions() + " " //$NON-NLS-1$
                            + Messages.getString("GTDFree.OW.Reminder")); //$NON-NLS-1$
                    button.setVisible(false);

                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        sl = new SummaryLabel("todayActions") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                tabbedPane.setSelectedIndex(TAB_ORGANIZE);
                organizePane.openTicklerForToday();
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (getSummaryBean().getTodayActions() > 0) {
                    label.setText(
                            getSummaryBean().getTodayActions() + " " + Messages.getString("GTDFree.OW.Due") //$NON-NLS-1$//$NON-NLS-2$
                                    + " " + Messages.getString("GTDFree.OW.Tickler")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(true);
                } else {
                    label.setText(
                            getSummaryBean().getTodayActions() + " " + Messages.getString("GTDFree.OW.Due")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(false);

                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        sl = new SummaryLabel("queueCount") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                tabbedPane.setSelectedIndex(TAB_EXECUTE);
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (getSummaryBean().getQueueCount() > 0) {
                    label.setText(
                            getSummaryBean().getQueueCount() + " " + Messages.getString("GTDFree.OW.Queue") //$NON-NLS-1$//$NON-NLS-2$
                                    + " " + Messages.getString("GTDFree.OW.Execute")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(true);
                } else {
                    label.setText(
                            getSummaryBean().getQueueCount() + " " + Messages.getString("GTDFree.OW.Queue")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(false);

                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        sl = new SummaryLabel("mainCounts") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                GTDFree.this.getActionMap().get("importDialog").actionPerformed(e); //$NON-NLS-1$
                engine.getGlobalProperties().putProperty("examplesImported", true); //$NON-NLS-1$
                updateText(new PropertyChangeEvent(this, "mainCounts", -1, 1)); //$NON-NLS-1$
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (!getEngine().getGlobalProperties().getBoolean("examplesImported", false)) { //$NON-NLS-1$
                    label.setText(getSummaryBean().getOpenCount() + " " //$NON-NLS-1$
                            + Messages.getString("GTDFree.OW.Open.1") + " " + getSummaryBean().getTotalCount() //$NON-NLS-1$//$NON-NLS-2$
                            + " " + Messages.getString("GTDFree.OW.Open.2") + " " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
                            + Messages.getString("GTDFree.OW.Import")); //$NON-NLS-1$
                    button.setVisible(true);
                } else {
                    label.setText(getSummaryBean().getOpenCount() + " " //$NON-NLS-1$
                            + Messages.getString("GTDFree.OW.Open.1") + " " + getSummaryBean().getTotalCount() //$NON-NLS-1$//$NON-NLS-2$
                            + " " + Messages.getString("GTDFree.OW.Open.2")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(false);

                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        overview.add(new JPanel(), new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(0, 11, 0, 11), 0, 0));

    }

    return overview;
}

From source file:org.gtdfree.GTDFree.java

/**
 * This method initializes aboutDialog   
 *    /*from   www.ja va 2s .c  o  m*/
 * @return javax.swing.JDialog
 */
private JDialog getAboutDialog() {
    if (aboutDialog == null) {
        aboutDialog = new JDialog(getJFrame(), true);
        aboutDialog.setTitle(Messages.getString("GTDFree.About.Free")); //$NON-NLS-1$
        Image i = ApplicationHelper.loadImage(ApplicationHelper.icon_name_large_logo); //$NON-NLS-1$
        ImageIcon ii = new ImageIcon(i);

        JTabbedPane jtp = new JTabbedPane();

        JPanel jp = new JPanel();
        jp.setLayout(new GridBagLayout());
        JLabel jl = new JLabel("GTD-Free", ii, SwingConstants.CENTER); //$NON-NLS-1$
        jl.setIconTextGap(22);
        jl.setFont(jl.getFont().deriveFont((float) 24));
        jp.add(jl, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0));
        String s = "Version " + ApplicationHelper.getVersion(); //$NON-NLS-1$
        jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 1, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 11, 4, 11), 0, 0));
        s = Messages.getString("GTDFree.About.DBType") //$NON-NLS-1$
                + getEngine().getGTDModel().getDataRepository().getDatabaseType();
        jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 2, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 2, 11), 0, 0));
        s = Messages.getString("GTDFree.About.DBloc") + getEngine().getDataFolder(); //$NON-NLS-1$
        jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 3, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 11, 4, 11), 0, 0));
        jp.add(new JLabel("Copyright  2008,2009 ikesan@users.sourceforge.net", SwingConstants.CENTER), //$NON-NLS-1$
                new GridBagConstraints(0, 4, 1, 1, 1, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0));
        jtp.addTab("About", jp); //$NON-NLS-1$

        jp = new JPanel();
        jp.setLayout(new GridBagLayout());
        TableModel tm = new AbstractTableModel() {
            private static final long serialVersionUID = -8449423008172417278L;
            private String[] props;

            private String[] getProperties() {
                if (props == null) {
                    props = System.getProperties().keySet().toArray(new String[System.getProperties().size()]);
                    Arrays.sort(props);
                }
                return props;
            }

            @Override
            public String getColumnName(int column) {
                switch (column) {
                case 0:
                    return Messages.getString("GTDFree.About.Prop"); //$NON-NLS-1$
                case 1:
                    return Messages.getString("GTDFree.About.Val"); //$NON-NLS-1$
                default:
                    return null;
                }
            }

            public int getColumnCount() {
                return 2;
            }

            public int getRowCount() {
                return getProperties().length;
            }

            public Object getValueAt(int rowIndex, int columnIndex) {
                switch (columnIndex) {
                case 0:
                    return getProperties()[rowIndex];
                case 1:
                    return System.getProperty(getProperties()[rowIndex]);
                default:
                    return null;
                }
            }
        };
        JTable jt = new JTable(tm);
        jp.add(new JScrollPane(jt), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0));
        jtp.addTab(Messages.getString("GTDFree.About.SysP"), jp); //$NON-NLS-1$

        jp = new JPanel();
        jp.setLayout(new GridBagLayout());
        JTextArea ta = new JTextArea();
        ta.setEditable(false);
        ta.setText(ApplicationHelper.loadLicense());
        ta.setCaretPosition(0);
        jp.add(new JScrollPane(ta), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0));
        jtp.addTab("License", jp); //$NON-NLS-1$

        aboutDialog.setContentPane(jtp);
        aboutDialog.setSize(550, 300);
        //aboutDialog.pack();
        aboutDialog.setLocationRelativeTo(getJFrame());
    }
    return aboutDialog;
}

From source file:org.intermine.install.swing.BuildProjectDialog.java

/**
 * Common initialisation: lays out the child components and wires up the necessary
 * event listeners.//from w w w.j ava  2s  .  c  o m
 */
private void init() {

    setName("Build Project Dialog");
    setTitle(Messages.getMessage("build.project.title"));

    releaseNumberLabel.setLabelFor(releaseNumberTextField);
    destinationLabel.setLabelFor(destinationTextField);

    Container cp = getContentPane();

    GridBagConstraints cons = GridBagHelper.setup(cp);

    JLabel infoLabel = new JLabel(Messages.getMessage("build.project.info.message"));
    infoLabel.setFont(infoLabel.getFont().deriveFont(Font.PLAIN));
    cons.gridwidth = 2;
    cons.weightx = 1;
    cp.add(infoLabel, cons);

    JPanel startPolicyPanel = new JPanel();
    //        startPolicyPanel.setBorder(BorderFactory.createLoweredBevelBorder());
    GridBagConstraints startPolicyPanelCons = GridBagHelper.setup(startPolicyPanel);
    startPolicyPanelCons.gridwidth = GridBagConstraints.REMAINDER;
    startPolicyPanel.add(startPolicyLabel, startPolicyPanelCons);

    startPolicyPanelCons.gridy++;
    startPolicyPanelCons.gridwidth = 2;
    buildDbRadioButton.setFont(infoLabel.getFont().deriveFont(Font.PLAIN));
    startPolicyPanel.add(buildDbRadioButton, startPolicyPanelCons);

    startPolicyPanelCons.gridy++;
    restart1RadioButton.setFont(infoLabel.getFont().deriveFont(Font.PLAIN));
    startPolicyPanel.add(restart1RadioButton, startPolicyPanelCons);

    //        startPolicyPanelCons.gridy++;
    //        restart2RadioButton.setFont(infoLabel.getFont().deriveFont(Font.PLAIN));
    //        startPolicyPanel.add(restart2RadioButton, startPolicyPanelCons);
    //
    //        startPolicyPanelCons.gridy++;
    //        testRadioButton.setFont(infoLabel.getFont().deriveFont(Font.PLAIN));
    //        startPolicyPanel.add(testRadioButton, startPolicyPanelCons);

    cons.gridy++;
    cp.add(startPolicyPanel, cons);

    JPanel userDBPanel = new JPanel();
    //        userDBPanel.setBorder(BorderFactory.createLoweredBevelBorder());
    GridBagConstraints userDBCons = GridBagHelper.setup(userDBPanel);
    userDBPanel.setAlignmentY(LEFT_ALIGNMENT);
    //        cons.gridwidth = GridBagConstraints.REMAINDER;

    userDBPanel.add(userDBOptionsLabel, userDBCons);

    //        userDBCons.gridy++;
    //        nowriteUserDbRadio.setFont(infoLabel.getFont().deriveFont(Font.PLAIN));
    //        userDBPanel.add(nowriteUserDbRadio, userDBCons);
    //
    //        userDBCons.gridy++;
    //        writeUserDbRadio.setFont(infoLabel.getFont().deriveFont(Font.PLAIN));
    //        userDBPanel.add(writeUserDbRadio, userDBCons);
    //
    //        userDBCons.gridy++;
    //        overwriteUserDbRadio.setFont(infoLabel.getFont().deriveFont(Font.PLAIN));
    //        userDBPanel.add(overwriteUserDbRadio, userDBCons);
    //
    //        cons.gridy++;
    //        cp.add(userDBPanel, cons);

    cons.gridy++;
    cons.gridx = 0;
    cons.weightx = 0;
    cons.gridwidth = 1;
    cp.add(encodingLabel, cons);

    cons.gridx++;
    cons.weightx = 0.5;
    encodingDropdown = new JComboBox(encodings);
    cp.add(encodingDropdown, cons);
    //cp.add(encodingTextField, cons);

    //        cons.gridy++;
    //        cons.gridx = 0;
    //        cons.gridwidth = 3;
    //        cons.weightx = 1;
    //        cp.add(serverBackupCheckBox, cons);

    //        cons.gridy++;
    //        cons.gridx = 0;
    //        cons.weightx = 0;
    //        cons.gridwidth = 1;
    //        cp.add(destinationCheckBox, cons);

    //        cons.gridy++;
    //        cons.weightx = 0;
    //        cons.gridwidth = 1;
    //        cp.add(destinationLabel, cons);

    //        cons.gridx++;
    //        cons.weightx = 0.75;
    //        cons.gridwidth = 2;
    //        cp.add(destinationTextField, cons);

    cons.gridy++;
    cons.gridx = 0;
    cons.weightx = 0;
    cons.gridwidth = 1;
    cp.add(new JLabel(Messages.getMessage("build.project.dump.host")), cons);

    cons.gridx++;
    cons.weightx = 0.75;
    cons.gridwidth = 1;
    cp.add(hostTextField, cons);

    cons.gridy++;
    cons.gridx = 0;
    cons.weightx = 0;
    cons.gridwidth = 1;
    cp.add(new JLabel(Messages.getMessage("build.project.dump.prefix")), cons);

    cons.gridx++;
    cons.weightx = 0.75;
    cons.gridwidth = 1;
    cp.add(prefixTextField, cons);

    cons.gridy++;
    cons.gridx = 0;
    cp.add(releaseNumberCheckBox, cons);

    //        cons.gridy++;
    //        cons.weightx = 0;
    //        cons.gridwidth = 1;
    //        cp.add(releaseNumberLabel, cons);

    cons.gridx++;
    cons.weightx = 0.5;
    cp.add(releaseNumberTextField, cons);

    cons.gridy++;
    cons.gridwidth = GridBagConstraints.REMAINDER;
    cons.gridx = 0;
    cons.weightx = 1;
    cp.add(new ButtonPanel(buildAction, new CancelAction()), cons);

    // encodingTextField.setText("SQL_ASCII");
    //        releaseNumberLabel.setEnabled(false);
    releaseNumberTextField.setEnabled(false);
    //        destinationLabel.setEnabled(false);
    //        destinationTextField.setEnabled(false);

    /**
    * Create Button group for userdb radio buttons
    * @serial
    */
    ButtonGroup userDBButtonGroup = new ButtonGroup();
    userDBButtonGroup.add(writeUserDbRadio);
    userDBButtonGroup.add(overwriteUserDbRadio);
    userDBButtonGroup.add(nowriteUserDbRadio);

    ButtonGroup startPolicyGroup = new ButtonGroup();
    startPolicyGroup.add(restart1RadioButton);
    startPolicyGroup.add(restart2RadioButton);
    startPolicyGroup.add(buildDbRadioButton);
    startPolicyGroup.add(testRadioButton);

    releaseNumberCheckBox.addActionListener(
            new LinkedFieldListener(releaseNumberCheckBox, releaseNumberLabel, releaseNumberTextField));
    destinationCheckBox.addActionListener(
            new LinkedFieldListener(destinationCheckBox, destinationLabel, destinationTextField));

    DocumentListener requiredTextListener = new RequiredTextListener();
    releaseNumberTextField.getDocument().addDocumentListener(requiredTextListener);
    //        destinationTextField.getDocument().addDocumentListener(requiredTextListener);
    hostTextField.getDocument().addDocumentListener(requiredTextListener);
    prefixTextField.getDocument().addDocumentListener(requiredTextListener);

    hostTextField.setToolTipText(Messages.getMessage("build.project.dump.host.tooltip"));
    hostTextField.setText("localhost");

    pack();

    progressDialog = new SystemProcessProgressDialog(this);
    progressDialog.setModalityType(ModalityType.APPLICATION_MODAL);
    progressDialog.setTitle(Messages.getMessage("build.project.title"));
    progressDialog.setInformationLabel(Messages.getMessage("build.project.message"));
}

From source file:org.jajuk.ui.thumbnails.LastFmAlbumThumbnail.java

/**
 * Thumb populating done in EDT.//from w w  w . ja va 2  s.  co m
 */
@Override
public void populate() {
    preLoad();
    if (ii == null) {
        return;
    }
    jlIcon = new JLabel();
    postPopulate();
    jlIcon.setIcon(ii);
    setLayout(new MigLayout("ins 0,gapy 2"));
    add(jlIcon, "center,wrap");
    JLabel jlTitle;
    String fullTitle = album.getTitle();
    // Add year if available
    String releaseDate = album.getReleaseDateString();
    if (StringUtils.isNotBlank(releaseDate)) {
        fullTitle += " (" + releaseDate + ")";
    }
    int textLength = 15;
    if (isArtistView()) {
        textLength = 50;
    }
    if (bKnown) {
        // Album known in collection, display its name in bold
        jlTitle = new JLabel(UtilString.getLimitedString(fullTitle, textLength),
                IconLoader.getIcon(JajukIcons.ALBUM), SwingConstants.CENTER);
        jlTitle.setFont(FontManager.getInstance().getFont(JajukFont.BOLD));
    } else {
        jlTitle = new JLabel(UtilString.getLimitedString(fullTitle, textLength));
        jlTitle.setFont(FontManager.getInstance().getFont(JajukFont.PLAIN));
    }
    jlTitle.setToolTipText(album.getTitle());
    jlIcon.setToolTipText(album.getTitle());
    add(jlTitle, "center");
    jlIcon.setBorder(new DropShadowBorder(Color.BLACK, 5, 0.5f, 5, false, true, false, true));
    // disable inadequate menu items
    jmiCDDBWizard.setEnabled(false);
    jmiGetCovers.setEnabled(false);
    if (getItem() == null) {
        jmiDelete.setEnabled(false);
        jmiPlay.setEnabled(false);
        jmiPlayRepeat.setEnabled(false);
        jmiPlayShuffle.setEnabled(false);
        jmiFrontPush.setEnabled(false);
        jmiPush.setEnabled(false);
        jmiProperties.setEnabled(false);
    }
    // Set URL to open
    if (UtilSystem.isBrowserSupported()) {
        jmiOpenLastFMSite.putClientProperty(Const.DETAIL_CONTENT, album.getUrl());
    }
}

From source file:org.jajuk.ui.thumbnails.LastFmArtistThumbnail.java

/**
 * Thumb populating done in EDT./*from   www.  j a va  2 s .c o  m*/
 */
@Override
public void populate() {
    preLoad();
    if (ii == null) {
        return;
    }
    jlIcon = new JLabel();
    postPopulate();
    jlIcon.setIcon(ii);
    setLayout(new MigLayout("ins 0,gapy 2"));
    // Use a panel to allow text to be bigger than image under it
    add(jlIcon, "center,wrap");
    int textLength = 15;
    // In artist view, we have plenty of free space
    if (isArtistView()) {
        textLength = 50;
    }
    JLabel jlTitle = new JLabel(UtilString.getLimitedString(artist.getName(), textLength));
    jlTitle.setToolTipText(artist.getName());
    jlIcon.setToolTipText(artist.getName());
    if (bKnown && !isArtistView()) {
        // Artist known in collection, display its name in bold
        jlTitle.setIcon(IconLoader.getIcon(JajukIcons.ARTIST));
        jlTitle.setFont(FontManager.getInstance().getFont(JajukFont.BOLD));
    } else {
        jlTitle.setFont(FontManager.getInstance().getFont(JajukFont.PLAIN));
    }
    if (isArtistView()) {
        add(jlTitle, "center");
    } else {
        add(jlTitle, "left");
    }
    jlIcon.setBorder(new DropShadowBorder(Color.BLACK, 5, 0.5f, 5, false, true, false, true));
    // disable inadequate menu items
    jmiCDDBWizard.setEnabled(false);
    jmiGetCovers.setEnabled(false);
    if (getItem() == null) {
        jmiDelete.setEnabled(false);
        jmiPlay.setEnabled(false);
        jmiPlayRepeat.setEnabled(false);
        jmiPlayShuffle.setEnabled(false);
        jmiFrontPush.setEnabled(false);
        jmiPush.setEnabled(false);
        jmiProperties.setEnabled(false);
    }
    // Set URL to open
    if (UtilSystem.isBrowserSupported()) {
        jmiOpenLastFMSite.putClientProperty(Const.DETAIL_CONTENT, artist.getUrl());
    }
}

From source file:org.jannocessor.ui.RenderPreviewDialog.java

private void initialize() {
    logger.debug("Initializing UI...");
    DefaultSyntaxKit.initKit();//from  w w  w.  ja v a  2s .c  o  m

    JEditorPane.registerEditorKitForContentType("text/java_template", "org.jannocessor.syntax.JavaTemplateKit",
            getClass().getClassLoader());

    JEditorPane.registerEditorKitForContentType("text/java_output", "org.jannocessor.syntax.JavaOutputKit",
            getClass().getClassLoader());

    setTitle("JAnnocessor - Java Annotation Processor");
    setLayout(new BorderLayout(5, 5));

    listFiles();

    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension screenSize = tk.getScreenSize();
    double width = screenSize.getWidth() * 0.9;
    double height = screenSize.getHeight() * 0.8;

    // Font font = new Font("Courier New", Font.PLAIN, 14);

    input = createInput();
    JScrollPane scroll1 = new JScrollPane(input, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    input.setContentType("text/java_template");

    input.setText("");

    scroll1.setMinimumSize(new Dimension(200, 200));
    scroll1.setPreferredSize(new Dimension((int) (width * 0.5), (int) height));
    add(scroll1, BorderLayout.CENTER);

    output = Box.createVerticalBox();

    scroll2 = new JScrollPane(output, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll2.setMinimumSize(new Dimension(200, 200));
    scroll2.setPreferredSize(new Dimension((int) (width * 0.5), (int) height));
    add(scroll2, BorderLayout.EAST);

    combo = createCombo();

    combo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            load((File) combo.getSelectedItem());
        }
    });

    add(combo, BorderLayout.NORTH);
    JLabel help = new JLabel(
            " Choose a template from the drop-down box to edit it. Navigation: Alt + Left & Alt + Right; Refresh = F5, Close = Esc",
            JLabel.CENTER);

    help.setForeground(Color.WHITE);
    help.setBackground(Color.BLACK);
    help.setOpaque(true);
    help.setFont(new Font("Courier New", Font.BOLD, 14));
    add(help, BorderLayout.SOUTH);

    keyListener = new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_F5) {
                e.consume();
                processElements();
                refresh();
            } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                e.consume();
                dispose();
            } else if (e.getKeyCode() == KeyEvent.VK_LEFT && e.isAltDown()) {
                e.consume();
                moveBackward();
            } else if (e.getKeyCode() == KeyEvent.VK_RIGHT && e.isAltDown()) {
                e.consume();
                moveForward();
            } else if (e.getKeyCode() == KeyEvent.VK_S && e.isControlDown()) {
                e.consume();
                save();
            } else if (e.getKeyCode() == KeyEvent.VK_I && e.isControlDown()) {
                e.consume();
                increase();
            } else if (e.getKeyCode() == KeyEvent.VK_D && e.isControlDown()) {
                e.consume();
                decrease();
            }
        }
    };

    input.addKeyListener(keyListener);
    combo.addKeyListener(keyListener);

    setActive(0);

    pack();
    setModal(true);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    input.requestFocus();
    logger.debug("Initialized UI.");
}

From source file:org.javaswift.cloudie.CloudiePanel.java

private List<LabelComponentPanel> buildMetaDataPanels(Map<String, Object> metadata) {
    List<LabelComponentPanel> panels = new ArrayList<LabelComponentPanel>();
    for (Map.Entry<String, Object> entry : metadata.entrySet()) {
        JLabel comp = new JLabel(String.valueOf(entry.getValue()));
        comp.setFont(comp.getFont().deriveFont(Font.PLAIN));
        panels.add(new LabelComponentPanel(entry.getKey(), comp));
    }//from w w  w  . ja v  a  2  s. co  m
    return panels;
}

From source file:org.jimcat.gui.perspective.boards.cards.Card.java

/**
 * build up swing componets/*from  ww w .  j  ava 2 s  .  c  o  m*/
 */
private void initComponents() {

    setOpaque(false);
    setBorder(new RoundedShadowBorder(15));
    setLayout(new BorderLayout());
    setBackground(new Color(255, 140, 0, 100));

    viewer = new FramedImageViewer();
    viewer.setGraphicSize(new Dimension(140, 140));

    add(viewer, orientation.getBorderLayoutConstant());

    JLabel tmp = null;

    // General info list
    JPanel labelPanel = new JPanel();
    labelPanel.setOpaque(false);
    labelPanel.setBorder(new EmptyBorder(0, 0, 0, 10));
    labelPanel.setLayout(new GridLayout(0, 1));

    JPanel contentPanel = new JPanel();
    contentPanel.setOpaque(false);
    contentPanel.setLayout(new GridLayout(0, 1));

    tmp = new JLabel("Title");
    tmp.setFont(labelFont);
    labelPanel.add(tmp);
    tmp.setOpaque(false);
    contentPanel.add(title);

    tmp = new JLabel("Date Taken");
    tmp.setFont(labelFont);
    labelPanel.add(tmp);
    tmp.setOpaque(false);
    taken = new JLabel();
    contentPanel.add(taken);

    tmp = new JLabel("Dimension");
    tmp.setFont(labelFont);
    tmp.setOpaque(false);
    labelPanel.add(tmp);
    dimension = new JLabel("");
    contentPanel.add(dimension);

    tmp = new JLabel("Size");
    tmp.setFont(labelFont);
    tmp.setOpaque(false);
    labelPanel.add(tmp);
    size = new JLabel("");
    contentPanel.add(size);

    tmp = new JLabel("File path");
    tmp.setFont(labelFont);
    tmp.setOpaque(false);
    labelPanel.add(tmp);
    path = new JLabel("");
    path.setToolTipText("");
    path.addMouseListener(new MouseEventsToCardGrandParentShifter());
    contentPanel.add(path);

    tmp = new JLabel("Rating");
    tmp.setFont(labelFont);
    tmp.setOpaque(false);
    labelPanel.add(tmp);

    rating = new RatingEditor();

    JPanel ratingWrapper = new JPanel(new BorderLayout());
    ratingWrapper.setOpaque(false);
    ratingWrapper.add(rating, BorderLayout.WEST);
    contentPanel.add(ratingWrapper);

    // free line
    tmp = new JLabel();
    tmp.setOpaque(false);
    labelPanel.add(tmp);
    tmp = new JLabel();
    contentPanel.add(tmp);

    // tags
    tmp = new JLabel("Tags");
    tmp.setFont(labelFont);
    tmp.setOpaque(false);
    labelPanel.add(tmp);
    tags = new JLabel("");
    tags.setToolTipText("");
    tags.addMouseListener(new MouseEventsToCardGrandParentShifter());
    contentPanel.add(tags);

    // albums
    tmp = new JLabel("Albums");
    tmp.setFont(labelFont);
    tmp.setOpaque(false);
    labelPanel.add(tmp);
    albums = new JLabel("");
    albums.setToolTipText("");
    albums.addMouseListener(new MouseEventsToCardGrandParentShifter());
    contentPanel.add(albums);

    JPanel info = new JPanel();
    info.setOpaque(false);
    info.setLayout(new BorderLayout());
    info.setBorder(new EmptyBorder(20, 10, 10, 0));

    info.add(labelPanel, BorderLayout.WEST);
    info.add(contentPanel, BorderLayout.CENTER);

    JPanel infoHolder = new JPanel();
    infoHolder.setOpaque(false);
    infoHolder.setLayout(new BorderLayout());
    infoHolder.add(info, BorderLayout.NORTH);

    add(infoHolder, BorderLayout.CENTER);
}

From source file:org.jimcat.gui.perspective.detail.DetailSideBar.java

/**
 * creates image Detail - Section/*from w w  w .  j a v  a2 s  .co  m*/
 * 
 * @return the Component used to show details
 */
private JComponent createImageDetail() {
    JLabel tmp = null;

    // Task Panel
    JXTaskPaneContainer container = new JXTaskPaneContainer();
    container.setOpaque(false);

    // General Infos
    JXTaskPane general = new JXTaskPane();
    general.setOpaque(true);
    general.setTitle("General Info");
    general.setExpanded(true);

    // General info list
    JPanel info = new JPanel();
    GridLayout infoLayout = new GridLayout(0, 2);
    infoLayout.setHgap(5);
    info.setLayout(infoLayout);
    info.setOpaque(false);

    tmp = new JLabel("Title");
    tmp.setFont(labelFont);
    info.add(tmp);
    info.add(title);

    tmp = new JLabel("Rating");
    tmp.setFont(labelFont);
    info.add(tmp);
    rating = new RatingEditor();
    info.add(rating);

    tmp = new JLabel("Dimension");
    tmp.setFont(labelFont);
    info.add(tmp);
    dimension = new JLabel("");
    info.add(dimension);

    tmp = new JLabel("Size");
    tmp.setFont(labelFont);
    info.add(tmp);
    size = new JLabel("");
    info.add(size);

    tmp = new JLabel("Location");
    tmp.setFont(labelFont);
    info.add(tmp);
    path = new JLabel("");
    path.setToolTipText("");
    info.add(path);

    general.add(info);
    container.add(general);

    // Exif data
    JXTaskPane exifs = new JXTaskPane();
    exifs.setOpaque(true);
    exifs.setTitle("Exif Infos");
    exifs.setExpanded(true);
    exifList = new ExifList();
    exifs.add(exifList);
    container.add(exifs);

    // Tags
    JXTaskPane tags = new JXTaskPane();
    tags.setOpaque(true);
    tags.setTitle("Associated Tags");
    tags.setExpanded(true);

    // associated tags-list
    detailTagList = new DetailTagList();
    tags.add(detailTagList);
    container.add(tags);

    // Modify Tags
    JXTaskPane filter = new JXTaskPane();
    filter.setTitle("Modify Tags");
    filter.setExpanded(false);
    filter.setOpaque(true);

    tagTree = new TagTree();
    tagTree.addTagTreeListener(this);

    filter.setLayout(new BorderLayout());
    filter.addMouseListener(new TagPanelPopupHandler(filter));
    filter.add(tagTree, BorderLayout.CENTER);
    container.add(filter);

    JScrollPane pane = new JScrollPane();
    pane.setOpaque(true);
    pane.setBorder(null);
    pane.setViewportView(container);
    pane.putClientProperty(SubstanceLookAndFeel.WATERMARK_TO_BLEED, Boolean.TRUE);
    return pane;
}