javax.swing.JScrollPane.addComponentListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中javax.swing.JScrollPane.addComponentListener()方法的一些代码示例,展示了JScrollPane.addComponentListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.addComponentListener()方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:addComponentListener

JScrollPane.addComponentListener介绍

暂无

代码示例

代码示例来源:origin: nodebox/nodebox

JScrollPane examplesScroll = new JScrollPane(examplesPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
examplesScroll.setBorder(null);
examplesScroll.addComponentListener(new ComponentAdapter() {
  @Override
  public void componentResized(ComponentEvent e) {

代码示例来源:origin: Nilhcem/FakeSMTP

table.setModel(model);
mailsListPane.addComponentListener(new ComponentAdapter() {
  public void componentResized(ComponentEvent e) {

代码示例来源:origin: stackoverflow.com

JTable table = new JTable();
JScrollPane scroller = new JScrollPane(table);
scroller.addComponentListener(new ScrollingTableFix(table, scroller));

代码示例来源:origin: robo-code/robocode

/**
 * Return the JScrollPane1 property value.
 *
 * @return JScrollPane
 */
private JScrollPane getAvailableRobotsScrollPane() {
  if (availableRobotsScrollPane == null) {
    availableRobotsScrollPane = new JScrollPane();
    availableRobotsScrollPane.setViewportView(getAvailableRobotsList());
    // Bug fix [2975871] - Minor visual bug - Currently selected robot gets covered
    availableRobotsScrollPane.addComponentListener(new ComponentAdapter() {
      public void componentResized(ComponentEvent e) {
        getAvailableRobotsList().ensureIndexIsVisible(getAvailableRobotsList().getSelectedIndex());
      }
    });
  }
  return availableRobotsScrollPane;
}

代码示例来源:origin: aterai/java-swing-tips

private MainPanel() {
 super(new BorderLayout());
 JScrollPane scroll = new JScrollPane(table);
 scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
 scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
 scroll.addComponentListener(new ComponentAdapter() {
  @Override public void componentResized(ComponentEvent e) {
   Component c = e.getComponent();
   if (c instanceof JScrollPane) {
    ((JScrollPane) c).getViewport().getView().revalidate();
   }
  }
 });
 JButton button = new JButton("add");
 button.addActionListener(e -> model.addRow(new Object[] {"", 0, false}));
 add(scroll);
 add(button, BorderLayout.SOUTH);
 setPreferredSize(new Dimension(320, 240));
}

代码示例来源:origin: stackoverflow.com

scrollPane.addComponentListener(new ComponentAdapter() {   
  @Override
  public void componentResized(ComponentEvent e) {

代码示例来源:origin: stackoverflow.com

scroller.addComponentListener(new ComponentAdapter() {
  @Override
  public void componentResized(ComponentEvent e) {

代码示例来源:origin: stackoverflow.com

scroll.addComponentListener ( new ComponentAdapter ()

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

/**
 * The method is invoked by {@link #addNotify} and {@link #removeNotify} to
 * ensure that any enclosing {@link JScrollPane} works correctly with this
 * panel. This method can be safely invoked with a <tt>null</tt> scrollPane.
 *
 * @param scrollPane the enclosing {@link JScrollPane} or <tt>null</tt> if
 *                   the panel is no longer enclosed in a {@link JScrollPane}.
 */
protected void setEnclosingScrollPane(JScrollPane scrollPane) {
  // if a scrollpane is already installed we remove it.
  if (enclosingScrollPane != null) {
    enclosingScrollPane.removeComponentListener(this);
  }
  enclosingScrollPane = scrollPane;
  if (enclosingScrollPane != null) {
    Uu.p("added root panel as a component listener to the scroll pane");
    enclosingScrollPane.addComponentListener(this);
    default_scroll_mode = enclosingScrollPane.getViewport().getScrollMode();
  }
}

代码示例来源:origin: org.docx4j/xhtmlrenderer

/**
 * The method is invoked by {@link #addNotify} and {@link #removeNotify} to
 * ensure that any enclosing {@link JScrollPane} works correctly with this
 * panel. This method can be safely invoked with a <tt>null</tt> scrollPane.
 *
 * @param scrollPane the enclosing {@link JScrollPane} or <tt>null</tt> if
 *                   the panel is no longer enclosed in a {@link JScrollPane}.
 */
protected void setEnclosingScrollPane(JScrollPane scrollPane) {
  // if a scrollpane is already installed we remove it.
  if (enclosingScrollPane != null) {
    enclosingScrollPane.removeComponentListener(this);
  }
  enclosingScrollPane = scrollPane;
  if (enclosingScrollPane != null) {
    Uu.p("added root panel as a component listener to the scroll pane");
    enclosingScrollPane.addComponentListener(this);
    default_scroll_mode = enclosingScrollPane.getViewport().getScrollMode();
  }
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

/**
 * The method is invoked by {@link #addNotify} and {@link #removeNotify} to
 * ensure that any enclosing {@link JScrollPane} works correctly with this
 * panel. This method can be safely invoked with a <tt>null</tt> scrollPane.
 *
 * @param scrollPane the enclosing {@link JScrollPane} or <tt>null</tt> if
 *                   the panel is no longer enclosed in a {@link JScrollPane}.
 */
protected void setEnclosingScrollPane(JScrollPane scrollPane) {
  // if a scrollpane is already installed we remove it.
  if (enclosingScrollPane != null) {
    enclosingScrollPane.removeComponentListener(this);
  }
  enclosingScrollPane = scrollPane;
  if (enclosingScrollPane != null) {
    Uu.p("added root panel as a component listener to the scroll pane");
    enclosingScrollPane.addComponentListener(this);
    default_scroll_mode = enclosingScrollPane.getViewport().getScrollMode();
  }
}

代码示例来源:origin: SeeSharpSoft/intellij-csv-validator

scrollPane.addComponentListener(new ComponentAdapter() {

代码示例来源:origin: robo-code/robocode

/**
 * Return the scroll pane
 *
 * @return JScrollPane
 */
protected JScrollPane getScrollPane() {
  if (scrollPane == null) {
    scrollPane = new JScrollPane();
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE);
    scrollPane.setViewportView(getTable());
    scrollPane.setColumnHeaderView(table.getTableHeader());
    scrollPane.addComponentListener(eventHandler);
    tableSize = new Dimension(getTable().getColumnModel().getTotalColumnWidth(),
        getTable().getModel().getRowCount() * (getTable().getRowHeight()));
    table.setPreferredScrollableViewportSize(tableSize);
    table.setPreferredSize(tableSize);
    table.setMinimumSize(tableSize);
  }
  return scrollPane;
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

p.addComponentListener(new ComponentListener() {

代码示例来源:origin: violetumleditor/violetumleditor

theScrollPane.addComponentListener(new ComponentAdapter()

代码示例来源:origin: org.icepdf.os/icepdf-viewer

public void setDocument(Document newDocument) {
  // clean up any previous documents
  if (document != null) {
    document.dispose();
    document = null;
  }
  document = newDocument;
  // clean up old document model and create a new one
  if (documentViewModel != null) {
    documentViewModel.dispose();
    documentViewModel = null;
  }
  documentViewModel = createDocumentViewMode(document, documentViewScrollPane);
  // setup view type
  setViewType();
  // remove re-size listener.
  documentViewScrollPane.addComponentListener(this);
  documentViewScrollPane.validate();
}

代码示例来源:origin: jawi/ols

/**
 * If this component is the <code>viewportView</code> of an enclosing
 * <code>JScrollPane</code> (the usual situation), configure this
 * <code>ScrollPane</code> by, amongst other things, installing the diagram's
 * <code>timeline</code> as the <code>columnHeaderView</code> of the scroll
 * pane.
 * 
 * @see #addNotify
 */
private void configureEnclosingScrollPane()
{
 JScrollPane scrollPane = getAncestorOfClass( JScrollPane.class, this );
 if ( scrollPane != null )
 {
  // Make certain we are the viewPort's view and not, for
  // example, the rowHeaderView of the scrollPane -
  // an implementor of fixed columns might do this.
  final JViewport viewport = scrollPane.getViewport();
  if ( ( viewport == null ) || ( viewport.getView() != this ) )
  {
   return;
  }
  final TimeLineView timelineView = TimeLineView.create( this.controller );
  scrollPane.setColumnHeaderView( timelineView );
  final ChannelLabelsView channelLabelsView = ChannelLabelsView.create( this.controller );
  scrollPane.setRowHeaderView( channelLabelsView );
  scrollPane.setCorner( ScrollPaneConstants.UPPER_LEADING_CORNER, new CornerView( this.controller ) );
  scrollPane.addComponentListener( this.componentHandler );
 }
}

代码示例来源:origin: digital-preservation/droid

jScrollPane1.addComponentListener(new ComponentAdapter() {
  @Override
  public void componentResized(ComponentEvent e) {

代码示例来源:origin: uk.gov.nationalarchives/droid-ui

jScrollPane1.addComponentListener(new ComponentAdapter() {
  @Override
  public void componentResized(ComponentEvent e) {

代码示例来源:origin: net.sf.ingenias/ingeniasjgraphmod

if (currentScrollPane != null) {
  currentScrollPane
      .addComponentListener(componentListener);
  currentScrollPane.getVerticalScrollBar()
      .addAdjustmentListener(this);

相关文章

JScrollPane类方法