Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
282,700
void (JScrollPane sp) { super.syncWithScrollPane(sp); if (sp instanceof JBScrollPane) { statusComponent = ((JBScrollPane)sp).getStatusComponent(); } }
syncWithScrollPane
282,701
void (String s, Component c) { if (s.equals(STATUS_COMPONENT)) { statusComponent = addSingletonComponent(statusComponent, c); } else { super.addLayoutComponent(s, c); } }
addLayoutComponent
282,702
void (Container parent) { JScrollPane pane = (JScrollPane)parent; // Calculate inner bounds of the scroll pane Rectangle viewportBounds = new Rectangle(pane.getWidth(), pane.getHeight()); final boolean isOverlappingScrollBar = isOverlappingScrollBar(pane); @NotNull Rectangle wholePaneBounds = viewportBounds.getBounds()...
layoutContainer
282,703
boolean (Component view) { return view instanceof Scrollable && ((Scrollable)view).getScrollableTracksViewportWidth(); }
tracksViewportWidth
282,704
boolean (Component view) { return view instanceof Scrollable && ((Scrollable)view).getScrollableTracksViewportHeight(); }
tracksViewportHeight
282,705
Dimension (Container parent) { Dimension result = new Dimension(); JScrollPane pane = (JScrollPane)parent; JBInsets.addTo(result, pane.getInsets()); Border border = pane.getViewportBorder(); if (border != null) JBInsets.addTo(result, border.getBorderInsets(parent)); int vsbPolicy = pane.getVerticalScrollBarPolicy(); in...
preferredLayoutSize
282,706
boolean (JScrollPane scrollPane) { return (scrollPane instanceof JBScrollPane) && ((JBScrollPane)scrollPane).isOverlappingScrollBar(); }
isOverlappingScrollBar
282,707
boolean (Component view) { return !SystemInfo.isMac && ScrollSettings.isNotSupportedYet(view); }
isAlwaysOpaque
282,708
void (Rectangle bounds, int x, int y) { bounds.width = Math.abs(bounds.x - x); bounds.height = Math.abs(bounds.y - y); bounds.x = Math.min(bounds.x, x); bounds.y = Math.min(bounds.y, y); }
updateCornerBounds
282,709
void (Component component, int index) { if (component != null) { Container parent = component.getParent(); synchronized (parent.getTreeLock()) { if (index < 0) index += parent.getComponentCount(); parent.setComponentZOrder(component, index); } } }
fixComponentZOrder
282,710
void (Rectangle bounds, Insets insets, Rectangle vsbBounds, boolean vsbRequiresSpace, boolean vsbOnLeft, boolean vsbOverlapping, @NotNull Rectangle wholePaneBounds) { vsbBounds.width = vsb.isEnabled() ? min(bounds.width, vsb.getPreferredSize().width) : 0; if (vsbOnLeft) { if (vsbOverlapping) { vsbBounds.x = 0; } else {...
adjustForVSB
282,711
void (Rectangle bounds, Insets insets, Rectangle hsbBounds, boolean hsbRequiresSpace, boolean hsbOnTop, boolean hsbOverlapping, @NotNull Rectangle wholePaneBounds) { hsbBounds.height = hsb.isEnabled() ? min(bounds.height, hsb.getPreferredSize().height) : 0; if (hsbOnTop) { if (hsbOverlapping) { hsbBounds.y = 0; } else ...
adjustForHSB
282,712
int (int one, int two) { return Math.max(0, Math.min(one, two)); }
min
282,713
boolean (int location, int preferredSize, int extentSize) { return preferredSize > extentSize || location != 0; }
isScrollBarNeeded
282,714
boolean (Component view, Point location, Dimension preferredSize, Dimension extentSize) { // don't bother Scrollable.getScrollableTracksViewportWidth if a horizontal scroll bar is not needed return isScrollBarNeeded(location.x, preferredSize.width, extentSize.width) && !tracksViewportWidth(view); }
isHorizontalScrollBarNeeded
282,715
boolean (Component view, Point location, Dimension preferredSize, Dimension extentSize) { // don't bother Scrollable.getScrollableTracksViewportHeight if a vertical scroll bar is not needed return isScrollBarNeeded(location.y, preferredSize.height, extentSize.height) && !tracksViewportHeight(view); }
isVerticalScrollBarNeeded
282,716
boolean (@NotNull MouseWheelEvent event) { // event should not be consumed already if (event.isConsumed()) return false; // any rotation expected (forward or backward) boolean ignore = event.getWheelRotation() == 0; if (ignore && (ScrollSettings.isPixelPerfectEnabled() || ScrollSettings.isHighPrecisionEnabled())) { dou...
isScrollEvent
282,717
RegionPainter<Float> (@NotNull Supplier<? extends Component> supplier) { return new ScrollBarPainter.Thumb(supplier, SystemInfo.isMac); }
getThumbPainter
282,718
Graphics (Graphics graphics) { return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics)); }
getComponentGraphics
282,719
void () { SwingUndoUtil.addUndoRedoActions(this); myEmptyText = new TextComponentEmptyText(this, true) { @Override protected Rectangle getTextComponentBound() { return getEmptyTextComponentBounds(super.getTextComponentBound()); } }; }
init
282,720
Rectangle () { return getEmptyTextComponentBounds(super.getTextComponentBound()); }
getTextComponentBound
282,721
Rectangle (Rectangle bounds) { return bounds; }
getEmptyTextComponentBounds
282,722
void (String t) { myEmptyText.setTextToTriggerStatus(t); }
setTextToTriggerEmptyTextStatus
282,723
void (String t) { if (Objects.equals(t, getText())) return; super.setText(t); SwingUndoUtil.resetUndoRedoActions(this); }
setText
282,724
StatusText () { return myEmptyText; }
getEmptyText
282,725
void () { super.updateUI(); if (getParent() != null) myEmptyText.resetFont(); }
updateUI
282,726
void (Graphics g) { super.paintComponent(g); if (!myEmptyText.getStatusTriggerText().isEmpty() && myEmptyText.isStatusVisible()) { g.setColor(getBackground()); Rectangle rect = new Rectangle(getSize()); JBInsets.removeFrom(rect, getInsets()); JBInsets.removeFrom(rect, getMargin()); ((Graphics2D)g).fill(rect); g.setColo...
paintComponent
282,727
String (MouseEvent event) { TextUI ui = getUI(); String text = ui == null ? null : ui.getToolTipText2D(this, event.getPoint()); return text != null ? text : getToolTipText(); }
getToolTipText
282,728
Insets (boolean small) { return JBUI.emptyInsets(); }
getInsets
282,729
void (Component component, Object name, int index) { Key<Component> key = LEADING.equals(name) ? DefaultScrollBarUI.LEADING : TRAILING.equals(name) ? DefaultScrollBarUI.TRAILING : null; if (key != null) { Component old = ClientProperty.get(this, key); ClientProperty.put(this, key, component); if (old != null) { remove(...
addImpl
282,730
void () { ScrollBarUI ui = getUI(); if (ui instanceof DefaultScrollBarUI) return; setUI(createUI(this, isThin())); }
updateUI
282,731
ScrollBarUI (JComponent c) { return createUI(c, false); }
createUI
282,732
ScrollBarUI (JComponent c, boolean isThin) { if (SystemInfo.isMac) { return isThin ? new ThinMacScrollBarUI() : new MacScrollBarUI(); } else { return isThin ? new ThinScrollBarUI() : new DefaultScrollBarUI(); } }
createUI
282,733
int (int direction) { JViewport viewport = getViewport(); if (viewport != null) { Scrollable scrollable = getScrollableViewToCalculateIncrement(viewport.getView()); if (scrollable != null) return scrollable.getScrollableUnitIncrement(viewport.getViewRect(), orientation, direction); if (!isUnitIncrementSet) { Font font ...
getUnitIncrement
282,734
void (int increment) { isUnitIncrementSet = true; super.setUnitIncrement(increment); }
setUnitIncrement
282,735
void (boolean isOn) { ScrollBarUI ui = getUI(); if (ui instanceof DefaultScrollBarUI) { ((DefaultScrollBarUI)ui).toggle(isOn); } }
toggle
282,736
int (int direction) { JViewport viewport = getViewport(); if (viewport != null) { Scrollable scrollable = getScrollableViewToCalculateIncrement(viewport.getView()); if (scrollable != null) return scrollable.getScrollableBlockIncrement(viewport.getViewRect(), orientation, direction); if (!isBlockIncrementSet) { Dimensio...
getBlockIncrement
282,737
void (int increment) { isBlockIncrementSet = true; super.setBlockIncrement(increment); }
setBlockIncrement
282,738
boolean (@NotNull MouseEvent event) { return JBScrollPane.canBePreprocessed(event, this); }
canBePreprocessed
282,739
void (int value) { int delay = 0; Component parent = getParent(); if (parent instanceof JBScrollPane pane) { JViewport viewport = pane.getViewport(); if (viewport != null && ScrollSettings.isEligibleFor(viewport.getView()) && ScrollSettings.isInterpolationEligibleFor(this)) { delay = pane.getInitialDelay(getValueIsAdju...
setValue
282,740
void (int value) { super.setValue(value); myFractionalRemainder = 0.0; }
setCurrentValue
282,741
int () { return myInterpolator.getTarget(); }
getTargetValue
282,742
boolean (MouseWheelEvent event) { if (!isSupportedScrollType(event)) return false; if (event.isShiftDown() == (orientation == VERTICAL)) return false; if (!ScrollSettings.isEligibleFor(this)) return false; double delta = getPreciseDelta(event); if (!Double.isFinite(delta)) return false; int value = getTargetValue(); do...
handleMouseWheelEvent
282,743
boolean (MouseWheelEvent e) { return e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL || TouchScrollUtil.isUpdate(e); }
isSupportedScrollType
282,744
JViewport () { Component parent = getParent(); if (parent instanceof JScrollPane pane) { return pane.getViewport(); } return null; }
getViewport
282,745
Font (JViewport viewport) { if (viewport == null) return null; Component view = viewport.getView(); return view == null ? null : view.getFont(); }
getViewFont
282,746
Scrollable (Component view) { return view instanceof JTable || (view instanceof Scrollable && orientation == VERTICAL) ? (Scrollable)view : null; }
getScrollableViewToCalculateIncrement
282,747
double (double minDelta, double maxDelta, double delta) { return Math.max(minDelta, Math.min(maxDelta, delta)); }
boundDelta
282,748
double (MouseWheelEvent event) { int value = getTargetValue(); double delta = getPreciseDelta(event); return getDeltaAdjusted(value, delta); }
getDeltaAdjusted
282,749
double (int value, double delta) { double minDelta = getMinimum() - value; double maxDelta = getMaximum() - getVisibleAmount() - value; return Math.max(minDelta, Math.min(maxDelta, delta)); }
getDeltaAdjusted
282,750
double (MouseWheelEvent event) { if (TouchScrollUtil.isTouchScroll(event)) { return TouchScrollUtil.getDelta(event); } double rotation = event.getPreciseWheelRotation(); if (ScrollSettings.isPixelPerfectEnabled()) { // calculate an absolute delta if possible if (SystemInfo.isMac) { // Native code in our JDK for Mac use...
getPreciseDelta
282,751
boolean () { return false; }
isThin
282,752
void () { if (getValueIsAdjusting() && ScrollSource.SCROLLBAR.isInterpolationEnabled()) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ChangeListener.class) { ChangeListener listener = (ChangeListener)listeners[i + 1]; // ignore listeners ...
fireStateChanged
282,753
JBLabelDecorator () { return new JBLabelDecorator(); }
createJBLabelDecorator
282,754
JBLabelDecorator (@NlsContexts.Label String text) { return new JBLabelDecorator(text); }
createJBLabelDecorator
282,755
JBLabelDecorator (boolean isBold) { if (isBold) { setFont(getFont().deriveFont(Font.BOLD)); } else { setFont(getFont().deriveFont(Font.PLAIN)); } return this; }
setBold
282,756
JBLabelDecorator (@NotNull UIUtil.ComponentStyle componentStyle) { super.setComponentStyle(componentStyle); return this; }
setComponentStyleDecorative
282,757
JBLabelDecorator (@NotNull UIUtil.FontColor fontColor) { super.setFontColor(fontColor); return this; }
setFontColorDecorative
282,758
void (Graphics g) { if (myCachedImage != null && myMagnificationPoint != null) { double scale = magnificationToScale(myMagnification); int xOffset = (int)(myMagnificationPoint.x - myMagnificationPoint.x * scale); int yOffset = (int)(myMagnificationPoint.y - myMagnificationPoint.y * scale); Rectangle clip = g.getClipBou...
paint
282,759
void (@NotNull Point at) { myMagnificationPoint = at; }
magnificationStarted
282,760
void (double magnification) { Magnificator magnificator = ((ZoomableViewport)myViewportComponent).getMagnificator(); if (magnificator != null && Double.compare(magnification, 0) != 0) { Point inContent = convertToContentCoordinates(myMagnificationPoint); final Point inContentScaled = magnificator.magnify(magnificationT...
magnificationFinished
282,761
void (int vOffset, int hOffset) { JScrollPane pane = ComponentUtil.getScrollPane(myViewportComponent); JScrollBar vsb = pane == null ? null : pane.getVerticalScrollBar(); if (vsb != null) vsb.setValue(vOffset); JScrollBar hsb = pane == null ? null : pane.getHorizontalScrollBar(); if (hsb != null) hsb.setValue(hOffset);...
scrollTo
282,762
Point (Point point) { return SwingUtilities.convertPoint(myViewportComponent, point, myContentComponent); }
convertToContentCoordinates
282,763
boolean () { return myCachedImage != null; }
isActive
282,764
double (double magnification) { return magnification < 0 ? 1f / (1 - magnification) : (1 + magnification); }
magnificationToScale
282,765
void (double magnification) { double prev = myMagnification; myMagnification = magnification; if (myCachedImage == null) { Rectangle bounds = myViewportComponent.getBounds(); if (bounds.width <= 0 || bounds.height <= 0) return; BufferedImage image = ImageUtil.createImage(myViewportComponent.getGraphics(), bounds.width,...
magnify
282,766
AccessibleContext () { if (accessibleContext == null) { accessibleContext = new AccessibleJBMenu(); } return accessibleContext; }
getAccessibleContext
282,767
AccessibleStateSet () { AccessibleStateSet set = super.getAccessibleStateSet(); // Due to a bug in JMenu, CHECKED is added if the menu is enabled. That // is incorrect -- checked should be added only in the case of a "checkbox" // style menu. set.remove(AccessibleState.CHECKED); return set; }
getAccessibleStateSet
282,768
void () { if (fireEvents) { super.fireStateChanged(); } }
fireStateChanged
282,769
void (int n) { fireEvents = false; try { setValue(n); } finally { fireEvents = true; } }
setValueWithoutEvents
282,770
Component (@NotNull JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @SuppressWarnings({"unchecked"}) final JComponent comp = myFun.fun((T)value); comp.setOpaque(true); if (isSelected) { comp.setBackground(list.getSelectionBackground()); comp.setForeground(list.getSelectionForeground());...
getListCellRendererComponent
282,771
void (@NlsContexts.Button String onText) { myOnText = onText; }
setOnText
282,772
void (@NlsContexts.Button String offText) { myOffText = offText; }
setOffText
282,773
ComponentUI (JComponent c) { c.setAlignmentY(0.5f); return new DefaultOnOffButtonUI(); }
createUI
282,774
Dimension (JComponent c) { int vGap = JBUIScale.scale(3); OnOffButton button = (OnOffButton)c; String text = button.getOffText().length() > button.getOnText().length() ? button.getOffText() : button.getOnText(); text = text.toUpperCase(Locale.getDefault()); FontMetrics fm = c.getFontMetrics(c.getFont()); int w = fm.str...
getPreferredSize
282,775
void (Graphics g, JComponent c) { if (!(c instanceof OnOffButton button)) return; int toggleArc = JBUIScale.scale(3); int buttonArc = JBUIScale.scale(5); int vGap = JBUIScale.scale(3); int hGap = JBUIScale.scale(3); Dimension size = button.getSize(); int w = size.width - 2 * vGap; int h = size.height - 2 * hGap; if (h ...
paint
282,776
Dimension (JComponent c) { return getPreferredSize(c); }
getMinimumSize
282,777
Dimension (JComponent c) { return getPreferredSize(c); }
getMaximumSize
282,778
Insets (boolean small) { return JBUI.emptyInsets(); }
getInsets
282,779
void (MacScrollBarUI.Style style) { super.updateStyle(Style.Overlay); }
updateStyle
282,780
int () { return myModel.getSize(); }
getSize
282,781
void (Graphics g, JComponent c) { // do not paint a line background if layout orientation is not vertical myPaintBounds = JList.VERTICAL != list.getLayoutOrientation() ? null : g.getClipBounds(); super.paint(g, c); }
paint
282,782
void (Graphics g, int row, Rectangle rowBounds, ListCellRenderer renderer, ListModel model, ListSelectionModel selectionModel, int leadSelectionIndex) { if (!(0 <= row && row < model.getSize())) return; boolean selected = selectionModel.isSelectedIndex(row); Rectangle paintBounds = myPaintBounds; if (paintBounds != nul...
paintCell
282,783
boolean (@NotNull JList list, int row) { return list.getMinSelectionIndex() < list.getMaxSelectionIndex() && list.isSelectedIndex(row - 1) && list.isSelectedIndex(row + 1); }
isLeadSelectionNeeded
282,784
Color (@NotNull JList<Object> list, @Nullable Object value, int row, boolean selected) { // to be consistent with com.intellij.ui.tree.ui.DefaultTreeUI#getBackground if (selected) { return RenderingUtil.getSelectionBackground(list); } if (row == ListHoverListener.getHoveredIndex(list)) { Color background = RenderingUti...
getBackground
282,785
void (Graphics g, int x, int y, int width, int height, Component owner, Component renderer) { g.clipRect(0, y, owner.getWidth(), height); paintBackground(g, y, height, owner, renderer); if (renderer instanceof Container) { Component[] children; Container container = (Container)renderer; synchronized (container.getTreeL...
paintRenderer
282,786
void (Graphics g, int y, int height, Component owner, Component child) { if (child.isOpaque()) { Color color = child.getBackground(); if (color != null && !color.equals(owner.getBackground())) { g.setColor(color); g.fillRect(0, y, owner.getWidth(), height); } } }
paintBackground
282,787
Rectangle (JList list, int index1, int index2) { Rectangle bounds = super.getCellBounds(list, index1, index2); if (bounds != null && index1 == index2 && list instanceof JBList && JList.VERTICAL == list.getLayoutOrientation()) { if (((JBList<?>)list).getExpandableItemsHandler().getExpandedItems().contains(index1)) { // ...
getCellBounds
282,788
void () { if (list.getLayoutOrientation() != JList.VERTICAL) { super.updateLayoutState(); return; } // pasted from BasicListUI to provide min-height int fixedCellHeight = list.getFixedCellHeight(); int fixedCellWidth = list.getFixedCellWidth(); cellWidth = fixedCellWidth; if (fixedCellHeight != -1) { cellHeight = fixed...
updateLayoutState
282,789
ComponentUI (JComponent list) { return new WideSelectionListUI(); }
createUI
282,790
int () { return Math.min(myMaxRows, getSize()); }
getRowCount
282,791
int () { final int rows = getRowCount(); return rows == 0 ? 0 : getSize() / rows + 1; }
getColumnCount
282,792
int (int row, int column) { final int rows = getRowCount(); return rows == 0 ? -1 : column * rows + row; }
toListIndex
282,793
int (int listIndex) { return listIndex / myMaxRows; }
getColumn
282,794
int (int listIndex) { return listIndex % myMaxRows; }
getRow
282,795
void (Border border) { super.setBorder(border); MultiColumnList.this.setBorder(border); }
setBorder
282,796
void () { MultiColumnList.this.repaint(); }
repaint
282,797
void (ListCellRenderer cellRenderer) { super.setCellRenderer(cellRenderer); if (myRenderer != cellRenderer) { MultiColumnList.this.setCellRenderer(cellRenderer); } }
setCellRenderer
282,798
void (KeyEvent e) { final int key = e.getKeyCode(); final int col = getSelectedColumn(); final int row = getSelectedRow(); final MultiColumnListModel model = getModel(); int r = row; int c = col; if (key == KeyEvent.VK_RIGHT) { if (c + 1 < getColumnCount()) { c++; } } else if (key == KeyEvent.VK_DOWN) { if (r + 1 < get...
processKeyEvent
282,799
ListModel (Object...elements) { final DefaultListModel model = new DefaultListModel(); for (Object element : elements) { model.addElement(element); } return model; }
createListModel