Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
282,600
void (ComponentEvent e) {}
componentHidden
282,601
void (ComponentEvent e) {}
componentMoved
282,602
void (ComponentEvent e) {}
componentShown
282,603
void (MouseEvent e) { setSelected(true); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); }
mouseEntered
282,604
void (MouseEvent e) { setSelected(false); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
mouseExited
282,605
boolean (@NotNull MouseEvent e, int clickCount) { if (action != null) { action.run(); return true; } return false; }
onClick
282,606
JBCardLayout () { return (JBCardLayout)super.getLayout(); }
getLayout
282,607
Component (@NonNls String name, Component comp) { if (mySelectedIndex == -1) { mySelectedIndex = 0; } return super.add(name, comp); }
add
282,608
ActionCallback (String id, JBCardLayout.SwipeDirection direction) { final ActionCallback done = new ActionCallback(); getLayout().swipe(this, id, direction, () -> done.setDone()); return done; }
swipe
282,609
Component (Component comp) { throw new AddMethodIsNotSupportedException(); }
add
282,610
Component (Component comp, int index) { throw new AddMethodIsNotSupportedException(); }
add
282,611
void (Component comp, Object constraints) { throw new AddMethodIsNotSupportedException(); }
add
282,612
void (Component comp, Object constraints, int index) { throw new AddMethodIsNotSupportedException(); }
add
282,613
void (int index, Component component) { super.setComponentAt(index, component); component.addHierarchyListener(this); setInsets(component); revalidate(); repaint(); }
setComponentAt
282,614
void () { super.updateUI(); updateTabComponentLabelsFont(); }
updateUI
282,615
void () { int tabsCount = getTabCount(); for (int i = 0; i < tabsCount; i++) { Component tabComp = getTabComponentAt(i); if (tabComp instanceof JLabel) { tabComp.setFont(getFont()); } } }
updateTabComponentLabelsFont
282,616
void (int index, @NlsContexts.TabTitle String title) { super.setTitleAt(index, title); Component tabComponent = getTabComponentAt(index); if (tabComponent instanceof JLabel label) { if (Boolean.TRUE.equals(label.getClientProperty(LABEL_FROM_TABBED_PANE))) { label.setText(title); } } }
setTitleAt
282,617
void (int index) { super.setSelectedIndex(index); revalidate(); repaint(); }
setSelectedIndex
282,618
void (Component component) { if (component instanceof JComponent && myTabComponentInsets != null) { UIUtil.addInsets((JComponent)component, getInsetsForTabComponent()); } }
setInsets
282,619
Insets () { return myTabComponentInsets; }
getInsetsForTabComponent
282,620
void (@Nullable Insets tabInsets) { myTabComponentInsets = tabInsets; }
setTabComponentInsets
282,621
void (HierarchyEvent e) { repaint(); }
hierarchyChanged
282,622
void () { super.removeNotify(); if (!ScreenUtil.isStandardAddRemoveNotify(this)) { return; } for (int i = 0; i < getTabCount(); i++) { getComponentAt(i).removeHierarchyListener(this); } }
removeNotify
282,623
Graphics (Graphics graphics) { return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics)); }
getComponentGraphics
282,624
void (FocusEvent e) { myOwner.repaint(); }
focusGained
282,625
void (FocusEvent e) { myOwner.repaint(); }
focusLost
282,626
void (@NotNull String defaultText) { myStatusTriggerText = defaultText; }
setTextToTriggerStatus
282,627
String () { return myStatusTriggerText; }
getStatusTriggerText
282,628
void (Graphics g) { if (!isFontSet()) { setFont(myOwner.getFont()); } paint(myOwner, g); }
paintStatusText
282,629
void () { setFont(myOwner.getFont()); }
resetFontToOwnerFont
282,630
boolean () { if (myDynamicStatus) { Object function = myOwner.getClientProperty(STATUS_VISIBLE_FUNCTION); if (function instanceof Predicate) { return ((Predicate<JTextComponent>)function).test(myOwner); } } return myOwner.getText().equals(myStatusTriggerText) && !myOwner.isFocusOwner(); }
isStatusVisible
282,631
Rectangle () { Rectangle b = myOwner.getBounds(); Insets insets = ObjectUtils.notNull(myOwner.getInsets(), JBInsets.emptyInsets()); Insets margin = ObjectUtils.notNull(myOwner.getMargin(), JBInsets.emptyInsets()); Insets ipad = getComponent().getIpad(); int left = insets.left + margin.left - ipad.left; int right = insets.right + margin.right - ipad.right; int top = insets.top + margin.top - ipad.top; int bottom = insets.bottom + margin.bottom - ipad.bottom; return new Rectangle(left, top, b.width - left - right, b.height - top - bottom); }
getTextComponentBound
282,632
Rectangle (@NotNull JComponent component, @NotNull Rectangle bounds) { Dimension size = component.getPreferredSize(); int width = Math.min(size.width, bounds.width); return component == getComponent() ? new Rectangle(bounds.x, bounds.y, width, bounds.height) : new Rectangle(bounds.x + bounds.width - width, bounds.y, width, bounds.height); }
adjustComponentBounds
282,633
Component (Component comp, int index) { Logger.getInstance(JBLayeredPane.class) .warn("Probably incorrect call - constraint as primitive integer will be used as index", new Throwable()); addImpl(comp, null, index); return comp; }
add
282,634
Dimension () { if (!isMinimumSizeSet()) return new Dimension(0, 0); return super.getMinimumSize(); }
getMinimumSize
282,635
boolean () { return myFullOverlayLayout; }
isFullOverlayLayout
282,636
void (boolean enabled) { myFullOverlayLayout = enabled; }
setFullOverlayLayout
282,637
void () { if (isFullOverlayLayout()) { int width = getWidth(); int height = getHeight(); for (int i = getComponentCount() - 1; i >= 0; i--) { getComponent(i).setBounds(0, 0, width, height); } } else { super.doLayout(); } }
doLayout
282,638
boolean () { for (Component component : getComponents()) { if (component.isVisible()) { return false; } } return true; }
isStatusVisible
282,639
void () { putClientProperty(ComponentUtil.NOT_IN_HIERARCHY_COMPONENTS, emptyText.getWrappedFragmentsIterable()); }
registerEmptyTextComponents
282,640
StatusText () { return emptyText; }
getEmptyText
282,641
JBPanelWithEmptyText (@Nls String str) { emptyText.setText(str); return this; }
withEmptyText
282,642
void (Graphics g) { super.paintComponent(g); emptyText.paint(this, g); }
paintComponent
282,643
void (Container parent) { if (parent instanceof JViewport viewport) { Component view = viewport.getView(); if (view != null) { Container grand = viewport.getParent(); if (grand instanceof JScrollPane) { doLayout((JScrollPane)grand, viewport, view); } else { super.layoutContainer(parent); } } } }
layoutContainer
282,644
Dimension (Container parent) { if (parent instanceof JViewport viewport) { Dimension size = getPreferredScrollableViewportSize(viewport.getView()); if (size != null) return size; // may be null for for tables or custom components } return new Dimension(); }
preferredLayoutSize
282,645
void (ContainerEvent e) { Component child = e.getChild(); if (child instanceof JBTable) { myEmptyText = ((ComponentWithEmptyText)child).getEmptyText(); myEmptyText.attachTo(JBViewport.this, child); } }
componentAdded
282,646
void (ContainerEvent e) { Component child = e.getChild(); if (child instanceof JBTable) { ((ComponentWithEmptyText)child).getEmptyText().attachTo(child); myEmptyText = null; } }
componentRemoved
282,647
void (Point p) { if (ScrollSettings.isDebugEnabled() && !p.equals(getViewPosition()) && !isInsideLogToolWindow()) { checkScrollingCapabilities(); } super.setViewPosition(p); }
setViewPosition
282,648
boolean () { Container parent1 = getParent(); if (parent1 instanceof JScrollPane) { Container parent2 = parent1.getParent(); if (parent2 instanceof JPanel) { Container parent3 = parent2.getParent(); if (parent3 instanceof JPanel) { return parent3.getClass().getName().startsWith("com.intellij.notification.EventLogToolWindowFactory"); } } } return false; }
isInsideLogToolWindow
282,649
void () { if (myPreviousNotification == null || myPreviousNotification.isExpired()) { if (!Boolean.TRUE.equals(isWindowBlitterAvailableFor(this))) { myPreviousNotification = notify("Scrolling: cannot use window blitter"); //NON-NLS } else { if (!Boolean.TRUE.equals(isTrueDoubleBufferingAvailableFor(this))) { myPreviousNotification = notify("Scrolling: cannot use true double buffering"); //NON-NLS } } } }
checkScrollingCapabilities
282,650
void (Component view) { super.setView(view); updateBorder(view); }
setView
282,651
Notification (@NlsContexts.NotificationContent String message) { Notification notification = NotificationGroupManager.getInstance().getNotificationGroup("scrolling-capabilities-debug") .createNotification(message, NotificationType.INFORMATION); notification.notify(null); Timer timer = new Timer(NOTIFICATION_TIMEOUT, event -> notification.expire()); timer.setRepeats(false); timer.start(); return notification; }
notify
282,652
Color () { Color color = super.getBackground(); if (!myBackgroundRequested && EventQueue.isDispatchThread() && ScrollSettings.isBackgroundFromView()) { if (!isBackgroundSet() || color instanceof UIResource) { Component child = getView(); if (child != null) { try { myBackgroundRequested = true; return child.getBackground(); } finally { myBackgroundRequested = false; } } } } return color; }
getBackground
282,653
LayoutManager () { return ourLayoutManager; }
createLayoutManager
282,654
Graphics (Graphics graphics) { return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics)); }
getComponentGraphics
282,655
void (Graphics g) { myPaintingNow = true; if (myZoomer != null && myZoomer.isActive()) { myZoomer.paint(g); } else { super.paint(g); if (myEmptyText != null) { myEmptyText.paint(this, g); } } myPaintingNow = false; }
paint
282,656
void (Point at) { myZoomer = new ZoomingDelegate((JComponent)getView(), this); myZoomer.magnificationStarted(at); }
magnificationStarted
282,657
void (double magnification) { myZoomer.magnificationFinished(magnification); myZoomer = null; }
magnificationFinished
282,658
void (double magnification) { myZoomer.magnify(magnification); }
magnify
282,659
boolean () { return myPaintingNow; }
isPaintingNow
282,660
void (Rectangle bounds) { Component view = getView(); if (view instanceof JComponent && !isAutoscroll(bounds)) { JBInsets.addTo(bounds, getViewInsets((JComponent)view)); } if (bounds.width > getWidth()) bounds.width = getWidth(); if (bounds.height > getHeight()) bounds.height = getHeight(); super.scrollRectToVisible(bounds); }
scrollRectToVisible
282,661
boolean (Rectangle bounds) { if (bounds.x == -bounds.width || bounds.x == getWidth()) { if (bounds.y + bounds.height + bounds.y == getHeight()) { // Horizontal auto-scrolling: // /--- or ---\ // y y // /-width-! !-width-\ // ! ! ! ! // h ! ! h // e ! ! e // i ! ! i // g ! ! g // h ! ! h // t ! ! t // ! ! ! ! // \-------! !-------/ // y y // \--- or ---/ return true; } } if (bounds.y == -bounds.height || bounds.y == getHeight()) { if (bounds.x + bounds.width + bounds.x == getWidth()) { // Vertical auto-scrolling is symmetric to horizontal one return true; } } return false; }
isAutoscroll
282,662
boolean (JComponent view, boolean horizontal) { return (!SystemInfo.isMac || horizontal && ScrollSettings.isHorizontalGapNeededOnMac()) && (view instanceof JList || view instanceof JTree || (!SystemInfo.isMac && ScrollSettings.isGapNeededForAnyComponent())); }
isAlignmentNeeded
282,663
Insets (JComponent view) { Border border = view.getBorder(); if (border instanceof ViewBorder vb) { border = vb.myBorder; } return border == null ? null : border.getBorderInsets(view); }
getInnerInsets
282,664
Insets (JComponent view) { Border border = view.getBorder(); if (border instanceof ViewBorder vb) { Insets insets = JBInsets.emptyInsets(); vb.addViewInsets(view, insets); return insets; } return null; }
getViewInsets
282,665
void (JScrollPane pane, JViewport viewport, Component view) { updateBorder(view); Dimension actualSize = viewport.getSize(); Dimension extentSize = viewport.toViewCoordinates(actualSize); Dimension viewPreferredSize = view.getPreferredSize(); Dimension viewSize = new Dimension(viewPreferredSize); Point viewPosition = viewport.getViewPosition(); Scrollable scrollable = null; if (view instanceof Scrollable) { scrollable = (Scrollable)view; if (scrollable.getScrollableTracksViewportWidth()) viewSize.width = actualSize.width; if (scrollable.getScrollableTracksViewportHeight()) viewSize.height = actualSize.height; } // If the new viewport size would leave empty space to the right of the view, // right justify the view or left justify the view // when the width of the view is smaller than the container. int maxX = viewSize.width - extentSize.width; if (scrollable == null || pane.getComponentOrientation().isLeftToRight()) { if (viewPosition.x > maxX) { viewPosition.x = Math.max(0, maxX); } } else { viewPosition.x = maxX < 0 ? maxX : Math.max(0, Math.min(maxX, viewPosition.x)); } // If the new viewport size would leave empty space below the view, // bottom justify the view or top justify the view // when the height of the view is smaller than the container. int maxY = viewSize.height - extentSize.height; if (viewPosition.y > maxY) { viewPosition.y = Math.max(0, maxY); } // If we haven't been advised about how the viewports size should change wrt to the viewport, // i.e. if the view isn't an instance of Scrollable, then adjust the views size as follows. if (scrollable == null) { // If the origin of the view is showing and the viewport is bigger than the views preferred size, // then make the view the same size as the viewport. if (viewPosition.x == 0 && actualSize.width > viewPreferredSize.width) viewSize.width = actualSize.width; if (viewPosition.y == 0 && actualSize.height > viewPreferredSize.height) viewSize.height = actualSize.height; } // do not force viewport size on editor component, e.g. EditorTextField and LanguageConsole if (!(view instanceof TypingTarget)) { if (ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER == pane.getHorizontalScrollBarPolicy()) { viewPosition.x = 0; viewSize.width = extentSize.width; } if (ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER == pane.getVerticalScrollBarPolicy()) { viewPosition.y = 0; viewSize.height = extentSize.height; } } viewport.setViewPosition(viewPosition); viewport.setViewSize(viewSize); }
doLayout
282,666
void (@Nullable Component view) { if (ScrollSettings.isNotSupportedYet(view)) return; if (view instanceof JComponent component) { Border border = component.getBorder(); if (border instanceof ViewBorder) return; // already set component.setBorder(border == null || border instanceof UIResource ? new ResourceViewBorder(border) : new ViewBorder(border)); } }
updateBorder
282,667
Insets (Component view, Insets insets) { if (insets == null) { insets = JBInsets.emptyInsets(); } else { insets.set(0, 0, 0, 0); } if (myBorder != null) { Insets inner = myBorder.getBorderInsets(view); if (inner != null) insets.set(inner.top, inner.left, inner.bottom, inner.right); } if (view instanceof JComponent) { addViewInsets((JComponent)view, insets); } if (!myInsets.equals(insets)) { myInsets.set(insets.top, insets.left, insets.bottom, insets.right); if (view instanceof JComponent component) { if (component instanceof JTree tree) { TreeUtil.invalidateCacheAndRepaint(tree.getUI()); } component.revalidate(); } else { view.invalidate(); view.repaint(); } } return insets; }
getBorderInsets
282,668
void (Component view, Graphics g, int x, int y, int width, int height) { if (myBorder != null) { // additional insets are used inside a custom border myBorder.paintBorder(view, g, x, y, width, height); } }
paintBorder
282,669
void (JComponent view, Insets insets) { if (this == view.getBorder()) { JViewport viewport = ComponentUtil.getViewport(view); if (viewport != null) { JScrollPane pane = ComponentUtil.getScrollPane(viewport); if (pane != null) { boolean isOverlappingScrollBar = (pane instanceof JBScrollPane) && ((JBScrollPane)pane).isOverlappingScrollBar(); // calculate empty border under vertical scroll bar JScrollBar vsb = pane.getVerticalScrollBar(); if (vsb != null && vsb.isVisible() && !isOverlappingScrollBar) { boolean opaque = vsb.isOpaque(); if (viewport == pane.getColumnHeader() ? (!opaque || ScrollSettings.isHeaderOverCorner(pane.getViewport())) : (!opaque && viewport == pane.getViewport() && !ClientProperty.isTrue(vsb, JBScrollPane.IGNORE_SCROLLBAR_IN_INSETS))) { Alignment va = Alignment.get(vsb); if (va == Alignment.LEFT) { insets.left += vsb.getWidth(); } else if (va == Alignment.RIGHT && (opaque || isAlignmentNeeded(view, false))) { insets.right += vsb.getWidth(); } } } // calculate empty border under horizontal scroll bar JScrollBar hsb = pane.getHorizontalScrollBar(); if (hsb != null && hsb.isVisible() && !isOverlappingScrollBar) { boolean opaque = hsb.isOpaque(); if (viewport == pane.getRowHeader() ? (!opaque || ScrollSettings.isHeaderOverCorner(pane.getViewport())) : (!opaque && viewport == pane.getViewport() && !ClientProperty.isTrue(hsb, JBScrollPane.IGNORE_SCROLLBAR_IN_INSETS))) { Alignment ha = Alignment.get(hsb); if (ha == Alignment.TOP) { insets.top += hsb.getHeight(); } else if (ha == Alignment.BOTTOM && (opaque || isAlignmentNeeded(view, true))) { insets.bottom += hsb.getHeight(); } } } } } } }
addViewInsets
282,670
String () { return "ViewBorder{" + "myInsets=" + myInsets + ", myBorder=" + myBorder + '}'; }
toString
282,671
Dimension (Component view) { if (view instanceof JList) return getPreferredScrollableViewportSize((JList)view); if (view instanceof JTree) return getPreferredScrollableViewportSize((JTree)view); if (view instanceof Scrollable) return ((Scrollable)view).getPreferredScrollableViewportSize(); if (view instanceof JComponent) return getPreferredSizeWithoutScrollBars((JComponent)view); return view == null ? null : view.getPreferredSize(); }
getPreferredScrollableViewportSize
282,672
Dimension (@NotNull JComponent view) { Dimension size = view.getPreferredSize(); if (size == null) return new Dimension(); JBInsets.removeFrom(size, getViewInsets(view)); return size; }
getPreferredSizeWithoutScrollBars
282,673
Dimension (@NotNull JList<?> list) { if (JList.class != getPreferredScrollableViewportSizeDeclaringClass(list)) { return list.getPreferredScrollableViewportSize(); // may be null } Dimension size = getPreferredSizeWithoutScrollBars(list); if (JList.VERTICAL != list.getLayoutOrientation()) return size; ListModel<?> model = list.getModel(); int modelRows = model == null ? 0 : model.getSize(); int visibleRows = list.getVisibleRowCount(); boolean forceVisibleRowCount = Boolean.TRUE.equals(ClientProperty.get(list, FORCE_VISIBLE_ROW_COUNT_KEY)); if (!forceVisibleRowCount && visibleRows > 0) { visibleRows = Math.min(modelRows, visibleRows); } if (visibleRows <= 0) { visibleRows = Registry.intValue("ide.preferred.scrollable.viewport.visible.rows", 10); } boolean addExtraSpace = Registry.is("ide.preferred.scrollable.viewport.extra.space", true); Insets insets = getInnerInsets(list); size.height = insets != null ? insets.top + insets.bottom : 0; if (modelRows == 0) { int fixedWidth = list.getFixedCellWidth(); int fixedHeight = list.getFixedCellHeight(); if (fixedWidth <= 0) { fixedWidth = Registry.intValue("ide.preferred.scrollable.viewport.fixed.width", 256); } if (fixedWidth <= 0) { fixedWidth = JBUIScale.scale(256); // scaled value from JDK } if (fixedHeight <= 0) { fixedHeight = Registry.intValue("ide.preferred.scrollable.viewport.fixed.height", 0); } if (fixedHeight <= 0) { fixedHeight = UIManager.getInt("List.rowHeight"); } if (fixedHeight <= 0) { fixedHeight = JBUIScale.scale(16); // scaled value from JDK } size.width = insets != null ? insets.left + insets.right + fixedWidth : fixedWidth; size.height += fixedHeight * visibleRows; if (addExtraSpace) size.height += fixedHeight / 2; } else if (visibleRows > 0) { int lastRow = Math.min(visibleRows, modelRows) - 1; Rectangle bounds = list.getCellBounds(lastRow, lastRow); if (bounds == null) return size; // null UI? size.height = bounds.y + bounds.height; if (insets != null) size.height += insets.bottom; if (modelRows < visibleRows) { size.height += (visibleRows - modelRows) * bounds.height; } else if (modelRows > visibleRows) { if (addExtraSpace) size.height += bounds.height / 2; } } return size; }
getPreferredScrollableViewportSize
282,674
Dimension (@NotNull JTree tree) { if (JTree.class != getPreferredScrollableViewportSizeDeclaringClass(tree)) { return tree.getPreferredScrollableViewportSize(); // may be null } Dimension size = getPreferredSizeWithoutScrollBars(tree); int fixedHeight = tree.getRowHeight(); int modelRows = tree.getRowCount(); if (modelRows <= 0) { if (fixedHeight <= 0) { fixedHeight = Registry.intValue("ide.preferred.scrollable.viewport.fixed.height", 0); } if (fixedHeight <= 0) { fixedHeight = UIManager.getInt(JBUI.CurrentTheme.Tree.rowHeightKey()); } if (fixedHeight <= 0) { fixedHeight = JBUIScale.scale(16); } } int visibleRows = tree.getVisibleRowCount(); if (visibleRows <= 0) { visibleRows = Registry.intValue("ide.preferred.scrollable.viewport.visible.rows", 10); } boolean addExtraSpace = (modelRows != visibleRows) && Registry.is("ide.preferred.scrollable.viewport.extra.space", true); Insets insets = getInnerInsets(tree); size.height = insets != null ? insets.top + insets.bottom : 0; if (0 < fixedHeight) { size.height += fixedHeight * visibleRows; if (addExtraSpace) size.height += fixedHeight / 2; } else if (visibleRows > 0) { int lastRow = Math.min(visibleRows, modelRows - 1); Rectangle bounds = tree.getRowBounds(lastRow); if (bounds != null) { size.height = bounds.y + bounds.height * (visibleRows - lastRow); if (addExtraSpace) { size.height += bounds.height / 2; } else if (insets != null) { size.height += insets.bottom; } } } return size; }
getPreferredScrollableViewportSize
282,675
Color () { Color color = super.getBackground(); if (!myBackgroundRequested && EventQueue.isDispatchThread() && ScrollSettings.isBackgroundFromView()) { if (!isBackgroundSet() || color instanceof UIResource) { Component child = getViewport(); if (child != null) { try { myBackgroundRequested = true; return child.getBackground(); } finally { myBackgroundRequested = false; } } } } return color; }
getBackground
282,676
boolean () { return myIsOverlappingScrollBar; }
isOverlappingScrollBar
282,677
void (boolean overlappingScrollBar) { boolean oldValue = myIsOverlappingScrollBar; myIsOverlappingScrollBar = overlappingScrollBar; if (oldValue != myIsOverlappingScrollBar) { revalidate(); repaint(); } }
setOverlappingScrollBar
282,678
Color (JScrollPane pane) { if (pane == null) return null; JViewport viewport = pane.getViewport(); if (viewport == null) return null; Component view = viewport.getView(); if (view == null) return null; return view.getBackground(); }
getViewBackground
282,679
void () { init(true); }
init
282,680
void (boolean setupCorners) { setLayout(new Layout()); if (setupCorners) { setupCorners(); } }
init
282,681
void () { setBorder(IdeBorderFactory.createBorder()); setCorner(UPPER_RIGHT_CORNER, new Corner()); setCorner(UPPER_LEFT_CORNER, new Corner()); setCorner(LOWER_RIGHT_CORNER, new Corner()); setCorner(LOWER_LEFT_CORNER, new Corner()); }
setupCorners
282,682
void (ScrollPaneUI ui) { super.setUI(ui); updateViewportBorder(); if (ui instanceof BasicScrollPaneUI) { try { Field field = BasicScrollPaneUI.class.getDeclaredField("mouseScrollListener"); field.setAccessible(true); Object value = field.get(ui); if (value instanceof MouseWheelListener oldListener) { MouseWheelListener newListener = new JBMouseWheelListener(oldListener); field.set(ui, newListener); // replace listener if field updated successfully removeMouseWheelListener(oldListener); addMouseWheelListener(newListener); } } catch (Exception exception) { LOG.warn(exception); } } }
setUI
282,683
void (JComponent statusComponent) { JComponent old = getStatusComponent(); this.statusComponent = statusComponent; if (statusComponent != null) { add(statusComponent, STATUS_COMPONENT); } else if (old != null) { remove(old); } firePropertyChange("statusComponent", old, statusComponent); revalidate(); repaint(); }
setStatusComponent
282,684
JComponent () { return statusComponent; }
getStatusComponent
282,685
void (MouseWheelEvent event) { boolean isScrollEvent = isScrollEvent(event); boolean isScrollPaneEvent = event.getSource() instanceof JScrollPane; if (isScrollEvent && isScrollPaneEvent) { JScrollPane pane = (JScrollPane)event.getSource(); if (Boolean.TRUE.equals(ClientProperty.get(pane, FORCE_HORIZONTAL_SCROLL))) { event = withShiftModifier(event); } JScrollBar bar = event.isShiftDown() ? pane.getHorizontalScrollBar() : pane.getVerticalScrollBar(); boolean isWheelScrollEnabled = pane.isWheelScrollingEnabled(); boolean isBarVisible = bar != null && bar.isVisible(); boolean isAdjustedDeltaZero = bar instanceof JBScrollBar && ((JBScrollBar)bar).getDeltaAdjusted(event) == 0.0; if (isWheelScrollEnabled && isBarVisible && !isAdjustedDeltaZero) { if (TouchScrollUtil.isTouchScroll(event)) { if (myTouchScroll == null) { myTouchScroll = TouchScroll.create(); } myTouchScroll.processMouseWheelEvent(event, myDelegate::mouseWheelMoved); } else if (UISettings.getShadowInstance().getAnimatedScrolling()) { if (mySmoothScroll == null) { mySmoothScroll = MouseWheelSmoothScroll.create(() -> { return ScrollSettings.isEligibleFor(pane); }); } mySmoothScroll.processMouseWheelEvent(event, myDelegate::mouseWheelMoved); } else { if (LatchingScroll.isEnabled()) { if (myLatchingScroll == null) myLatchingScroll = new LatchingScroll(); if (myLatchingScroll.shouldBeIgnored(event)) { event.consume(); } } if (!event.isConsumed() && !(bar instanceof JBScrollBar && ((JBScrollBar)bar).handleMouseWheelEvent(event))) { myDelegate.mouseWheelMoved(event); } } } if (!event.isConsumed()) { // try to process a mouse wheel event by outer scroll pane MouseEventAdapter.redispatch(event, ComponentUtil .getParentOfType((Class<? extends JScrollPane>)JScrollPane.class, pane.getParent())); } } }
mouseWheelMoved
282,686
MouseWheelEvent (@NotNull MouseWheelEvent event) { return MouseEventAdapter.convert(event, (JComponent)event.getSource(), event.getID(), event.getWhen(), UIUtil.getAllModifiers(event) | InputEvent.SHIFT_DOWN_MASK, event.getX(), event.getY()); }
withShiftModifier
282,687
boolean () { return isOptimizedDrawingEnabledFor(getVerticalScrollBar()) && isOptimizedDrawingEnabledFor(getHorizontalScrollBar()); }
isOptimizedDrawingEnabled
282,688
boolean (JScrollBar bar) { return bar == null || !bar.isVisible() || (bar.isOpaque() && bar.isOptimizedDrawingEnabled()); }
isOptimizedDrawingEnabledFor
282,689
void () { if (getViewportBorder() instanceof ViewportBorder) { setViewportBorder(new ViewportBorder(myViewportBorderWidth >= 0 ? myViewportBorderWidth : 1)); } }
updateViewportBorder
282,690
ViewportBorder () { return new ViewportBorder(2); }
createIndentBorder
282,691
JScrollBar () { return new JBScrollBar(Adjustable.VERTICAL); }
createVerticalScrollBar
282,692
JScrollBar () { return new JBScrollBar(Adjustable.HORIZONTAL); }
createHorizontalScrollBar
282,693
JViewport () { return new JBViewport(); }
createViewport
282,694
boolean (@NotNull MouseEvent e, @NotNull JScrollBar bar) { if (e.getID() == MouseEvent.MOUSE_MOVED || e.getID() == MouseEvent.MOUSE_PRESSED) { ScrollBarUI ui = bar.getUI(); if (ui instanceof BasicScrollBarUI bui) { try { Rectangle rect = (Rectangle)ReflectionUtil.getDeclaredMethod(BasicScrollBarUI.class, "getThumbBounds", ArrayUtil.EMPTY_CLASS_ARRAY).invoke(bui); Point point = SwingUtilities.convertPoint(e.getComponent(), e.getX(), e.getY(), bar); return !rect.contains(point); } catch (Exception e1) { return true; } } else if (ui instanceof DefaultScrollBarUI dui) { Point point = e.getLocationOnScreen(); SwingUtilities.convertPointFromScreen(point, bar); return !dui.isThumbContains(point.x, point.y); } } return true; }
canBePreprocessed
282,695
void (MouseWheelEvent e) { boolean hasAbsoluteDelta = ScrollSettings.isPixelPerfectEnabled(); myScrollSource = hasAbsoluteDelta ? ScrollSource.TOUCHPAD : ScrollSource.MOUSE_WHEEL; myWheelRotation = e.getPreciseWheelRotation(); super.processMouseWheelEvent(e); myScrollSource = ScrollSource.UNKNOWN; }
processMouseWheelEvent
282,696
void (Graphics g) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); }
paintComponent
282,697
void (Component c, Graphics g, int x, int y, int width, int height) { updateColor(c); super.paintBorder(c, g, x, y, width, height); }
paintBorder
282,698
void (Component c) { if (!(c instanceof JScrollPane)) return; lineColor = getViewBackground((JScrollPane)c); }
updateColor
282,699
Alignment (JComponent component) { if (component != null) { Object property = component.getClientProperty(Alignment.class); if (property instanceof Alignment alignment) return alignment; Container parent = component.getParent(); if (parent instanceof JScrollPane pane) { if (component == pane.getColumnHeader()) { return TOP; } if (component == pane.getHorizontalScrollBar()) { return BOTTOM; } boolean ltr = pane.getComponentOrientation().isLeftToRight(); if (component == pane.getVerticalScrollBar()) { return ltr ? RIGHT : LEFT; } if (component == pane.getRowHeader()) { return ltr ? LEFT : RIGHT; } } // assume alignment for a scroll bar, // which is not contained in a scroll pane if (component instanceof JScrollBar bar) { return switch (bar.getOrientation()) { case Adjustable.HORIZONTAL -> BOTTOM; case Adjustable.VERTICAL -> bar.getComponentOrientation().isLeftToRight() ? RIGHT : LEFT; default -> null; }; } } return null; }
get