These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Popup class.
popup = PopupFactory.getSharedInstance().getPopup( c, JCustomTooltip.this, point.x, point.y); Window w = SwingUtilities.getWindowAncestor(JCustomTooltip.this); w.addMouseListener(this); w.setFocusableWindowState(true); popup.show(); showing = true; } public void mouseEntered(MouseEvent e) { // Window ttip = SwingUtilities.getWindowAncestor(getParent()); // ttip.removeMouseListener(this); // if ( ttip == null || !ttip.isVisible() ) { // return; // } // ttip.getLocation(point); // ttip.hide(); // getParent().remove(JCustomTooltip.this); //
(getWidth() - image.getWidth())/2, (getHeight() - image.getHeight())/2 ); SwingUtilities.convertPointToScreen( location, ImagePanel.this ); popup = PopupFactory.getSharedInstance().getPopup( ImagePanel.this, label, location.x, location.y ); popup.show(); } } @Override public void mouseReleased( MouseEvent e ){ if( popup != null ){ popup.hide(); popup = null; } } } }
// popupFactory.setPopupType(PopupFactory.MEDIUM_WEIGHT_POPUP); // } tipWindow = popupFactory.getPopup(insideComponent, tip, location.x, location.y); // popupFactory.setPopupType(PopupFactory.LIGHT_WEIGHT_POPUP); tipWindow.show(); Window componentWindow = SwingUtilities.windowForComponent(insideComponent); window = SwingUtilities.windowForComponent(tip); if (window != null && window != componentWindow) { window.addMouseListener(this); } else { window = null; } insideTimer.start(); tipShowing = true; } }
location.x = sBounds.x + Math.max(0, sBounds.width - size.width); } PopupFactory popupFactory = PopupFactory.getSharedInstance(); tipWindow = popupFactory.getPopup(component, tip, location.x, location.y); tipWindow.show(); tipShowing = true; } public void hideTooltip() { if (tipWindow != null) { tipWindow.hide(); tipWindow = null; tipShowing = false; } } /** * Sets the title for this tooltip. *
collapseSideMenu(); // Create a PopupFactory PopupFactory popupFactory = PopupFactory.getSharedInstance(); Point location = getLocationOnScreen(); this.floatingPopup = popupFactory.getPopup(this, expandedComponent, location.x, location.y); this.floatingPopup.show(); // get focus to expandedComponent expandedComponent.requestFocus(); } }
@Override public void show() { if ((((JComponent) this.contents).getBorder() instanceof PopupBorder) || (((JComponent) this.contents).getBorder() instanceof ShadowedPopupMenuBorder)) { updatePics(); } this.popup.show(); } private void initPopup(Component owner, Component contents, int x, int y, Popup popup) { this.owner = owner; this.contents = contents; this.popup = popup; this.x = x; this.y = y; boolean mac = false; try { mac = System.getProperty("os.name").toLowerCase().startsWith("mac"); } catch (SecurityException e) { // do nothing
public static Popup popup(JFrame frame, String message) { JLabel text = new JLabel(message); text.setMinimumSize(new Dimension(300, 200)); PopupFactory factory = PopupFactory.getSharedInstance(); Popup popup = factory.getPopup(frame, text, frame.getSize().width / 2, frame.getSize().height / 2); popup.show(); return popup; } /* */ // create a pseudo popup by opening a frame public static JFrame popupFrame(String title, String message, int width, int height, WindowListener listener) { Color bg = Color.WHITE; JFrame frame = new JFrame(title); JLabel label = new JLabel(message); label.setBackground(bg); label.setBorder(BorderFactory.createBevelBorder(1)); label.setVerticalTextPosition(SwingConstants.TOP);