Example usage for java.awt.event MouseEvent getPoint

List of usage examples for java.awt.event MouseEvent getPoint

Introduction

In this page you can find the example usage for java.awt.event MouseEvent getPoint.

Prototype

public Point getPoint() 

Source Link

Document

Returns the x,y position of the event relative to the source component.

Usage

From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java

public void mousePressed(MouseEvent e) {
    if (MouseUtils.isPopupTrigger(e)) {
        theCanvas.enforceSelection(e.getPoint());
        createPopupMenu().show(theCanvas, e.getX(), e.getY());
    }/* w w w. j  a  va 2 s.c  o m*/
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java

public void mouseReleased(MouseEvent e) {
    if (MouseUtils.isPopupTrigger(e)) {
        theCanvas.enforceSelection(e.getPoint());
        createPopupMenu().show(theCanvas, e.getX(), e.getY());
    }/*from   w  w w  .j av a2 s . co m*/
}

From source file:com.tascape.qa.th.android.driver.App.java

/**
 * The method starts a GUI to let an user inspect element tree and take screenshot when the user is interacting
 * with the app-under-test manually. Please make sure to set timeout long enough for manual interaction.
 *
 * @param timeoutMinutes timeout in minutes to fail the manual steps
 *
 * @throws Exception if case of error//from w  w  w. j a v  a 2  s .  co  m
 */
public void interactManually(int timeoutMinutes) throws Exception {
    LOG.info("Start manual UI interaction");
    long end = System.currentTimeMillis() + timeoutMinutes * 60000L;

    AtomicBoolean visible = new AtomicBoolean(true);
    AtomicBoolean pass = new AtomicBoolean(false);
    String tName = Thread.currentThread().getName() + "m";
    SwingUtilities.invokeLater(() -> {
        JDialog jd = new JDialog((JFrame) null, "Manual Device UI Interaction - " + device.getProductDetail());
        jd.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

        JPanel jpContent = new JPanel(new BorderLayout());
        jd.setContentPane(jpContent);
        jpContent.setPreferredSize(new Dimension(1088, 828));
        jpContent.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

        JPanel jpInfo = new JPanel();
        jpContent.add(jpInfo, BorderLayout.PAGE_START);
        jpInfo.setLayout(new BorderLayout());
        {
            JButton jb = new JButton("PASS");
            jb.setForeground(Color.green.darker());
            jb.setFont(jb.getFont().deriveFont(Font.BOLD));
            jpInfo.add(jb, BorderLayout.LINE_START);
            jb.addActionListener(event -> {
                pass.set(true);
                jd.dispose();
                visible.set(false);
            });
        }
        {
            JButton jb = new JButton("FAIL");
            jb.setForeground(Color.red);
            jb.setFont(jb.getFont().deriveFont(Font.BOLD));
            jpInfo.add(jb, BorderLayout.LINE_END);
            jb.addActionListener(event -> {
                pass.set(false);
                jd.dispose();
                visible.set(false);
            });
        }

        JLabel jlTimeout = new JLabel("xxx seconds left", SwingConstants.CENTER);
        jpInfo.add(jlTimeout, BorderLayout.CENTER);
        jpInfo.add(jlTimeout, BorderLayout.CENTER);
        new SwingWorker<Long, Long>() {
            @Override
            protected Long doInBackground() throws Exception {
                while (System.currentTimeMillis() < end) {
                    Thread.sleep(1000);
                    long left = (end - System.currentTimeMillis()) / 1000;
                    this.publish(left);
                }
                return 0L;
            }

            @Override
            protected void process(List<Long> chunks) {
                Long l = chunks.get(chunks.size() - 1);
                jlTimeout.setText(l + " seconds left");
                if (l < 850) {
                    jlTimeout.setForeground(Color.red);
                }
            }
        }.execute();

        JPanel jpResponse = new JPanel(new BorderLayout());
        JPanel jpProgress = new JPanel(new BorderLayout());
        jpResponse.add(jpProgress, BorderLayout.PAGE_START);

        JTextArea jtaJson = new JTextArea();
        jtaJson.setEditable(false);
        jtaJson.setTabSize(4);
        Font font = jtaJson.getFont();
        jtaJson.setFont(new Font("Courier New", font.getStyle(), font.getSize()));

        JTree jtView = new JTree();

        JTabbedPane jtp = new JTabbedPane();
        jtp.add("tree", new JScrollPane(jtView));
        jtp.add("json", new JScrollPane(jtaJson));

        jpResponse.add(jtp, BorderLayout.CENTER);

        JPanel jpScreen = new JPanel();
        jpScreen.setMinimumSize(new Dimension(200, 200));
        jpScreen.setLayout(new BoxLayout(jpScreen, BoxLayout.PAGE_AXIS));
        JScrollPane jsp1 = new JScrollPane(jpScreen);
        jpResponse.add(jsp1, BorderLayout.LINE_START);

        JPanel jpJs = new JPanel(new BorderLayout());
        JTextArea jtaJs = new JTextArea();
        jpJs.add(new JScrollPane(jtaJs), BorderLayout.CENTER);

        JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jpResponse, jpJs);
        jSplitPane.setResizeWeight(0.88);
        jpContent.add(jSplitPane, BorderLayout.CENTER);

        JPanel jpLog = new JPanel();
        jpLog.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
        jpLog.setLayout(new BoxLayout(jpLog, BoxLayout.LINE_AXIS));

        JCheckBox jcbTap = new JCheckBox("Enable Click", null, false);
        jpLog.add(jcbTap);
        jpLog.add(Box.createHorizontalStrut(8));

        JButton jbLogUi = new JButton("Log Screen");
        jpResponse.add(jpLog, BorderLayout.PAGE_END);
        {
            jpLog.add(jbLogUi);
            jbLogUi.addActionListener((ActionEvent event) -> {
                jtaJson.setText("waiting for screenshot...");
                Thread t = new Thread(tName) {
                    @Override
                    public void run() {
                        LOG.debug("\n\n");
                        try {
                            WindowHierarchy wh = device.loadWindowHierarchy();
                            jtView.setModel(getModel(wh));

                            jtaJson.setText("");
                            jtaJson.append(wh.root.toJson().toString(2));
                            jtaJson.append("\n");

                            File png = device.takeDeviceScreenshot();
                            BufferedImage image = ImageIO.read(png);

                            int w = device.getDisplayWidth();
                            int h = device.getDisplayHeight();

                            BufferedImage resizedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
                            Graphics2D g2 = resizedImg.createGraphics();
                            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                                    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
                            g2.drawImage(image, 0, 0, w, h, null);
                            g2.dispose();

                            JLabel jLabel = new JLabel(new ImageIcon(resizedImg));
                            jpScreen.removeAll();
                            jsp1.setPreferredSize(new Dimension(w + 30, h));
                            jpScreen.add(jLabel);

                            jLabel.addMouseListener(new MouseAdapter() {
                                @Override
                                public void mouseClicked(MouseEvent e) {
                                    LOG.debug("clicked at {},{}", e.getPoint().getX(), e.getPoint().getY());
                                    if (jcbTap.isSelected()) {
                                        device.click(e.getPoint().x, e.getPoint().y);
                                        device.waitForIdle();
                                        jbLogUi.doClick();
                                    }
                                }
                            });
                        } catch (Exception ex) {
                            LOG.error("Cannot log screen", ex);
                            jtaJson.append("Cannot log screen");
                        }
                        jtaJson.append("\n\n\n");
                        LOG.debug("\n\n");

                        jd.setSize(jd.getBounds().width + 1, jd.getBounds().height + 1);
                        jd.setSize(jd.getBounds().width - 1, jd.getBounds().height - 1);
                    }
                };
                t.start();
            });
        }
        jpLog.add(Box.createHorizontalStrut(38));
        {
            JButton jbLogMsg = new JButton("Log Message");
            jpLog.add(jbLogMsg);
            JTextField jtMsg = new JTextField(10);
            jpLog.add(jtMsg);
            jtMsg.addFocusListener(new FocusListener() {
                @Override
                public void focusLost(final FocusEvent pE) {
                }

                @Override
                public void focusGained(final FocusEvent pE) {
                    jtMsg.selectAll();
                }
            });
            jtMsg.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(java.awt.event.KeyEvent e) {
                    if (e.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
                        jbLogMsg.doClick();
                    }
                }
            });
            jbLogMsg.addActionListener(event -> {
                Thread t = new Thread(tName) {
                    @Override
                    public void run() {
                        String msg = jtMsg.getText();
                        if (StringUtils.isNotBlank(msg)) {
                            LOG.info("{}", msg);
                            jtMsg.selectAll();
                        }
                    }
                };
                t.start();
                try {
                    t.join();
                } catch (InterruptedException ex) {
                    LOG.error("Cannot take screenshot", ex);
                }
                jtMsg.requestFocus();
            });
        }
        jpLog.add(Box.createHorizontalStrut(38));
        {
            JButton jbClear = new JButton("Clear");
            jpLog.add(jbClear);
            jbClear.addActionListener(event -> {
                jtaJson.setText("");
            });
        }

        JPanel jpAction = new JPanel();
        jpContent.add(jpAction, BorderLayout.PAGE_END);
        jpAction.setLayout(new BoxLayout(jpAction, BoxLayout.LINE_AXIS));
        jpJs.add(jpAction, BorderLayout.PAGE_END);

        jd.pack();
        jd.setVisible(true);
        jd.setLocationRelativeTo(null);

        jbLogUi.doClick();
    });

    while (visible.get()) {
        if (System.currentTimeMillis() > end) {
            LOG.error("Manual UI interaction timeout");
            break;
        }
        Thread.sleep(500);
    }

    if (pass.get()) {
        LOG.info("Manual UI Interaction returns PASS");
    } else {
        Assert.fail("Manual UI Interaction returns FAIL");
    }
}

From source file:net.sf.jabref.gui.MainTableSelectionListener.java

@Override
public void mouseReleased(MouseEvent e) {
    // First find the column and row on which the user has clicked.
    final int col = table.columnAtPoint(e.getPoint());
    final int row = table.rowAtPoint(e.getPoint());

    // Check if the user has clicked on an icon cell to open url or pdf.
    final String[] iconType = table.getIconTypeForColumn(col);

    // Check if the user has right-clicked. If so, open the right-click menu.
    if (e.isPopupTrigger() || (e.getButton() == MouseEvent.BUTTON3)) {
        if (iconType == null) {
            processPopupTrigger(e, row);
        } else {/*  w  ww.  ja v  a 2 s. c o  m*/
            showIconRightClickMenu(e, row, iconType);
        }
    }
}

From source file:net.sf.jabref.gui.maintable.MainTableSelectionListener.java

@Override
public void mouseClicked(MouseEvent e) {

    // First find the column on which the user has clicked.
    final int row = table.rowAtPoint(e.getPoint());

    // A double click on an entry should open the entry's editor.
    if (e.getClickCount() == 2) {
        BibEntry toShow = tableRows.get(row);
        editSignalled(toShow);//  ww w .  ja  v a2 s.c o  m
        return;
    }

    final int col = table.columnAtPoint(e.getPoint());
    // get the MainTableColumn which is currently visible at col
    int modelIndex = table.getColumnModel().getColumn(col).getModelIndex();
    MainTableColumn modelColumn = table.getMainTableColumn(modelIndex);

    // Workaround for Windows. Right-click is not popup trigger on mousePressed, but
    // on mouseReleased. Therefore we need to avoid taking action at this point, because
    // action will be taken when the button is released:
    if (OS.WINDOWS && (modelColumn.isIconColumn()) && (e.getButton() != MouseEvent.BUTTON1)) {
        return;
    }

    // Check if the clicked colum is a specialfield column
    if (modelColumn.isIconColumn() && (SpecialFieldsUtils.isSpecialField(modelColumn.getColumnName()))) {
        // handle specialfield
        handleSpecialFieldLeftClick(e, modelColumn.getColumnName());
    } else if (modelColumn.isIconColumn()) { // left click on icon field

        Object value = table.getValueAt(row, col);
        if (value == null) {
            return; // No icon here, so we do nothing.
        }

        final BibEntry entry = tableRows.get(row);

        final List<String> fieldNames = modelColumn.getBibtexFields();

        // Open it now. We do this in a thread, so the program won't freeze during the wait.
        JabRefExecutorService.INSTANCE.execute(() -> {
            panel.output(Localization.lang("External viewer called") + '.');
            // check for all field names whether a link is present
            // (is relevant for combinations such as "url/doi")
            for (String fieldName : fieldNames) {
                // Check if field is present, if not skip this field
                if (entry.hasField(fieldName)) {
                    String link = entry.getFieldOptional(fieldName).get();

                    // See if this is a simple file link field, or if it is a file-list
                    // field that can specify a list of links:
                    if (fieldName.equals(FieldName.FILE)) {

                        // We use a FileListTableModel to parse the field content:
                        FileListTableModel fileList = new FileListTableModel();
                        fileList.setContent(link);

                        FileListEntry flEntry = null;
                        // If there are one or more links of the correct type, open the first one:
                        if (modelColumn.isFileFilter()) {
                            for (int i = 0; i < fileList.getRowCount(); i++) {
                                if (fileList.getEntry(i).type.toString().equals(modelColumn.getColumnName())) {
                                    flEntry = fileList.getEntry(i);
                                    break;
                                }
                            }
                        } else if (fileList.getRowCount() > 0) {
                            //If there are no file types specified open the first file
                            flEntry = fileList.getEntry(0);
                        }
                        if (flEntry != null) {
                            ExternalFileMenuItem item = new ExternalFileMenuItem(panel.frame(), entry, "",
                                    flEntry.link, flEntry.type.get().getIcon(), panel.getBibDatabaseContext(),
                                    flEntry.type);
                            boolean success = item.openLink();
                            if (!success) {
                                panel.output(Localization.lang("Unable to open link."));
                            }
                        }
                    } else {
                        try {
                            JabRefDesktop.openExternalViewer(panel.getBibDatabaseContext(), link, fieldName);
                        } catch (IOException ex) {
                            panel.output(Localization.lang("Unable to open link."));
                            LOGGER.info("Unable to open link", ex);
                        }
                    }
                    break; // only open the first link
                }
            }
        });
    } else if (modelColumn.getBibtexFields().contains(FieldName.CROSSREF)) { // Clicking on crossref column
        tableRows.get(row).getFieldOptional(FieldName.CROSSREF).ifPresent(crossref -> panel.getDatabase()
                .getEntryByKey(crossref).ifPresent(entry -> panel.highlightEntry(entry)));
    }
}

From source file:com.anrisoftware.prefdialog.miscswing.components.menu.PopupMenuComponent.java

private void createComponentMouseListener() {
    componentMouseListener = new MouseAdapter() {

        @Override//ww w  .ja  v  a 2s . c  o  m
        public void mousePressed(MouseEvent e) {
            if (!mouseFilter.allow(e)) {
                return;
            }
            if (alreadyShowingPopup) {
                showPopup = false;
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            if (!mouseFilter.allow(e)) {
                return;
            }
            if (showPopup) {
                showPopup(e.getPoint());
            } else {
                showPopup = true;
            }
        }

    };
}

From source file:net.sourceforge.happybank.main.BankMain.java

private void initComponents() {
    frame = new javax.swing.JFrame();
    menuBar = new javax.swing.JMenuBar();
    menuFile = new javax.swing.JMenu();
    menuItemExit = new javax.swing.JMenuItem();
    menuActions = new javax.swing.JMenu();
    menuItemView = new javax.swing.JMenuItem();
    separator2 = new javax.swing.JSeparator();
    menuHelp = new javax.swing.JMenu();
    separator4 = new javax.swing.JSeparator();
    menuItemAbout = new javax.swing.JMenuItem();
    accountEntries = new javax.swing.JTable();
    accountModel = new AccountTableModel();

    /*/*from   w  w  w  .  ja v  a 2  s  .  c om*/
     * File menu
     */
    menuFile.setMnemonic('F');
    menuFile.setText("File");
    // - Exit option
    menuItemExit.setMnemonic('X');
    menuItemExit.setText("Exit");
    menuItemExit.setActionCommand("Exit");
    menuItemExit.addActionListener(new ActionHandler());
    menuFile.add(menuItemExit);
    menuBar.add(menuFile);

    // Actions menu
    menuActions.setMnemonic('A');
    menuActions.setText("Actions");
    // - View option
    menuItemView.setMnemonic('V');
    menuItemView
            .setAccelerator(KeyStroke.getKeyStroke('V', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menuItemView.setText("View");
    menuItemView.setActionCommand("View");
    menuItemView.addActionListener(new ActionHandler());
    menuActions.add(menuItemView);
    menuActions.add(separator2);

    // Help menu
    menuHelp.setMnemonic('H');
    menuHelp.setText("Help");
    // - About option
    menuHelp.add(separator4);
    menuItemAbout.setMnemonic('A');
    menuItemAbout.setText("About");
    menuItemAbout.setActionCommand("About");
    menuItemAbout.addActionListener(new ActionHandler());
    menuHelp.add(menuItemAbout);
    menuBar.add(menuHelp);

    /*
     * configure the TabListCellRenderer
     */
    accountEntries.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    accountEntries.setAutoCreateColumnsFromModel(false);
    accountEntries.setModel(accountModel);
    accountEntries.getTableHeader().setReorderingAllowed(false);
    accountEntries.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    accountEntries.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent evt) {
            // capture single click
            if (evt.getClickCount() == 1 && SwingUtilities.isLeftMouseButton(evt)) {
                // ignore
            }
            // capture double click
            if (evt.getClickCount() == 2) {
                // edit the account
                int row = accountEntries.rowAtPoint(evt.getPoint());
                accountEntries.setRowSelectionInterval(row, row);
                onViewAccount();
            }
        } // mouseClicked
    }); // MouseAdapter

    // set the column widths and alignment
    for (int k = 0; k < AccountTableModel.COLUMNS.length; k++) {
        TableCellEditor zipper = new DefaultCellEditor(new JTextField());
        DefaultTableCellRenderer textRenderer = new DefaultTableCellRenderer();
        textRenderer.setHorizontalAlignment(AccountTableModel.COLUMNS[k].cAlignment);
        TableColumn column = new TableColumn(k, AccountTableModel.COLUMNS[k].cWidth, textRenderer, zipper);
        accountEntries.addColumn(column);
    }

    // set the table header
    JTableHeader header = accountEntries.getTableHeader();
    header.setUpdateTableInRealTime(false);

    /*
     * create the selection area
     */
    accountPanel = new JPanel();
    accountPanel.setLayout(new BorderLayout());
    scrollPane = new JScrollPane(accountEntries);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setPreferredSize(new java.awt.Dimension(750, 300));
    accountPanel.add(scrollPane);
    frame.getContentPane().add(accountPanel, java.awt.BorderLayout.CENTER);

    /*
     * layout the frame
     */
    frame.setJMenuBar(menuBar);
    frame.setTitle(APP_NAME);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation(screenSize.width / 2 - 300, screenSize.height / 2 - 200);
    // add a listener for the close event
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            onExit();
        }
    });

    loadAccounts();
}

From source file:de.fhg.igd.mapviewer.BasicMapKit.java

/**
 * Creates a basic map kit//from   ww w  .ja v a 2s .c o m
 * 
 * @param cache the tile cache to use
 */
public BasicMapKit(TileCache cache) {
    super();

    this.cache = cache;

    getMiniMap().setPanEnabled(false);
    getMiniMap().setCursor(Cursor.getDefaultCursor());

    getZoomSlider().setCursor(Cursor.getDefaultCursor());
    getZoomInButton().setCursor(Cursor.getDefaultCursor());
    getZoomOutButton().setCursor(Cursor.getDefaultCursor());

    getMiniMap().addMouseListener(new MouseAdapter() {

        /**
         * @see MouseAdapter#mouseClicked(MouseEvent)
         */
        @Override
        public void mouseClicked(MouseEvent me) {
            getMainMap().setCenterPosition(getMiniMap().convertPointToGeoPosition(me.getPoint()));
        }

    });

    // create painter for map tools
    toolPainter = new MapToolPainter(getMainMap());

    customPainter = new CompoundPainter<JXMapViewer>();
    customPainter.setCacheable(false);

    mapPainter = new CompoundPainter<JXMapViewer>();
    mapPainter.setCacheable(false);

    painter = new CompoundPainter<JXMapViewer>();
    painter.setPainters(customPainter, toolPainter, mapPainter);
    painter.setCacheable(false);

    updatePainters();

    // register as state provider
    // GuiState.getInstance().registerStateProvider(this);
}

From source file:com.vgi.mafscaling.MafChartPanel.java

public void movePoint(MouseEvent event) {
    try {/*from w w  w  .  j a v  a  2  s. co  m*/
        if (IsMovable) {
            int itemIndex = xyItemEntity.getItem();
            int seriesIndex = xyItemEntity.getSeriesIndex();
            if (!pointDraggableSet.contains(seriesIndex))
                return;
            XYSeries series = ((XYSeriesCollection) xyItemEntity.getDataset()).getSeries(seriesIndex);
            XYPlot plot = chartPanel.getChart().getXYPlot();
            Rectangle2D dataArea = chartPanel.getChartRenderingInfo().getPlotInfo().getDataArea();
            Point2D p = chartPanel.translateScreenToJava2D(event.getPoint());
            double finalMovePointY = plot.getRangeAxis().java2DToValue(p.getY(), dataArea,
                    plot.getRangeAxisEdge());
            double difference = finalMovePointY - initialMovePointY;
            if (series.getY(itemIndex).doubleValue() + difference > plot.getRangeAxis().getRange().getLength()
                    || series.getY(itemIndex).doubleValue() + difference < 0.0)
                initialMovePointY = finalMovePointY;
            series.updateByIndex(itemIndex, series.getY(itemIndex).doubleValue() + difference);
            chartHolder.onMovePoint(itemIndex, series.getX(itemIndex).doubleValue(),
                    series.getY(itemIndex).doubleValue());
            chartPanel.getChart().fireChartChanged();
            chartPanel.updateUI();
            initialMovePointY = finalMovePointY;
        }
    } catch (Exception e) {
        e.printStackTrace();
        logger.error(e);
    }
}

From source file:org.esa.nest.dat.views.polarview.PolarView.java

private void updateReadout(MouseEvent evt) {
    if (spectrum == null)
        return;/*from  w w  w.j av  a  2  s .  c  o  m*/

    final double rTh[] = polarPanel.getPolarCanvas().getRTheta(evt.getPoint());
    if (rTh != null) {
        final float thFirst;
        final int thBin;
        final float thStep;
        final int element;
        final int direction;

        final float rStep = (float) (Math.log(lastWLBin) - Math.log(firstWLBin)) / (float) (numWLBins - 1);
        int wvBin = (int) (((rStep / 2.0 + Math.log(10000.0 / rTh[0])) - Math.log(firstWLBin)) / rStep);
        wvBin = Math.min(wvBin, spectrum[0].length - 1);
        final int wl = (int) Math.round(FastMath.exp((double) wvBin * rStep + Math.log(firstWLBin)));

        if (waveProductType == WaveProductType.CROSS_SPECTRA) {
            thFirst = firstDirBins - 5f;
            thStep = dirBinStep;
            thBin = (int) (((rTh[1] - (double) thFirst) % 360.0) / (double) thStep);
            element = (thBin % (spectrum.length / 2)) * spectrum[0].length + wvBin;
            direction = (int) ((float) thBin * thStep + thStep / 2.0f + thFirst);
        } else {
            thFirst = firstDirBins + 5f;
            thStep = -dirBinStep;
            thBin = (int) ((((360.0 - rTh[1]) + (double) thFirst) % 360.0) / (double) (-thStep));
            element = thBin * spectrum[0].length + wvBin;
            direction = (int) (-((float) thBin * thStep + thStep / 2.0f + thFirst));
        }

        final List<String> readoutList = new ArrayList<String>(5);
        readoutList.add("Record: " + (currentRecord + 1) + " of " + (numRecords + 1));
        readoutList.add("Wavelength: " + wl + " m");
        readoutList.add("Direction: " + direction + " deg");
        readoutList.add("Bin: " + (thBin + 1) + "," + (wvBin + 1) + " Element: " + element);
        readoutList.add("Value: " + spectrum[thBin][wvBin]);

        polarPanel.setReadout(readoutList.toArray(new String[readoutList.size()]));

    } else {
        polarPanel.setReadout(null);
    }
    repaint();
}