Search in sources :

Example 1 with ScrollBarUI

use of javax.swing.plaf.ScrollBarUI in project intellij-community by JetBrains.

the class JBScrollBar method updateUI.

@Override
public void updateUI() {
    ScrollBarUI ui = getUI();
    if (ui instanceof DefaultScrollBarUI)
        return;
    setUI(createUI(this));
}
Also used : ScrollBarUI(javax.swing.plaf.ScrollBarUI)

Example 2 with ScrollBarUI

use of javax.swing.plaf.ScrollBarUI in project intellij-community by JetBrains.

the class JBScrollPane method canBePreprocessed.

public static boolean canBePreprocessed(MouseEvent e, JScrollBar bar) {
    if (e.getID() == MouseEvent.MOUSE_MOVED || e.getID() == MouseEvent.MOUSE_PRESSED) {
        ScrollBarUI ui = bar.getUI();
        if (ui instanceof BasicScrollBarUI) {
            BasicScrollBarUI bui = (BasicScrollBarUI) ui;
            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) {
            DefaultScrollBarUI dui = (DefaultScrollBarUI) ui;
            Point point = e.getLocationOnScreen();
            SwingUtilities.convertPointFromScreen(point, bar);
            return !dui.isThumbContains(point.x, point.y);
        }
    }
    return true;
}
Also used : BasicScrollBarUI(javax.swing.plaf.basic.BasicScrollBarUI) ButtonlessScrollBarUI(com.intellij.util.ui.ButtonlessScrollBarUI) BasicScrollBarUI(javax.swing.plaf.basic.BasicScrollBarUI) ScrollBarUI(javax.swing.plaf.ScrollBarUI)

Aggregations

ScrollBarUI (javax.swing.plaf.ScrollBarUI)2 ButtonlessScrollBarUI (com.intellij.util.ui.ButtonlessScrollBarUI)1 BasicScrollBarUI (javax.swing.plaf.basic.BasicScrollBarUI)1