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) {
table.setModel(model); mailsListPane.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) {
JTable table = new JTable(); JScrollPane scroller = new JScrollPane(table); scroller.addComponentListener(new ScrollingTableFix(table, scroller));
/** * 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; }
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)); }
scrollPane.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) {
scroller.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) {
scroll.addComponentListener ( new ComponentAdapter ()
/** * 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(); } }
/** * 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(); } }
/** * 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(); } }
scrollPane.addComponentListener(new ComponentAdapter() {
/** * 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; }
p.addComponentListener(new ComponentListener() {
theScrollPane.addComponentListener(new ComponentAdapter()
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(); }
/** * 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 ); } }
jScrollPane1.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) {
jScrollPane1.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) {
if (currentScrollPane != null) { currentScrollPane .addComponentListener(componentListener); currentScrollPane.getVerticalScrollBar() .addAdjustmentListener(this);