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:UI.SecurityDashboard.java

private void performMetric5(MainViewPanel mvp) {
    Metric5 metric5 = new Metric5();

    JPanel graphPanel5 = new JPanel();
    graphPanel5.setLayout(new BorderLayout());
    graphPanel5.add(metric5.run(), BorderLayout.NORTH);

    NetworkPanel.setLayout(new BorderLayout());
    JTextArea header = new JTextArea(
            "\nThe web application page will scan all remote servers running a web program in search of any "
                    + "vulnerabilities present.\n");
    //header.setLineWrap(true);
    //header.setWrapStyleWord(true);
    header.setEditable(false);//from  w w w. j  av a2 s. c om
    NetworkPanel.add(header, BorderLayout.NORTH);
    NetworkPanel.add(graphPanel5, BorderLayout.CENTER);

    ChartPanel fifthPanel = mvp.getPanel5(metric5);

    fifthPanel.addChartMouseListener(new ChartMouseListener() {

        @Override
        public void chartMouseClicked(ChartMouseEvent cme) {
            dashboardTabs.setSelectedIndex(5);
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });

    Metric5Panel.setLayout(new BorderLayout());
    Font titleFont = new Font("Calibri", Font.BOLD, 27);
    JLabel netAppTitleLabel = new JLabel("            Web Applications");
    netAppTitleLabel.setFont(titleFont);
    Metric5Panel.add(netAppTitleLabel, BorderLayout.NORTH);
    Metric5Panel.add(fifthPanel, BorderLayout.CENTER);
    Metric5Panel.setBackground(Color.white);
}

From source file:edu.ku.brc.specify.plugins.ipadexporter.iPadDBExporterPlugin.java

public SubPaneIFace getExportPanel() {
    if (panelTitle == null || starterPane == null) {
        loadAndPushResourceBundle(RESOURCE_NAME);

        panelTitle = createI18NLabel("NOT_LOGIN", SwingConstants.CENTER);
        JLabel desc = createI18NLabel("EXPORTIN_TO_IPAD", SwingConstants.CENTER);
        JLabel iconLbl = createLabel("  ",
                IconManager.getImage("ExportSpMobile", IconManager.STD_ICON_SIZE.NonStd));

        desc.setFont(desc.getFont().deriveFont(24.0f));

        CellConstraints cc = new CellConstraints();

        PanelBuilder pb0 = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p"));
        pb0.add(exportBtn, cc.xy(2, 1));

        PanelBuilder pb = new PanelBuilder(
                new FormLayout("f:p:g,p,f:p:g", "20px,p,f:p:g,p,20px,p,20px,p,f:p:g"));
        pb.add(panelTitle, cc.xy(2, 2));
        pb.add(desc, cc.xy(2, 4));/*from w ww .  j  a v a  2 s. co m*/
        pb.add(iconLbl, cc.xy(2, 6));
        pb.add(pb0.getPanel(), cc.xy(2, 8));

        starterPane = new SimpleDescPane(title, this, pb.getPanel());

        popResourceBundle();
    }
    return starterPane;
}

From source file:UI.SecurityDashboard.java

private void performMetric7(MainViewPanel mvp) {
    Metric7 metric7 = new Metric7();

    JPanel graphPanel7 = new JPanel();
    graphPanel7.setLayout(new BorderLayout());
    graphPanel7.add(metric7.run(), BorderLayout.NORTH);

    PortPanel.setLayout(new BorderLayout());
    JTextArea header = new JTextArea(
            "\nOpen ports that are not being used by a secure service on a system may result in a malicious "
                    + "attacker gaining access to the network. By listing all open ports on each device, this can aid in ensuring that ports "
                    + "currently open are know of.\n");
    header.setLineWrap(true);/*from  w ww.j  av a 2s  . c o  m*/
    header.setWrapStyleWord(true);
    header.setEditable(false);
    PortPanel.add(header, BorderLayout.NORTH);
    PortPanel.add(graphPanel7, BorderLayout.CENTER);

    Metric7Panel.setBackground(Color.WHITE);
    Metric7Panel.setLayout(new BorderLayout());

    Font titleFont = new Font("Calibri", Font.BOLD, 27);
    JLabel portTitleLabel = new JLabel("              Open Ports");
    portTitleLabel.setFont(titleFont);

    Metric7Panel.add(portTitleLabel, BorderLayout.NORTH);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    JLabel emptyLabel = new JLabel(" ");
    JLabel emptyLabel2 = new JLabel(" ");
    JLabel emptyLabel3 = new JLabel("   ");
    JLabel emptyLabel4 = new JLabel("   ");

    emptyLabel.setBackground(Color.white);
    emptyLabel2.setBackground(Color.white);
    emptyLabel3.setBackground(Color.white);
    emptyLabel4.setBackground(Color.white);

    emptyLabel.setOpaque(true);
    emptyLabel2.setOpaque(true);
    emptyLabel3.setOpaque(true);
    emptyLabel4.setOpaque(true);

    p.add(emptyLabel, BorderLayout.NORTH);
    p.add(emptyLabel3, BorderLayout.WEST);
    p.add(mvp.getPanel7(metric7), BorderLayout.CENTER);
    p.add(emptyLabel4, BorderLayout.EAST);
    p.add(emptyLabel2, BorderLayout.SOUTH);
    Metric7Panel.add(p, BorderLayout.CENTER);
    Metric7Panel.setBackground(Color.white);
}

From source file:UI.SecurityDashboard.java

private void performMetric9() {
    GZDecompression m9 = new GZDecompression();
    String[][] counts = m9.getMetric9();

    Font titleFont = new Font("Calibri", Font.BOLD, 27);
    JLabel logAuditTitleLabel = new JLabel("                Log Audit");
    logAuditTitleLabel.setFont(titleFont);

    AreaChart areaChart = new AreaChart(m9.getLogCount(), m9.getSuccessCount(), m9.getFailCount());
    ChartPanel thisChart = areaChart.drawAreaChart();
    thisChart.setBackground(Color.white);

    thisChart.addChartMouseListener(new ChartMouseListener() {

        @Override//from w w w  . j a v  a 2s  .  c  o  m
        public void chartMouseClicked(ChartMouseEvent cme) {
            dashboardTabs.setSelectedIndex(9);
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });

    Metric9Panel.setBackground(Color.WHITE);
    Metric9Panel.setLayout(new BorderLayout());
    Metric9Panel.add(logAuditTitleLabel, BorderLayout.NORTH);
    Metric9Panel.add(thisChart, BorderLayout.CENTER);
    Metric9Panel.setEnabled(false);

    String[] columns = { "Log Failure" };
    JTable table = new JTable(counts, columns);
    table.setShowHorizontalLines(true);
    table.setRowHeight(40);
    table.setEnabled(false);
    JScrollPane tableScrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    AuditPanel.setLayout(new BorderLayout());
    JTextArea header = new JTextArea(
            "\nThrough the analysis of security logs, this page will show an audit of the attack attempts and "
                    + "security breaches. The logs provide critical information related to system events that can be used to track suspicicous "
                    + "activities.\n");
    header.setLineWrap(true);
    header.setWrapStyleWord(true);
    header.setEditable(false);
    AuditPanel.add(header, BorderLayout.NORTH);
    AuditPanel.add(tableScrollPane, BorderLayout.CENTER);
}

From source file:UI.SecurityDashboard.java

private void performMetric1(MainViewPanel mvp) {
    Metric1 metric1 = new Metric1();

    JPanel graphPanel1 = new JPanel();
    graphPanel1.setLayout(new BorderLayout());
    graphPanel1.add(metric1.run(), BorderLayout.NORTH);

    DevicePanel.setLayout(new BorderLayout());
    JTextArea header = new JTextArea(
            "\nThe Network Vulnerability test scans the entire network for all existing vulnerabilities that may "
                    + "exist within and display the vulnerabilities (if any) for each device (computer, tablet or mobile device).\n");
    //header.setLineWrap(true);
    //header.setWrapStyleWord(true);
    header.setEditable(false);/*from w w w.  j a v  a2  s  .c  om*/
    header.setMaximumSize(new Dimension(DevicePanel.getWidth(), 3));
    DevicePanel.add(header, BorderLayout.NORTH);
    DevicePanel.add(graphPanel1, BorderLayout.CENTER);

    ChartPanel firstPanel = mvp.getPanel1(metric1);

    firstPanel.addChartMouseListener(new ChartMouseListener() {

        @Override
        public void chartMouseClicked(ChartMouseEvent cme) {
            dashboardTabs.setSelectedIndex(1);
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });
    Metric1Panel.setLayout(new BorderLayout());
    Font titleFont = new Font("Calibri", Font.BOLD, 27);
    JLabel vulnerabilitiesTitleLabel = new JLabel("              Vulnerabilities");
    vulnerabilitiesTitleLabel.setFont(titleFont);
    Metric1Panel.add(vulnerabilitiesTitleLabel, BorderLayout.PAGE_START);

    Font devCountFont = new Font("Calibri", Font.BOLD, 16);
    String devCount = "  Device Count: " + metric1.deviceCount;
    JLabel devCountLabel = new JLabel(devCount);
    devCountLabel.setFont(devCountFont);
    Metric1Panel.add(devCountLabel, BorderLayout.SOUTH);
    Metric1Panel.add(firstPanel, BorderLayout.CENTER);
    Metric1Panel.setBackground(Color.white);
    Metric1Panel.setEnabled(false);
}

From source file:edu.ku.brc.specify.ui.AppBase.java

/**
 * Shows the About dialog./*  ww  w .  ja  va2s.  c  om*/
 */
public void doAbout() {
    AppContextMgr acm = AppContextMgr.getInstance();
    boolean hasContext = acm.hasContext();

    int baseNumRows = 9;
    String serverName = AppPreferences.getLocalPrefs().get("login.servers_selected", null);
    if (serverName != null) {
        baseNumRows++;
    }

    CellConstraints cc = new CellConstraints();
    PanelBuilder infoPB = new PanelBuilder(new FormLayout("p,6px,f:p:g",
            "p,4px,p,4px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", baseNumRows)));

    JLabel iconLabel = new JLabel(IconManager.getIcon("SpecifyLargeIcon"), SwingConstants.CENTER); //$NON-NLS-1$
    PanelBuilder iconPB = new PanelBuilder(new FormLayout("p", "20px,t:p,f:p:g"));
    iconPB.add(iconLabel, cc.xy(1, 2));

    if (hasContext) {
        DBTableIdMgr tableMgr = DBTableIdMgr.getInstance();
        boolean hasReged = !RegisterSpecify.isAnonymous() && RegisterSpecify.hasInstitutionRegistered();

        int y = 1;
        infoPB.addSeparator(getResourceString("Specify.SYS_INFO"), cc.xyw(1, y, 3));
        y += 2;

        JLabel lbl = UIHelper.createLabel(databaseName);
        infoPB.add(UIHelper.createI18NFormLabel("Specify.DB"), cc.xy(1, y));
        infoPB.add(lbl, cc.xy(3, y));
        y += 2;
        lbl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    openLocalPrefs();
                }
            }
        });

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Institution.getClassTableId())),
                cc.xy(1, y));
        infoPB.add(lbl = UIHelper.createLabel(acm.getClassObject(Institution.class).getName()), cc.xy(3, y));
        y += 2;
        lbl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    openRemotePrefs();
                }
            }
        });
        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Division.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Division.class).getName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Discipline.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Discipline.class).getName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Collection.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Collection.class).getCollectionName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createI18NFormLabel("Specify.BLD"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(appBuildVersion), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createI18NFormLabel("Specify.REG"), cc.xy(1, y));
        infoPB.add(UIHelper.createI18NLabel(hasReged ? "Specify.HASREG" : "Specify.NOTREG"), cc.xy(3, y));
        y += 2;

        String isaNumber = RegisterSpecify.getISANumber();
        infoPB.add(UIHelper.createI18NFormLabel("Specify.ISANUM"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(StringUtils.isNotEmpty(isaNumber) ? isaNumber : ""), cc.xy(3, y));
        y += 2;

        if (serverName != null) {
            infoPB.add(UIHelper.createI18NFormLabel("Specify.SERVER"), cc.xy(1, y));
            infoPB.add(UIHelper.createLabel(StringUtils.isNotEmpty(serverName) ? serverName : ""), cc.xy(3, y));
            y += 2;
        }

        if (StringUtils.contains(DBConnection.getInstance().getConnectionStr(), "mysql")) {
            Vector<Object[]> list = BasicSQLUtils.query("select version() as ve");
            if (list != null && list.size() > 0) {
                infoPB.add(UIHelper.createFormLabel("MySQL Version"), cc.xy(1, y));
                infoPB.add(UIHelper.createLabel(list.get(0)[0].toString()), cc.xy(3, y));
                y += 2;
            }
        }

        infoPB.add(UIHelper.createFormLabel("Java Version"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(System.getProperty("java.version")), cc.xy(3, y));
        y += 2;
    }

    String txt = getAboutText(appName, appVersion);
    JLabel txtLbl = createLabel(txt);
    txtLbl.setFont(UIRegistry.getDefaultFont());

    final JEditorPane txtPane = new JEditorPane("text/html", txt);
    txtPane.setEditable(false);
    txtPane.setBackground(new JPanel().getBackground());

    PanelBuilder pb = new PanelBuilder(new FormLayout("p,20px,f:min(400px;p):g,10px,8px,10px,p:g", "f:p:g"));

    pb.add(iconPB.getPanel(), cc.xy(1, 1));
    pb.add(txtPane, cc.xy(3, 1));
    Color bg = getBackground();

    if (hasContext) {
        pb.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xy(5, 1));
        pb.add(infoPB.getPanel(), cc.xy(7, 1));
    }

    pb.setDefaultDialogBorder();

    String title = getResourceString("Specify.ABOUT");//$NON-NLS-1$
    CustomDialog aboutDlg = new CustomDialog(topFrame, title + " " + appName, true, CustomDialog.OK_BTN, //$NON-NLS-1$
            pb.getPanel());
    String okLabel = getResourceString("Specify.CLOSE");//$NON-NLS-1$
    aboutDlg.setOkLabel(okLabel);

    aboutDlg.createUI();
    aboutDlg.pack();

    // for some strange reason I can't get the dialog to size itself correctly
    Dimension size = aboutDlg.getSize();
    size.height += 120;
    aboutDlg.setSize(size);

    txtPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent event) {
            if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                try {
                    AttachmentUtils.openURI(event.getURL().toURI());

                } catch (Exception e) {
                    edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                }
            }
        }
    });

    UIHelper.centerAndShow(aboutDlg);
}

From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java

private JPanel buildCabecera(final String label_cabecera, final int textfieldSize, final Icon icono,
        final String titulo, final String icono_seleccionado) {
    JLabel title = new JLabel(titulo, icono, SwingConstants.LEFT);
    title.setFont(LogicConstants.deriveBoldFont(12f));
    JPanel resultado = new JPanel(new BorderLayout(2, 2));
    resultado.setOpaque(false);/*from www .j  a  v  a 2s .  co m*/
    resultado.add(title, BorderLayout.NORTH);
    JPanel cabecera = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    cabecera.setOpaque(false);

    JLabel nombre = new JLabel(label_cabecera, JLabel.RIGHT);
    gbc.gridx = 0;
    gbc.gridy = 0;
    cabecera.add(nombre, gbc);
    textfieldCabecera.setColumns(textfieldSize);
    textfieldCabecera.getDocument().addDocumentListener(changeListener);
    nombre.setLabelFor(textfieldCabecera);
    gbc.gridx++;
    cabecera.add(textfieldCabecera, gbc);

    if (icono_seleccionado != null) {
        JLabel nombre2 = new JLabel("Icono:", JLabel.RIGHT);
        gbc.gridx = 0;
        gbc.gridy++;
        cabecera.add(nombre2, gbc);
        ((DefaultComboBoxModel) iconos.getModel()).removeAllElements();
        for (String icon : FlotaConsultas.getAllIcons("/images/" + LogicConstants.DIRECTORIO_ICONOS_FLOTAS)) {
            ((DefaultComboBoxModel) iconos.getModel()).addElement(icon);
        }
        for (ActionListener l : iconos.getActionListeners()) {
            iconos.removeActionListener(l);
        }
        iconos.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                cambios = true;
                if (iconos.getSelectedItem() != null) {
                    i.setIcon(LogicConstants.getIcon(LogicConstants.DIRECTORIO_ICONOS_FLOTAS
                            + iconos.getSelectedItem().toString() + "_flota_preview"));
                }
                i.updateUI();
            }
        });
        iconos.setSelectedItem(icono_seleccionado);
        if (iconos.getSelectedIndex() == -1 || i.getIcon() == null) {
            if (iconos.getModel().getSize() > 0)
                iconos.setSelectedIndex(0);
        }
        cambios = false;
        nombre2.setLabelFor(iconos);
        gbc.gridx++;
        gbc.anchor = GridBagConstraints.WEST;
        cabecera.add(iconos, gbc);

        gbc.gridheight = 2;
        gbc.gridx = 2;
        gbc.gridy = 0;
        gbc.insets = new Insets(2, 10, 2, 10);
        gbc.ipadx = 5;
        gbc.ipady = 5;
        i.setBorder(BorderFactory.createLineBorder(Color.black));
        cabecera.add(i, gbc);
    }

    resultado.add(cabecera, BorderLayout.CENTER);
    resultado.setBorder(new EmptyBorder(15, 15, 15, 15));
    return resultado;
}

From source file:es.emergya.ui.gis.popups.ConsultaHistoricos.java

private JPanel getCabecera() {
    JPanel cabecera = new JPanel(new FlowLayout(FlowLayout.LEFT));
    cabecera.setOpaque(false);//  w ww. j a v  a  2 s  . c  o  m
    JLabel titulo = new JLabel("Consulta de Posiciones GPS en el Histrico");
    titulo.setFont(LogicConstants.deriveBoldFont(12.0f));
    titulo.setIcon(LogicConstants.getIcon("tittleventana_icon_consultahistorico"));
    cabecera.add(titulo);
    return cabecera;
}

From source file:lcmc.common.ui.EditableInfo.java

/** Returns a more panel with "more options are available" message. */
public final JPanel getMoreOptionsPanel(final int width) {
    final JLabel l = new JLabel(Tools.getString("EditableInfo.MoreOptions"));
    final Font font = l.getFont();
    final String name = font.getFontName();
    final int style = Font.ITALIC;
    final int size = font.getSize();
    l.setFont(new Font(name, style, size - 3));

    moreOptionsPanel.setBackground(Browser.PANEL_BACKGROUND);
    moreOptionsPanel.add(l);/*w  w  w .  j  ava 2  s  .  c  o m*/
    final Dimension d = moreOptionsPanel.getPreferredSize();
    d.width = width;
    moreOptionsPanel.setMaximumSize(d);
    return moreOptionsPanel;
}

From source file:UI.SecurityDashboard.java

private void performMetric4(MainViewPanel mvp) {
    Metric4 metric4 = new Metric4();

    JPanel graphPanel4 = new JPanel();
    graphPanel4.setLayout(new BorderLayout());
    metric4.run();//from  w  w w  .  j av  a 2s  . c  o m
    graphPanel4.add(mvp.getPanel4(metric4), BorderLayout.CENTER);

    MalwarePanel.setLayout(new BorderLayout());
    JTextArea header = new JTextArea(
            "\nThe Malware detection will scan for viruses, trojans, and worms that may have affected a device.\n");
    header.setLineWrap(true);
    header.setWrapStyleWord(true);
    header.setEditable(false);
    MalwarePanel.add(header, BorderLayout.NORTH);
    if (metric4.getTotalCount() == 0) {
        Font noMalwareFont = new Font("Calibri", Font.BOLD, 40);
        JLabel noMalwareLabel = new JLabel(
                "                                                    No Malware Detected");
        noMalwareLabel.setFont(noMalwareFont);
        noMalwareLabel.setPreferredSize(new Dimension(WIDTH, 100));
        graphPanel4.add(noMalwareLabel, BorderLayout.NORTH);
        JPanel emptyPanel = new JPanel();
        emptyPanel.setPreferredSize(new Dimension(50, 200));
        emptyPanel.setOpaque(true);
        graphPanel4.add(emptyPanel, BorderLayout.SOUTH);
    }
    MalwarePanel.add(graphPanel4, BorderLayout.CENTER);
    ChartPanel fourthPanel = mvp.getPanel4(metric4);

    fourthPanel.addChartMouseListener(new ChartMouseListener() {

        @Override
        public void chartMouseClicked(ChartMouseEvent cme) {
            dashboardTabs.setSelectedIndex(4);
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });

    Metric4Panel.setLayout(new BorderLayout());
    Font titleFont = new Font("Calibri", Font.BOLD, 27);
    JLabel malwareTitleLabel = new JLabel("    Malware Detection");
    malwareTitleLabel.setFont(titleFont);
    Metric4Panel.add(malwareTitleLabel, BorderLayout.PAGE_START);
    Metric4Panel.add(fourthPanel, BorderLayout.CENTER);
    if (metric4.getTotalCount() == 0) {
        Font noMalwareFont = new Font("Calibri", Font.BOLD, 20);
        JLabel noMalwareLabel = new JLabel("       No Malware Detected");
        noMalwareLabel.setFont(noMalwareFont);
        Metric4Panel.add(noMalwareLabel, BorderLayout.SOUTH);
    }
    Metric4Panel.setBackground(Color.white);
}