private void setup() { setLayout(new BorderLayout()); JPanel bot = new JPanel(); add(jt.getTableHeader(), BorderLayout.NORTH); bot.setLayout(new BorderLayout()); bot.add(del, BorderLayout.EAST); add(bot, BorderLayout.SOUTH); JScrollPane jsp = new JScrollPane(jt); jsp.setPreferredSize(new Dimension(500, 250)); add(jsp, BorderLayout.CENTER); del.addActionListener(new DListener()); JRootPane rootPane = SwingUtilities.getRootPane(del); rootPane.setDefaultButton(del); setVisible(true); }
}); JRootPane rootPane = SwingUtilities.getRootPane(processButton); rootPane.setDefaultButton(processButton); setVisible(true);
bounds.translate(0, scroll.getHeight() - height); bounds.height = height; final JRootPane rootPane = SwingUtilities.getRootPane(myParent); final Point pos = SwingUtilities.convertPoint(scroll.getParent(), bounds.getLocation(), rootPane); final Window window = SwingUtilities.getWindowAncestor(myParent);
/** * 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); } }
parent = editor.getContentComponent(); if (!ApplicationManager.getApplication().isUnitTestMode()) { JRootPane root = SwingUtilities.getRootPane(parent); oldGlass = (JComponent)root.getGlassPane(); oldLayout = oldGlass.getLayout();
public void mousePressed(MouseEvent e) { if (!isEnabled()) return; if (!inDraggableArea(e.getPoint())) return; if (e.getButton() == MouseEvent.BUTTON1) { isDragging = true; oldValue = getValue(); previousX = e.getX(); SwingUtilities.getRootPane(this).setCursor(dragCursor); } }
public void mouseReleased(MouseEvent e) { if (!isEnabled()) return; isDragging = false; SwingUtilities.getRootPane(this).setCursor(Cursor.getDefaultCursor()); if (oldValue != value) fireStateChanged(); }
final JLayeredPane layeredPane = SwingUtilities.getRootPane(overPanel).getLayeredPane(); layeredPane.setLayer(animationPanel, JLayeredPane.MODAL_LAYER);
currentRoot = SwingUtilities.getRootPane(c);
@Override public void run() { JRootPane rootPane = SwingUtilities.getRootPane(CDIPanel.this); if (rootPane != null) { rootPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } } }
/** * @param aComponent * @return */ private static GhostGlassPane getGlassPane( final Component aComponent ) { return ( GhostGlassPane )SwingUtilities.getRootPane( aComponent ).getGlassPane(); }
@Override protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { if (e.getKeyCode() == KeyEvent.VK_F1 || e.getKeyCode() == KeyEvent.VK_HELP) { JComponent rootPane = SwingUtilities.getRootPane(this); if (rootPane != null) { rootPane.putClientProperty(ResizablePopup.HELP_COOKIE, Boolean.TRUE); } } return super.processKeyBinding(ks, e, condition, pressed); }
protected void paintComponent( Graphics g ) { super.paintComponent( g ); if( !_modalComponents.isEmpty() ) { JRootPane rootPane = SwingUtilities.getRootPane( this ); if( rootPane != null ) { rootPane.getLayeredPane().print( g ); } } }
@Override public void onShow(Field<V> field) { super.onShow(field); JComponent fieldComponent = field.getFieldComponent(); if (this.defaultButton && fieldComponent instanceof JButton) { JRootPane rootPane = SwingUtilities.getRootPane(fieldComponent); if (rootPane != null) { rootPane.setDefaultButton((JButton) fieldComponent); } } }
@Override public final JRootPane getRootPane() { if (getParent() != null) { return SwingUtilities.getRootPane(getParent()); } return null; }
@Override public void actionPerformed(ActionEvent e) { moreOptionsPanel.setVisible(!moreOptionsPanel.isVisible()); NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_MORE_OPTIONS_PANEL_VISIBLE, moreOptionsPanel.isVisible()); JRootPane rootPane = SwingUtilities.getRootPane(ReportPanel.this); ((JDialog) rootPane.getParent()).pack(); } });
private SubstanceColorScheme getColorScheme(Component c) { JRootPane rp = c instanceof JRootPane ? (JRootPane) c : SwingUtilities.getRootPane(c); SubstanceSkin skin = SubstanceCoreUtilities.getSkin(c); if (skin == null) return null; DecorationAreaType type = getRootPaneType(rp); return skin.getBackgroundColorScheme(type); }
private Rectangle calculateBounds(Component overlayComponent) { JRootPane rootPane = SwingUtilities.getRootPane(overlayComponent); Rectangle rect = SwingUtilities.convertRectangle(overlayComponent.getParent(), overlayComponent.getBounds(), rootPane.getContentPane()); JMenuBar menuBar = rootPane.getJMenuBar(); rect.x += MARGIN; rect.y += MARGIN + (menuBar == null ? 0 : menuBar.getHeight()); rect.width -= MARGIN * 2; rect.height -= MARGIN * 2; return rect; }
private SubstanceColorScheme getBorderColorScheme(Component c) { JRootPane rp = c instanceof JRootPane ? (JRootPane) c : SwingUtilities.getRootPane(c); SubstanceSkin skin = SubstanceCoreUtilities.getSkin(c); if (skin == null) return null; Component titlePaneComp = SubstanceLookAndFeel .getTitlePaneComponent(SwingUtilities.windowForComponent(c)); return skin.getColorScheme(getRootPaneType(rp), ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED); }