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.spoutcraft.launcher.skin.ModpackSelector.java

public ModpackSelector(LauncherFrame frame, AvailablePackList packList, UserModel userModel,
        MirrorStore mirrorStore) {/*from w w  w .ja v a2s  . c  o m*/
    this.frame = frame;
    this.mPackList = packList;
    this.mUserModel = userModel;
    this.mirrorStore = mirrorStore;

    this.mPackList.addPackListener(this);

    for (int i = 0; i < 7; i++) {
        PackButton button = new PackButton();
        buttons.add(button);
        JLabel label = button.getJLabel();
        JLabel icon = button.getDisconnectedIcon();
        button.setActionCommand(PACK_SELECT_ACTION);
        button.addActionListener(this);
        if (i == 3) {
            button.setBounds(bigX, bigY, bigWidth, bigHeight);
            label.setBounds(bigX, bigY + bigHeight - 24, bigWidth, 24);
            icon.setBounds(bigX + bigWidth - 80, bigY, 80, 17);
            label.setFont(label.getFont().deriveFont(14F));
            button.setIndex(0);
        } else if (i < 3) {
            int smallY = bigY - (spacing * 2) - ((smallHeight + spacing) * (i + 1));
            button.setBounds(smallX, smallY, smallWidth, smallHeight);
            label.setBounds(smallX, smallY + smallHeight - 20, smallWidth, 20);
            icon.setBounds(smallX + smallWidth - 80, smallY, 80, 17);
            button.setIndex((i + 1) * -1);
        } else if (i > 3) {
            int smallY = bigY + bigHeight + ((smallHeight + spacing) * (i - 4)) + (spacing * 3);
            button.setBounds(smallX, smallY, smallWidth, smallHeight);
            label.setBounds(smallX, smallY + smallHeight - 20, smallWidth, 20);
            icon.setBounds(smallX + smallWidth - 80, smallY, 80, 17);
            button.setIndex(i - 3);
        }

        this.add(label);
        this.add(icon);
        this.add(button);
    }
}

From source file:org.spoutcraft.launcher.technic.skin.ModpackSelector.java

public ModpackSelector(TechnicLoginFrame frame) {
    this.frame = frame;

    for (int i = 0; i < 7; i++) {
        PackButton button = new PackButton();
        buttons.add(button);/*from  w w w .  j  a  va  2  s . c o  m*/
        JLabel label = button.getJLabel();
        button.setActionCommand(PACK_SELECT_ACTION);
        button.addActionListener(this);
        if (i == 3) {
            button.setBounds(bigX, bigY, bigWidth, bigHeight);
            label.setBounds(bigX, bigY + bigHeight - 24, bigWidth, 24);
            label.setFont(label.getFont().deriveFont(14F));
            button.setIndex(0);
        } else if (i < 3) {
            int smallY = bigY - (spacing * 2) - ((smallHeight + spacing) * (i + 1));
            button.setBounds(smallX, smallY, smallWidth, smallHeight);
            label.setBounds(smallX, smallY + smallHeight - 20, smallWidth, 20);
            button.setIndex((i + 1) * -1);
        } else if (i > 3) {
            int smallY = bigY + bigHeight + ((smallHeight + spacing) * (i - 4)) + (spacing * 3);
            button.setBounds(smallX, smallY, smallWidth, smallHeight);
            label.setBounds(smallX, smallY + smallHeight - 20, smallWidth, 20);
            button.setIndex(i - 3);
        }

        this.add(button.getJLabel());
        this.add(button);
    }
}

From source file:org.stanwood.swing.AboutDialog.java

private void createTitleArea(Box box, String title, String version) {
    JLabel lblTitle = new JLabel(title);
    lblTitle.setHorizontalTextPosition(JLabel.LEFT);
    lblTitle.setHorizontalAlignment(JLabel.LEFT);
    lblTitle.setFont(new Font("Serif", Font.BOLD, 24));
    box.add(lblTitle);//from  w  w  w  .j  a v a  2s .  c  o  m
    JLabel lblVersion = new JLabel(version);
    lblVersion.setFont(new Font("Serif", Font.BOLD, 12));
    lblVersion.setHorizontalAlignment(JLabel.LEFT);
    lblVersion.setHorizontalTextPosition(JLabel.LEFT);
    box.add(lblVersion);
}

From source file:org.tinymediamanager.ui.tvshows.TvShowDetailsPanel.java

private void setBoldLabel(JLabel label) {
    label.setFont(label.getFont().deriveFont(Font.BOLD));
}

From source file:org.tinymediamanager.ui.tvshows.TvShowEpisodeDetailsPanel.java

/**
 * Instantiates a new tv show episode details panel.
 * /*from w  w w .  ja  v  a 2  s  . c  om*/
 * @param model
 *          the selection model
 */
public TvShowEpisodeDetailsPanel(TvShowEpisodeSelectionModel model) {
    this.selectionModel = model;
    setLayout(new FormLayout(new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
            FormFactory.DEFAULT_COLSPEC, ColumnSpec.decode("25px"), ColumnSpec.decode("default:grow"),
            FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("55px"), FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));

    JLabel lblSeasonT = new JLabel(BUNDLE.getString("metatag.season")); //$NON-NLS-1$
    TmmFontHelper.changeFont(lblSeasonT, 1.166, Font.BOLD);
    add(lblSeasonT, "2, 1");

    lblSeason = new JLabel("");
    TmmFontHelper.changeFont(lblSeason, 1.166);
    add(lblSeason, "4, 1");

    btnPlay = new JButton("");
    btnPlay.setIcon(IconManager.PLAY);
    btnPlay.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            MediaFile mf = selectionModel.getSelectedTvShowEpisode().getMediaFiles(MediaFileType.VIDEO).get(0);
            try {
                TmmUIHelper.openFile(mf.getFileAsPath());
            } catch (Exception e) {
                LOGGER.error("open file", e);
                MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, mf, "message.erroropenfile",
                        new String[] { ":", e.getLocalizedMessage() }));
            }
        }
    });
    add(btnPlay, "6, 1, 1, 4");

    JLabel lblEpisodeT = new JLabel(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$
    TmmFontHelper.changeFont(lblEpisodeT, 1.166, Font.BOLD);
    add(lblEpisodeT, "2, 2");

    lblEpisode = new JLabel("");
    TmmFontHelper.changeFont(lblEpisode, 1.166);
    add(lblEpisode, "4, 2");

    JLabel lblAiredT = new JLabel(BUNDLE.getString("metatag.aired")); //$NON-NLS-1$
    lblAiredT.setFont(lblAiredT.getFont().deriveFont(Font.BOLD));
    add(lblAiredT, "2, 4");

    lblAired = new JLabel("");
    add(lblAired, "4, 4");

    JLabel lblTagsT = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$
    lblTagsT.setFont(lblTagsT.getFont().deriveFont(Font.BOLD));
    add(lblTagsT, "2, 6");

    lblTags = new JLabel("");
    add(lblTags, "4, 6");

    JLabel lblDateAddedT = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$
    lblDateAddedT.setFont(lblDateAddedT.getFont().deriveFont(Font.BOLD));
    add(lblDateAddedT, "2, 8");

    lblDateAdded = new JLabel("");
    add(lblDateAdded, "4, 8");

    JLabel lblPathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$
    lblPathT.setFont(lblPathT.getFont().deriveFont(Font.BOLD));
    add(lblPathT, "2, 10");

    lblPath = new LinkLabel("");
    lblPathT.setLabelFor(lblPath);
    lblPath.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (!StringUtils.isEmpty(lblPath.getNormalText())) {
                // get the location from the label
                Path path = Paths.get(lblPath.getNormalText());
                try {
                    // check whether this location exists
                    if (Files.exists(path)) {
                        TmmUIHelper.openFile(path);
                    }
                } catch (Exception ex) {
                    LOGGER.error("open filemanager", ex);
                    MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, path,
                            "message.erroropenfolder", new String[] { ":", ex.getLocalizedMessage() }));
                }
            }
        }
    });
    add(lblPath, "4, 10, 3, 1");
    initDataBindings();
}

From source file:org.tranche.gui.user.SignInPanel.java

public SignInPanel() {
    setBackground(Styles.COLOR_PANEL_BACKGROUND);
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = GridBagConstraints.RELATIVE;
    gbc.insets = new Insets(7, 7, 0, 0);
    gbc.weightx = 0;//w w w .ja va2 s .c o m
    gbc.weighty = 1;
    add(new GenericLabel("Unique Name / Email:"), gbc);

    userNameTextField.addActionListener(this);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(7, 7, 0, 7);
    gbc.weightx = 1;
    add(userNameTextField, gbc);

    gbc.gridwidth = GridBagConstraints.RELATIVE;
    gbc.insets = new Insets(7, 7, 0, 0);
    gbc.weightx = 0;
    add(new GenericLabel("Password:"), gbc);

    passwordField.addActionListener(this);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(7, 7, 0, 7);
    gbc.weightx = 1;
    add(passwordField, gbc);

    GenericRoundedButton signInButton = new GenericRoundedButton("Sign In");
    signInButton.addActionListener(this);
    gbc.insets = new Insets(7, 7, 7, 7);
    add(signInButton, gbc);

    if (ConfigureTranche.get(ConfigureTranche.CATEGORY_GENERAL, ConfigureTranche.PROP_SIGN_UP_URL) != null
            && !ConfigureTranche.get(ConfigureTranche.CATEGORY_GENERAL, ConfigureTranche.PROP_SIGN_UP_URL)
                    .equals("")) {
        JLabel noAccountLabel = new GenericLabel("No Account?");
        noAccountLabel.setFont(Styles.FONT_14PT_BOLD);
        gbc.insets = new Insets(10, 7, 0, 7);
        add(noAccountLabel, gbc);

        GenericRoundedButton applyButton = new GenericRoundedButton("Apply For An Account");
        applyButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                Thread t = new Thread() {

                    @Override()
                    public void run() {
                        GUIUtil.displayURL(ConfigureTranche.get(ConfigureTranche.CATEGORY_GENERAL,
                                ConfigureTranche.PROP_SIGN_UP_URL));
                    }
                };
                t.setDaemon(true);
                t.start();
            }
        });
        gbc.insets = new Insets(7, 7, 0, 7);
        add(applyButton, gbc);
    }

    JLabel userCertLabel = new GenericLabel("Have a User File?");
    userCertLabel.setFont(Styles.FONT_14PT_BOLD);
    gbc.insets = new Insets(10, 7, 0, 7);
    add(userCertLabel, gbc);

    GenericRoundedButton logInWithCertButton = new GenericRoundedButton("Sign In With My User Certificate");
    logInWithCertButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            final JFileChooser jfc = GUIUtil.makeNewFileChooser();
            Thread t = new Thread() {

                @Override
                public void run() {
                    UserZipFile uzf = null;
                    try {
                        uzf = GUIUtil.promptForUserFile(jfc, SignInPanel.this);
                    } catch (Exception e) {
                        ef.show(e, SignInPanel.this);
                    }
                    if (uzf != null) {
                        abq.offer(uzf);
                    }
                }
            };
            t.setDaemon(true);
            t.start();
        }
    });
    gbc.insets = new Insets(7, 7, 7, 7);
    add(logInWithCertButton, gbc);
}

From source file:org.ut.biolab.medsavant.client.patient.AddPatientsForm.java

/** This method is called from within the constructor to
 * initialize the form.// www. j  a va  2  s.  c  om
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    scrollPane = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    addButton = new javax.swing.JButton();
    javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
    doneButton = new javax.swing.JButton();
    tipLabel = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Import Patients");

    table.setModel(
            new javax.swing.table.DefaultTableModel(
                    new Object[][] { { null, null, null, null }, { null, null, null, null },
                            { null, null, null, null }, { null, null, null, null } },
                    new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    scrollPane.setViewportView(table);

    addButton.setText("Add Individual");
    addButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            addButtonActionPerformed(evt);
        }
    });

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jLabel1.setText("Add Single Patient:");

    doneButton.setText("Done");
    doneButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            doneButtonActionPerformed(evt);
        }
    });

    tipLabel.setText(" ");

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(scrollPane, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addComponent(tipLabel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(addButton))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addGap(0, 0, Short.MAX_VALUE).addComponent(doneButton)))
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(scrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 283,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(addButton).addComponent(tipLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(doneButton)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pack();
}

From source file:org.ut.biolab.medsavant.client.project.ProjectSummaryPage.java

@Override
public JPanel getView() {
    JPanel view = new JPanel();

    ViewUtil.applyVerticalBoxLayout(view);
    //view.setLayout(new GridBagLayout());

    JLabel title = new JLabel(ProjectController.getInstance().getCurrentProjectName() + " Project");
    title.setBorder(ViewUtil.getBigBorder());
    title.setOpaque(false);//from  w  w  w.j a  v  a  2 s  . c  o m
    title.setFont(ViewUtil.getMediumTitleFont());

    CollapsiblePanes panes = new CollapsiblePanes();

    panes.add(createPatientSummary());
    panes.add(createVariantSummary());
    panes.add(createReferenceSummary());

    panes.addExpansion();

    view.add(title);
    view.add(panes);

    return view;
}

From source file:org.ut.biolab.medsavant.client.variant.ImportVariantsWizard.java

private AbstractWizardPage getWelcomePage() {

    //setup page/*  ww  w.  j  a  v a 2 s. c  o  m*/
    final DefaultWizardPage page = new DefaultWizardPage("Import Variants") {
        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
        }
    };

    String projectName = ProjectController.getInstance().getCurrentProjectName();
    String referenceName = ReferenceController.getInstance().getCurrentReferenceName();

    page.addText("This wizard will help you import variants for:");

    JLabel nameLabel = new JLabel(projectName + " (" + referenceName + ")");
    nameLabel.setFont(ViewUtil.getMediumTitleFont());
    page.addComponent(nameLabel);
    page.addText(
            "If the variants are with respect to another reference\ngenome, switch to that reference and try importing again.");

    return page;
}

From source file:org.ut.biolab.medsavant.client.variant.RemoveVariantsWizard.java

private AbstractWizardPage getWelcomePage() {

    //setup page/*  ww w.  j  av  a 2  s.  com*/
    final DefaultWizardPage page = new DefaultWizardPage("Remove Variants") {
        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.BACK);
            fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
        }
    };

    String projectName = ProjectController.getInstance().getCurrentProjectName();
    String referenceName = ReferenceController.getInstance().getCurrentReferenceName();

    page.addText("This wizard will help you remove the following variant files from \nproject " + projectName
            + " and reference " + referenceName + ": ");

    for (SimpleVariantFile f : files) {
        JLabel nameLabel = new JLabel(f.getPath());
        nameLabel.setFont(ViewUtil.getMediumTitleFont());
        page.addComponent(nameLabel);
    }

    return page;
}