/** * Check to see if the frame needs to be resized. Only required if we're not * using scaledToFit mode, and thus have a pre-existing notion of what the * unit-height (or interval height) should be. * * @return true if pane needs to be resized */ @Override public boolean needsToResize() { if (!scaledToFit) { int currentHeight = getHeight(); int expectedHeight = (int) ((yMax - yMin) * unitHeight); expectedHeight = Math.max(expectedHeight, parentFrame.getFrameLandscape().getHeight()); if (expectedHeight != currentHeight) { requestHeight(expectedHeight); return true; } } return false; }
private void doUpdateMapControlSize() { mapControl.setBounds(0,0,layeredPane.getWidth(),layeredPane.getHeight()); if(mapsManager.isVisible()) { Dimension mapsManagerPreferredSize = mapsManager.getMinimalComponentDimension(); int hPos = layeredPane.getWidth() - Math.min(mapsManagerPreferredSize.width,layeredPane.getWidth()); mapsManager.setBounds(hPos,0,Math.min(mapsManagerPreferredSize.width,layeredPane.getWidth()),Math.min(mapsManagerPreferredSize.height,layeredPane.getHeight())); mapsManager.revalidate(); } } /**
layeredPane.setBounds(x, y, width, height); y = Math.min(layeredPane.getHeight() - dim.height, 0); if (isFillMode()) { component.setBounds(0, 0, width, height); } else { component.setBounds(0, y, width, layeredPane.getHeight() - y); modal.setBounds(0, y, width, layeredPane.getHeight() - y); } else { modal.setBounds(0, 0, 0, 0);
pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2;
public void mouseReleased(MouseEvent e) { JDialog aboutDialog = new JDialog(GraphicSimulator.this, guiTextConfig.getString("AboutDialogTitle"), true); Point pos = new Point(); pos.x = jLayeredPane.getLocationOnScreen().x + (jLayeredPane.getWidth() - getProperty("DialogWindowWidth")) / 2; pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2; aboutDialog.setLocation(pos); aboutDialog.setSize(getProperty("DialogWindowWidth"), getProperty("DialogWindowHeight")); aboutDialog.setTitle(guiTextConfig.getString("AboutDialogTitle")); JLabel text = new JLabel(guiTextConfig.getString("AboutDialogContent")); text.setHorizontalAlignment(JLabel.CENTER); aboutDialog.add(text); aboutDialog.setVisible(true); } });
pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2;
public void mouseReleased(MouseEvent e) { JDialog aboutDialog = new JDialog(GraphicSimulatorServer.this, guiTextConfig.getString("AboutDialogTitle"), true); Point pos = new Point(); pos.x = jLayeredPane.getLocationOnScreen().x + (jLayeredPane.getWidth() - getProperty("DialogWindowWidth")) / 2; pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2; aboutDialog.setLocation(pos); aboutDialog.setSize(getProperty("DialogWindowWidth"), getProperty("DialogWindowHeight")); aboutDialog.setTitle(guiTextConfig.getString("AboutDialogTitle")); JLabel text = new JLabel(guiTextConfig.getString("AboutDialogContent")); text.setHorizontalAlignment(JLabel.CENTER); aboutDialog.add(text); aboutDialog.setVisible(true); } });
Point pos = new Point(); pos.x = jLayeredPane.getLocationOnScreen().x + (jLayeredPane.getWidth() - getProperty("DialogWindowWidth")) / 2; pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2;
/** * Shows the management simulator dialog for the selected antenna. */ private void showMgmtSimDialog() { // compute position of the dialog final Point pos = new Point(); pos.x = jLayeredPane.getLocationOnScreen().x + (jLayeredPane.getWidth() - getProperty("DialogWindowWidth")) / 2; pos.y = jLayeredPane.getLocationOnScreen().y + (jLayeredPane.getHeight() - getProperty("DialogWindowHeight")) / 2; String readPointName = selectedAntenna.getId(); // create dialog if it does not already exists MgmtSimDialog mgmtSimDialog = mgmtSimDialogs.get(readPointName); if(mgmtSimDialog == null) { mgmtSimDialog = new MgmtSimDialog(readPointName, controller); mgmtSimDialogs.put(readPointName, mgmtSimDialog); } mgmtSimDialog.setLocation(pos); mgmtSimDialog.setModal(true); mgmtSimDialog.setVisible(true); }
/** * Makes the alphabetical markers visible. */ public void showMarkers() { UIThreadsUtil.mustBeSwingThread(); markers = createMarkers(getViewableSegmentLocations()); if (markers.isEmpty()) { return; } setSize(parent.getWidth() - 1, parent.getHeight() - 1); parent.add(this, JLayeredPane.POPUP_LAYER, 0); // top most parent.validate(); parent.repaint(); }
private void show() { frame.getLayeredPane().add(backgroundPanel, JLayeredPane.PALETTE_LAYER); imagePanel.setLocation(((frame.getLayeredPane().getWidth() - imagePanel.getWidth()) / 2), (frame.getLayeredPane().getHeight() - imagePanel.getHeight()) / 2); frame.getLayeredPane().add(imagePanel, JLayeredPane.POPUP_LAYER); }
JLayeredPane lp = JLayeredPane.getLayeredPaneAbove(f); lp.setLayer(modalInterceptor, JLayeredPane.MODAL_LAYER.intValue()); modalInterceptor.setBounds(0, 0, lp.getWidth(), lp.getHeight()); modalInterceptor.addMouseListener(new MouseAdapter(){}); modalInterceptor.addMouseMotionListener(new MouseMotionAdapter(){});
int paneHeight = pane.getHeight();
boolean sameSize = prevSize != null && getSize().equals(prevSize) && parentFrame.getFrameLandscape().getWidth() == oldWidth && parentFrame.getFrameLandscape().getHeight() == oldHeight; boolean sameRef = prevRef != null && lc.getReferenceName().equals(prevRef); boolean withinScrollBounds = bufferedImage != null && scroller.getValue() >= getOffset() && scroller.getValue() < getOffset() + getViewportHeight() * 2; oldHeight = parentFrame.getFrameLandscape().getHeight();