private void positionInspector() { if (inspectorX != Integer.MIN_VALUE) { // trackerPanel will select this track when getInspector() is called // only if loader has set the showInspector flag (so refreshing is false) refreshing = !showInspector; loading = true; // prevents setting trackerPanel changed flag getInspector(); refreshing = loading = false; TFrame frame = trackerPanel.getTFrame(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); if (inspectorH != Integer.MIN_VALUE) inspector.setSize(inspector.getWidth(), Math.min(inspectorH, dim.height)); int x = Math.max(frame.getLocation().x + inspectorX, 0); x = Math.min(x, dim.width - inspector.getWidth()); int y = Math.max(frame.getLocation().y + inspectorY, 0); y = Math.min(y, dim.height - inspector.getHeight()); inspector.setLocation(x, y); inspectorX = Integer.MIN_VALUE; } }