Search in sources :

Example 1 with CustomTextPane

use of net.sf.mzmine.framework.CustomTextPane in project mzmine2 by mzmine.

the class SpectralMatchPanel method extractMetaData.

private JPanel extractMetaData(String title, SpectralDBEntry entry, DBEntryField[] other) {
    JPanel panelOther = new JPanel();
    panelOther.setLayout(new BoxLayout(panelOther, BoxLayout.Y_AXIS));
    panelOther.setBackground(Color.WHITE);
    panelOther.setAlignmentY(Component.TOP_ALIGNMENT);
    panelOther.setAlignmentX(Component.TOP_ALIGNMENT);
    for (DBEntryField db : other) {
        Object o = entry.getField(db).orElse("N/A");
        if (!o.equals("N/A")) {
            CustomTextPane textPane = new CustomTextPane(true);
            textPane.setText(db.toString() + ": " + o.toString());
            panelOther.add(textPane);
        }
    }
    JLabel otherInfo = new JLabel(title);
    otherInfo.setFont(headerFont);
    JPanel pn = new JPanel(new BorderLayout());
    pn.setBackground(Color.WHITE);
    pn.add(otherInfo, BorderLayout.NORTH);
    pn.add(panelOther, BorderLayout.CENTER);
    JPanel pn1 = new JPanel(new BorderLayout());
    pn1.add(pn, BorderLayout.NORTH);
    pn1.setBackground(Color.WHITE);
    return pn1;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) DBEntryField(net.sf.mzmine.util.spectraldb.entry.DBEntryField) CustomTextPane(net.sf.mzmine.framework.CustomTextPane)

Aggregations

BorderLayout (java.awt.BorderLayout)1 BoxLayout (javax.swing.BoxLayout)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 CustomTextPane (net.sf.mzmine.framework.CustomTextPane)1 DBEntryField (net.sf.mzmine.util.spectraldb.entry.DBEntryField)1