Search in sources :

Example 1 with PeakSummaryComponent

use of net.sf.mzmine.util.components.PeakSummaryComponent in project mzmine2 by mzmine.

the class ScatterPlotChart method getCustomToolTipComponent.

public JComponent getCustomToolTipComponent(MouseEvent event) {
    String index = this.getToolTipText(event);
    if (index == null) {
        return null;
    }
    String[] indexSplit = index.split(":");
    int series = Integer.parseInt(indexSplit[0]);
    int item = Integer.parseInt(indexSplit[1]);
    PeakListRow row = mainDataSet.getRow(series, item);
    PeakSummaryComponent newSummary = new PeakSummaryComponent(row, peakList.getRawDataFiles(), true, true, true, true, false, ComponentToolTipManager.bg);
    double xValue = mainDataSet.getXValue(series, item);
    double yValue = mainDataSet.getYValue(series, item);
    newSummary.setRatio(xValue, yValue);
    return newSummary;
}
Also used : PeakListRow(net.sf.mzmine.datamodel.PeakListRow) PeakSummaryComponent(net.sf.mzmine.util.components.PeakSummaryComponent)

Example 2 with PeakSummaryComponent

use of net.sf.mzmine.util.components.PeakSummaryComponent in project mzmine2 by mzmine.

the class PeakListTable method getCustomToolTipComponent.

public JComponent getCustomToolTipComponent(MouseEvent event) {
    JComponent component = null;
    String text = this.getToolTipText(event);
    if (text == null) {
        return null;
    }
    if (text.contains(ComponentToolTipManager.CUSTOM)) {
        String[] values = text.split("-");
        int myID = Integer.parseInt(values[1].trim());
        for (PeakListRow row : peakList.getRows()) {
            if (row.getID() == myID) {
                component = new PeakSummaryComponent(row, peakList.getRawDataFiles(), true, false, false, true, false, ComponentToolTipManager.bg);
                break;
            }
        }
    } else {
        text = "<html>" + text.replace("\n", "<br>") + "</html>";
        JLabel label = new JLabel(text);
        label.setFont(UIManager.getFont("ToolTip.font"));
        JPanel panel = new JPanel();
        panel.setBackground(ComponentToolTipManager.bg);
        panel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
        panel.add(label);
        component = panel;
    }
    return component;
}
Also used : JPanel(javax.swing.JPanel) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) PeakSummaryComponent(net.sf.mzmine.util.components.PeakSummaryComponent)

Aggregations

PeakListRow (net.sf.mzmine.datamodel.PeakListRow)2 PeakSummaryComponent (net.sf.mzmine.util.components.PeakSummaryComponent)2 JComponent (javax.swing.JComponent)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1