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

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

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

JScrollPane.validate介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

/**
 * Remove all trees from the display
 */
public void clearMatches() {
 JPanel spaceholder = new JPanel();
 spaceholder.setBackground(Color.white);
 scroller.setViewportView(spaceholder);
 scroller.validate();
 scroller.repaint();
 matchedPartCoordinates = null;
 matchedPartCoordinateIdx = -1;
}

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

/**
 * Remove all trees from the display
 */
public void clearMatches() {
 JPanel spaceholder = new JPanel();
 spaceholder.setBackground(Color.white);
 scroller.setViewportView(spaceholder);
 scroller.validate();
 scroller.repaint();
 matchedPartCoordinates = null;
 matchedPartCoordinateIdx = -1;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors

public void run() {
    tree.validate();
    targetScroll.validate();
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-jsfsupport-designtime

public void run() {
    tree.validate();
    targetScroll.validate();
  }
});

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

private void scrollDown() {
  scroll.validate();
  scroll.getVerticalScrollBar().setValue(scroll.getVerticalScrollBar().getMaximum());
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      scroll.getVerticalScrollBar().setValue(scroll.getVerticalScrollBar().getMaximum());
    }
  });
}

代码示例来源:origin: org.apache.river.examples/browser

public void actionPerformed(ActionEvent ev) {
 String result = JOptionPane.showInputDialog(ListerFrame.this, getAddMessage());
 if(result != null){
  StringTokenizer st = new StringTokenizer(result);
  String[] tokens = new String[st.countTokens()];
  for(int i = 0; i < tokens.length; i++)
   tokens[i] = st.nextToken().trim();
  addItems(tokens);
  resetListModel();
  scrollPane.validate();
 }
}
 }));

代码示例来源:origin: org.openbase.bco/dal.visual

private void updateDynamicComponents() {
  LOGGER.debug("update " + unitPanelMap.values().size() + " components.");
  synchronized (unitPanelMapLock) {
    contentPanel.removeAll();
    for (JComponent component : unitPanelMap.values()) {
      contentPanel.add(component);
    }
    LayoutGenerator.generateHorizontalLayout(contentPanel, unitPanelMap.values());
  }
  contentPanel.validate();
  contentPanel.revalidate();
  contentScrollPane.validate();
  contentScrollPane.revalidate();
  this.validate();
  this.revalidate();
}

代码示例来源:origin: net.automatalib/automata-commons-dotutil

@Override
  public void valueChanged(ListSelectionEvent e) {
    int idx = listBox.getSelectedIndex();
    boolean activeSelection = (idx != -1);
    if(!activeSelection)
      imgComponent.setImage(null);
    else {
      PlottedGraph pg = graphs.get(idx);
      imgComponent.setImage(pg.getImage());
    }
    saveDotAction.setEnabled(activeSelection);
    savePngAction.setEnabled(activeSelection);
    renameAction.setEnabled(activeSelection);
    scrollPane.validate();
  }
});

代码示例来源:origin: org.apache.river.examples/browser

public void actionPerformed(ActionEvent ev) {
 Object[] selected = listBox.getSelectedValues();
 if(selected == null || selected.length == 0){
  // no items are selected
  JOptionPane.showMessageDialog(ListerFrame.this,
         "No items are selected",
         "Warning",
         JOptionPane.WARNING_MESSAGE);
  return;
 }
 int result = JOptionPane.showConfirmDialog(ListerFrame.this,
             getRemoveMessage(selected),
             "Query",
             JOptionPane.YES_NO_OPTION);

 if(result == JOptionPane.YES_OPTION){
  removeItems(selected);
  resetListModel();
  scrollPane.validate();
 }
}
 }));

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

private void moveMouseWithDrag(Point p){
  Rectangle visibleHeight=container.getViewport().getViewRect();
  DefaultMutableTreeNode dmtn=this.findNode(p);
  if (visibleHeight.height-p.y<40){
    container.validate();
    container.getVerticalScrollBar().setValue(container.getVerticalScrollBar().getValue()+10);
  }
  if ((p.y-visibleHeight.y<40) && (container.getVerticalScrollBar().getValue()>10)){
    container.validate();
    container.getVerticalScrollBar().setValue(container.getVerticalScrollBar().getValue()-10);
  }
  // this.getLocation()
  if (dmtn!=null){
    this.setSelectionPath(new TreePath(dmtn.getPath()));
  } else {
  }
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Redo the layout.
 */
public void relayout ()
{
  mMainPanel.invalidate ();
  mMainScroller.invalidate ();
  mMainScroller.validate ();
  mMainScroller.repaint ();
}

代码示例来源:origin: org.apache.river.examples/browser

public EntryTreePanel(boolean isControllable) {
 this.isControllable = isControllable;
 // Init this panel
 setLayout(new BorderLayout());
 // Init tree node and model (attribute tree nodes)
 root = new ObjectNode(isControllable);
 //initTree();
 model = new DefaultTreeModel(root);
 // Init tree view
 tree = new JTree(model);
 //tree.addMouseListener(new DoubleClicker(this));
 tree.setRootVisible(false);
 ObjectNodeRenderer renderer = new ObjectNodeRenderer();
 tree.setCellRenderer(renderer);
 tree.setRowHeight(0);	// let the renderer handle it
 scrollPane = new JScrollPane(tree);
 add(scrollPane, "Center");
 tree.validate();
 scrollPane.validate();
}

代码示例来源:origin: igniterealtime/Spark

/**
 * Removes a ContactGroup from the group model and ContactList.
 *
 * @param contactGroup the ContactGroup to remove.
 */
private void removeContactGroup(ContactGroup contactGroup) {
  contactGroup.removeContactGroupListener(this);
  groupList.remove(contactGroup);
  mainPanel.remove(contactGroup);
  ContactGroup parent = getParentGroup(contactGroup.getGroupName());
  if (parent != null) {
    parent.removeContactGroup(contactGroup);
  }
  contactListScrollPane.validate();
  mainPanel.invalidate();
  mainPanel.repaint();
  fireContactGroupRemoved(contactGroup);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore

public void repaint() {
  //TODO FIX: NPE when playing with window cloning
  m_imageContainer.setTryPaint();
  m_animatorView.invalidate();
  m_topComponent.validate(); 
  m_animatorView.repaint();
  m_topComponent.repaint();
}

代码示例来源:origin: org.apache.river.examples/browser

public void refreshPanel() {
 // reconstruct nodes
 root.removeAllChildren();
 initTree();
 
 model.nodeStructureChanged(root);
 tree.validate();
 scrollPane.validate();
}

代码示例来源:origin: net.imagej/ij-ui-swing

public void setNormalSize() {
  JScrollPane scrollPane = getScrollPane();
  Insets scrollInsets = getScrollPaneInsets();
  
  if (scrollPane != null) {
    Dimension d = scrollPane.getVisibleRect().getSize();
    if (scrollPane.getBorder() != null) {
      d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right,
          d.getHeight() - scrollInsets.top - scrollInsets.bottom);
    }
    
    d.setSize(d.getWidth() - 20, d.getHeight() - 20);
    desktop.setAllSize(d);
    scrollPane.invalidate();
    scrollPane.validate();
  }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

public void setNormalSize() {
  JScrollPane scrollPane = getScrollPane();
  Insets scrollInsets = getScrollPaneInsets();
  
  if (scrollPane != null) {
    Dimension d = scrollPane.getVisibleRect().getSize();
    if (scrollPane.getBorder() != null) {
      d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right,
          d.getHeight() - scrollInsets.top - scrollInsets.bottom);
    }
    
    d.setSize(d.getWidth() - 20, d.getHeight() - 20);
    desktop.setAllSize(d);
    scrollPane.invalidate();
    scrollPane.validate();
  }
}

代码示例来源:origin: org.scijava/scijava-ui-swing

public void setNormalSize() {
  JScrollPane scrollPane = getScrollPane();
  Insets scrollInsets = getScrollPaneInsets();
  
  if (scrollPane != null) {
    Dimension d = scrollPane.getVisibleRect().getSize();
    if (scrollPane.getBorder() != null) {
      d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right,
          d.getHeight() - scrollInsets.top - scrollInsets.bottom);
    }
    
    d.setSize(d.getWidth() - 20, d.getHeight() - 20);
    desktop.setAllSize(d);
    scrollPane.invalidate();
    scrollPane.validate();
  }
}

代码示例来源:origin: fcrepo3/fcrepo

public void setNormalSize() {
  JScrollPane scrollPane = getScrollPane();
  int x = 0;
  int y = 0;
  Insets scrollInsets = getScrollPaneInsets();
  if (scrollPane != null) {
    Dimension d = scrollPane.getVisibleRect().getSize();
    if (scrollPane.getBorder() != null) {
      d
          .setSize(d.getWidth() - scrollInsets.left
              - scrollInsets.right, d.getHeight()
              - scrollInsets.top - scrollInsets.bottom);
    }
    d.setSize(d.getWidth() - 20, d.getHeight() - 20);
    desktop.setAllSize(x, y);
    scrollPane.invalidate();
    scrollPane.validate();
  }
}

代码示例来源: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();
}

相关文章

JScrollPane类方法