Java 类javax.swing.plaf.basic.BasicScrollPaneUI 实例源码

项目:cn1    文件:JScrollPaneTest.java   
public void testGetSetUpdateUI() throws Exception {
    assertNotNull(pane.getUI());
    ScrollPaneUI ui = new BasicScrollPaneUI();
    pane.setUI(ui);
    assertEquals(ui, pane.getUI());
    pane.updateUI();
    assertNotSame(ui, pane.getUI());
}
项目:freeVM    文件:JScrollPaneTest.java   
public void testGetSetUpdateUI() throws Exception {
    assertNotNull(pane.getUI());
    ScrollPaneUI ui = new BasicScrollPaneUI();
    pane.setUI(ui);
    assertEquals(ui, pane.getUI());
    pane.updateUI();
    assertNotSame(ui, pane.getUI());
}
项目:freeVM    文件:JScrollPaneTest.java   
public void testGetSetUpdateUI() throws Exception {
    assertNotNull(pane.getUI());
    ScrollPaneUI ui = new BasicScrollPaneUI();
    pane.setUI(ui);
    assertEquals(ui, pane.getUI());
    pane.updateUI();
    assertNotSame(ui, pane.getUI());
}
项目:jediterm    文件:JBScrollPane.java   
@Override
public void setUI(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) {
        MouseWheelListener oldListener = (MouseWheelListener)value;
        MouseWheelListener newListener = event -> {
          if (isScrollEvent(event)) {
            Object source = event.getSource();
            if (source instanceof JScrollPane) {
              JScrollPane pane = (JScrollPane)source;
              if (pane.isWheelScrollingEnabled()) {
                JScrollBar bar = event.isShiftDown() ? pane.getHorizontalScrollBar() : pane.getVerticalScrollBar();
                if (bar != null && bar.isVisible()) oldListener.mouseWheelMoved(event);
              }
            }
          }
        };
        field.set(ui, newListener);
        // replace listener if field updated successfully
        removeMouseWheelListener(oldListener);
        addMouseWheelListener(newListener);
      }
    }
    catch (Exception exception) {
      LOG.warn(exception);
    }
  }
}
项目:samebug-idea-plugin    文件:SamebugScrollPane.java   
@Override
public void updateUI() {
    setUI(new BasicScrollPaneUI());
    setBackground(ColorService.forCurrentTheme(Background));
}