/** * Initializes the progress bar with the status text, and the expected * number of seconds the process will take, and starts the timer. */ private void startProgressMonitor(String text, int maxCount) { if (glassPane == null) { if (getRootPane() != null) { glassPane = getRootPane().getGlassPane(); glassPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { Toolkit.getDefaultToolkit().beep(); } }); } } if (glassPane != null) { glassPane.setVisible(true); // block input to components } statusLabel.setText(text); progressBar.setMaximum(maxCount); progressBar.setValue(0); count = 0; timer.start(); progressBar.setVisible(true); }
/** * Turns on the more window for the given editor */ private void activate() { JRootPane root = SwingUtilities.getRootPane(myEditor.getContentComponent()); myOldGlass = (JComponent)root.getGlassPane(); if (myOldGlass != null) { myOldLayout = myOldGlass.getLayout(); myWasOpaque = myOldGlass.isOpaque(); myOldGlass.setLayout(null); myOldGlass.setOpaque(false); myOldGlass.add(this); myOldGlass.addComponentListener(myAdapter); } setFontForElements(); positionPanel(); if (myOldGlass != null) { myOldGlass.setVisible(true); } myActive = true; UiHelper.requestFocus(myText); }
private void positionPanel() { final JComponent contentComponent = myEditor.getContentComponent(); Container scroll = SwingUtilities.getAncestorOfClass(JScrollPane.class, contentComponent); setSize(scroll.getSize()); myLineHeight = myText.getFontMetrics(myText.getFont()).getHeight(); int count = countLines(myText.getText()); int visLines = getSize().height / myLineHeight - 1; int lines = Math.min(count, visLines); setSize(getSize().width, lines * myLineHeight + myLabel.getPreferredSize().height + getBorder().getBorderInsets(this).top * 2); int height = getSize().height; Rectangle bounds = scroll.getBounds(); bounds.translate(0, scroll.getHeight() - height); bounds.height = height; Point pos = SwingUtilities.convertPoint(scroll.getParent(), bounds.getLocation(), SwingUtilities.getRootPane(contentComponent).getGlassPane()); bounds.setLocation(pos); setBounds(bounds); myScrollPane.getVerticalScrollBar().setValue(0); if (!Options.getInstance().isSet("more")) { // FIX scrollOffset(100000); } else { scrollOffset(0); } }
if (!ApplicationManager.getApplication().isUnitTestMode()) { JRootPane root = SwingUtilities.getRootPane(parent); oldGlass = (JComponent)root.getGlassPane(); oldLayout = oldGlass.getLayout(); wasOpaque = oldGlass.isOpaque();
@Override protected void exportDone(JComponent c, Transferable data, int action) { DnDTabbedPane src = (DnDTabbedPane) c; src.getRootPane().getGlassPane().setVisible(false); src.setDropLocation(null, null, false); src.repaint(); src.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
private void repaintDropLocation() { Component c = DnDTabbedPane.this.getRootPane().getGlassPane(); if (c instanceof GhostGlassPane) { GhostGlassPane glassPane = (GhostGlassPane) c; glassPane.setTargetTabbedPane(DnDTabbedPane.this); glassPane.repaint(); } }
@Override public void mouseDragged(MouseEvent e) { Point tabPt = e.getPoint(); // e.getDragOrigin(); if (Objects.nonNull(this.startPt) && this.startPt.distance(tabPt) > this.gestureMotionThreshold) { DnDTabbedPane src = (DnDTabbedPane) e.getComponent(); TransferHandler th = src.getTransferHandler(); DnDTabbedPane.this.dragTabIndex = src.indexAtLocation(tabPt.x, tabPt.y); th.exportAsDrag(src, e, TransferHandler.MOVE); RECT_LINE.setBounds(0, 0, 0, 0); src.getRootPane().getGlassPane().setVisible(true); src.setDropLocation(new DropLocation(tabPt, -1), null, true); this.startPt = null; } }
@Override public int getSourceActions(JComponent c) { if (c instanceof DnDTabbedPane) { DnDTabbedPane src = (DnDTabbedPane) c; c.getRootPane().setGlassPane(new GhostGlassPane(src)); if (src.dragTabIndex < 0) { return TransferHandler.NONE; } this.setDragImage(this.makeDragTabImage(src)); c.getRootPane().getGlassPane().setVisible(true); return TransferHandler.MOVE; } return TransferHandler.NONE; }
glassPane = (JComponent)currentRoot.getGlassPane(); glassPane.setLayout(null); glassPane.setOpaque(false);
Component glassPane = target.getRootPane().getGlassPane(); glassPane.setCursor(cursor); target.setCursor(cursor);
@Override public void setWaitingCursor(final boolean waiting) { if (waiting) { frame.getRootPane().getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); frame.getRootPane().getGlassPane().setVisible(true); } else { frame.getRootPane().getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); frame.getRootPane().getGlassPane().setVisible(false); } }
private void showWaitCursor (boolean show) { JRootPane rPane = getRootPane(); if (rPane == null) { return; } if (SwingUtilities.isEventDispatchThread()) { doShowWaitCursor(rPane.getGlassPane(), show); } else { SwingUtilities.invokeLater(new CursorR(rPane.getGlassPane(), show)); } }
public void unBlock(JRootPane rootPane) { if( null == rootPane ) return; Component glassPane = rootPane.getGlassPane(); if( null == glassPane ) { return; } removeListeners(glassPane); glassPane.setCursor(null); glassPane.setVisible(false); }
public void removeComponentWithErrors(JComponent component) { if (componentsWithErrors.remove(component)) { panel.getRootPane().getGlassPane().repaint(); } }
/** * Set cursor to free and enable application input. Called after a call to * setCursorBusy. * * @param dialog * Dialog to apply to */ public static void setCursorFree(JDialog dialog) { setCursorFree(dialog.getRootPane().getGlassPane()); }
/** * Set cursor to busy and disable application input. This can be reversed by * a subsequent call to setCursorFree. * * @param frame * Frame to apply to */ public static void setCursorBusy(JFrame frame) { setCursorBusy(frame.getRootPane().getGlassPane()); }
/** * Set cursor to free and enable application input. Called after a call to * setCursorBusy. * * @param frame * Frame to apply to */ public static void setCursorFree(JFrame frame) { setCursorFree(frame.getRootPane().getGlassPane()); }
public void ancestorAdded(AncestorEvent event) { final Component glassPane = rootPane.getRootPane().getGlassPane(); glassPane.addMouseListener(mouseListener); glassPane.addMouseMotionListener(mouseListener); glassPane.setVisible(true); SwingUtilities.getWindowAncestor(rootPane).setFocusableWindowState(false); } }
private void checkStoredGlassPane() { // remember current glass pane to set back at end of dragging over this compoment if (!DropGlassPane.isOriginalPaneStored()) { Component comp = tree.getRootPane().getGlassPane(); DropGlassPane.setOriginalPane(tree, comp, comp.isVisible()); // set glass pane for paint selection line dropPane = DropGlassPane.getDefault(tree); tree.getRootPane().setGlassPane(dropPane); dropPane.revalidate(); dropPane.setVisible(true); } }
private void checkStoredGlassPane() { // remember current glass pane to set back at end of dragging over this compoment if (!DropGlassPane.isOriginalPaneStored()) { Component comp = table.getRootPane().getGlassPane(); DropGlassPane.setOriginalPane(table, comp, comp.isVisible()); // set glass pane for paint selection line dropPane = DropGlassPane.getDefault(table); table.getRootPane().setGlassPane(dropPane); dropPane.revalidate(); dropPane.setVisible(true); log("dropPane was set"); // NOI18N } }