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

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

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

JScrollPane.getParent介绍

暂无

代码示例

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

/**
   * Displays a message dialog containing the error specified in parameter.
   *
   * @param error a String representing an error message to display.
   */
  private void displayError(String error) {
    JOptionPane.showMessageDialog(mailsListPane.getParent(), error,
      String.format(i18n.get("mailslist.err.title"), Configuration.INSTANCE.get("application.name")),
      JOptionPane.ERROR_MESSAGE);
  }
}

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

public void hierarchyChanged(HierarchyEvent e) {
    if (jcomp.getParent() instanceof ComboPopup) {
      if (scrollPaneSelector != null) {
        scrollPaneSelector.uninstallFromScrollPane();
        scrollPaneSelector = null;
      }
    }
  }
};

代码示例来源:origin: org.netbeans.api/org-jruby

public void destroy() {
  Container parent = scrollPane.getParent();
  adaptor.shutdown();
  if (parent != null) {
    parent.remove(scrollPane);
  }
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

public void mouseClicked(MouseEvent e) {
  if (e.getClickCount() > 1) {
    JScrollPane pane = (JScrollPane) ((Component) e.getSource()).getParent().getParent();
    Component temp = pane.getParent().getParent().getParent().getParent();
    if (temp instanceof JInternalFrame) {
      cmdToBar(pane, (JInternalFrame) temp);
    } else {
      cmdToFrame(pane);
    }
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setLeft(int aValue) {
  if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
    MarginLayout.ajustLeft(this, aValue);
  }
  super.setLocation(aValue, getTop());
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setTop(int aValue) {
  if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
    MarginLayout.ajustTop(this, aValue);
  }
  super.setLocation(getLeft(), aValue);
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

/**
 * Called when the number of rows is updated. By default, it will get the parent scroll pane and call revalidate.
 * Subclass can override it to customize the behavior when number of rows is updated.
 *
 * @param oldRow the previous row count.
 * @param newRow the new row count.
 */
protected void numberOfRowsUpdated(int oldRow, int newRow) {
  // look for a parent ScrollPane and revalidate its container
  // otherwise revalidate the text area's container
  JScrollPane scroll = getParentScrollPane();
  if (scroll != null) {
    Container parent = scroll.getParent();
    if (parent != null && parent instanceof JComponent) {
      JComponent component = (JComponent) parent;
      component.revalidate();
    }
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Called when the number of rows is updated. By default, it will get the parent scroll pane and call revalidate.
 * Subclass can override it to customize the behavior when number of rows is updated.
 *
 * @param oldRow the previous row count.
 * @param newRow the new row count.
 */
protected void numberOfRowsUpdated(int oldRow, int newRow) {
  // look for a parent ScrollPane and revalidate its container
  // otherwise revalidate the text area's container
  JScrollPane scroll = getParentScrollPane();
  if (scroll != null) {
    Container parent = scroll.getParent();
    if (parent != null && parent instanceof JComponent) {
      JComponent component = (JComponent) parent;
      component.revalidate();
    }
  }
}

代码示例来源:origin: org.jflux/org.jflux.swing.services

@Override
  public void mouseWheelMoved(MouseWheelEvent e) {
    JScrollPane pane = (JScrollPane)e.getSource();
    int val = pane.getVerticalScrollBar().getValue();
    if(myPrevVal != null && myPrevVal != val){
      myPrevVal = val;
      myCount = 0;
      return;
    }
    myPrevVal = val;
    if(myCount++ < 3){
      return;
    }
    int max = pane.getVerticalScrollBar().getMaximum();
    int min = pane.getVerticalScrollBar().getMinimum();
    int vis = pane.getVerticalScrollBar().getVisibleAmount();
    if((val+vis == max && e.getWheelRotation() == 1)
        || (val == min && e.getWheelRotation() == -1)){
        pane.getParent().dispatchEvent(e);
    }
  }
}

代码示例来源:origin: org.rwshop/org.rwshop.swing.common

@Override
  public void mouseWheelMoved(MouseWheelEvent e) {
    JScrollPane pane = (JScrollPane)e.getSource();
    int val = pane.getVerticalScrollBar().getValue();
    if(myPrevVal != null && myPrevVal != val){
      myPrevVal = val;
      myCount = 0;
      return;
    }
    myPrevVal = val;
    if(myCount++ < 3){
      return;
    }
    int max = pane.getVerticalScrollBar().getMaximum();
    int min = pane.getVerticalScrollBar().getMinimum();
    int vis = pane.getVerticalScrollBar().getVisibleAmount();
    if((val+vis == max && e.getWheelRotation() == 1)
        || (val == min && e.getWheelRotation() == -1)){
        pane.getParent().dispatchEvent(e);
    }
  }
}

代码示例来源:origin: com.github.haifengl/smile-plot

@Override
  public void actionPerformed(ActionEvent e) {
    Dimension d = getSize();
    d.width -= 100;
    
    Dimension vd = scrollPane.getViewport().getSize();
    if (d.width <= vd.width) {
      d.width = vd.width;
      decreaseWidthAction.setEnabled(false);
    }
    
    setPreferredSize(d);
    invalidate();
    scrollPane.getParent().validate();
  }
}

代码示例来源:origin: com.github.haifengl/smile-plot

@Override
  public void actionPerformed(ActionEvent e) {
    Dimension d = getSize();
    d.height -= 100;
    
    Dimension vd = scrollPane.getViewport().getSize();
    if (d.height <= vd.height) {
      d.height = vd.height;
      decreaseHeightAction.setEnabled(false);
    }
    
    setPreferredSize(d);
    invalidate();
    scrollPane.getParent().validate();
  }
}

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

private void updateTableColumnSizes() {
  ETable table = notificationTable;
  Font font = notificationScroll.getFont();
  FontMetrics fm = notificationScroll.getFontMetrics(font.deriveFont(Font.BOLD));
  int maxCharWidth = fm.charWidth('A'); // NOI18N
  int inset = 10;
  TableColumnModel columnModel = table.getColumnModel();
  TableColumn priorityColumn = columnModel.getColumn(0);
  String priorName = priorityColumn.getHeaderValue().toString();
  priorityColumn.setPreferredWidth(fm.stringWidth(priorName) + inset);
  TableColumn dateColumn = columnModel.getColumn(2);
  dateColumn.setPreferredWidth(15 * maxCharWidth + inset);
  TableColumn categoryColumn = columnModel.getColumn(3);
  categoryColumn.setPreferredWidth(7 * maxCharWidth + inset);
  TableColumn messageColumn = columnModel.getColumn(1);
  Border border = notificationScroll.getBorder();
  Insets insets;
  if (border != null) {
    insets = border.getBorderInsets(notificationScroll);
  } else {
    insets = new Insets(0, 0, 0, 0);
  }
  int remainingWidth = notificationScroll.getParent().getWidth() - insets.left - insets.right;
  remainingWidth -= 3 * columnModel.getColumnMargin();
  remainingWidth -= priorityColumn.getPreferredWidth();
  remainingWidth -= dateColumn.getPreferredWidth();
  remainingWidth -= categoryColumn.getPreferredWidth();
  messageColumn.setPreferredWidth(remainingWidth);
}

代码示例来源:origin: com.github.haifengl/smile-plot

@Override
  public void actionPerformed(ActionEvent e) {
    Dimension d = getSize();
    d.width += 100;
    setPreferredSize(d);
    invalidate();
    scrollPane.getParent().validate();
    
    if (!decreaseWidthAction.isEnabled()) {
      decreaseWidthAction.setEnabled(true);
    }
  }
}

代码示例来源:origin: com.github.haifengl/smile-plot

@Override
  public void actionPerformed(ActionEvent e) {
    Dimension d = getSize();
    d.height += 100;
    setPreferredSize(d);
    invalidate();
    scrollPane.getParent().validate();
    
    if (!decreaseHeightAction.isEnabled()) {
      decreaseHeightAction.setEnabled(true);
    }            
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-team-commons

@Override
  public void mouseWheelMoved(MouseWheelEvent e) {
    if (scrollPane.getVerticalScrollBar().isShowing()) {
      if (e.getSource() != scrollPane) {
        e.setSource(scrollPane);
        scrollPane.dispatchEvent(e);
      }
    } else {
      scrollPane.getParent().dispatchEvent(e);
    }
  }
};

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

private void cmdTestQueryActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButtonTestActionPerformed
  // Cleaning the existing table and releasing resources
  releaseResultset();
  OBDAProgressMonitor progMonitor = new OBDAProgressMonitor("Executing query...", this);
  CountDownLatch latch = new CountDownLatch(1);
  ExecuteSQLQueryAction action = new ExecuteSQLQueryAction(latch);
  progMonitor.addProgressListener(action);
  progMonitor.start();
  try {
    action.run();
    latch.await();
    progMonitor.stop();
    ResultSet set = action.getResult();
    if (set != null) {
      ResultSetTableModel model = new ResultSetTableModel(set);
      tblQueryResult.setModel(model);
      scrQueryResult.getParent().revalidate();
    }
  } catch (Exception e) {
    log.error(e.getMessage());
  }
}// GEN-LAST:event_jButtonTestActionPerformed

代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx

public void stopEditing(boolean cancel)
{
  if (editingCell != null)
  {
    scrollPane.transferFocusUpCycle();
    Object cell = editingCell;
    editingCell = null;
    if (!cancel)
    {
      EventObject trig = trigger;
      trigger = null;
      graphComponent.labelChanged(cell, getCurrentValue(), trig);
    }
    else
    {
      mxCellState state = graphComponent.getGraph().getView()
          .getState(cell);
      graphComponent.redraw(state);
    }
    if (scrollPane.getParent() != null)
    {
      scrollPane.setVisible(false);
      scrollPane.getParent().remove(scrollPane);
    }
    graphComponent.requestFocusInWindow();
  }
}

代码示例来源:origin: org.tinyjee.jgraphx/jgraphx

public void stopEditing(boolean cancel)
{
  if (editingCell != null)
  {
    scrollPane.transferFocusUpCycle();
    Object cell = editingCell;
    editingCell = null;
    if (!cancel)
    {
      EventObject trig = trigger;
      trigger = null;
      graphComponent.labelChanged(cell, getCurrentValue(), trig);
    }
    else
    {
      mxCellState state = graphComponent.getGraph().getView()
          .getState(cell);
      graphComponent.redraw(state);
    }
    if (scrollPane.getParent() != null)
    {
      scrollPane.setVisible(false);
      scrollPane.getParent().remove(scrollPane);
    }
    graphComponent.requestFocusInWindow();
  }
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

sp = (JScrollPane) jc;
if (!wantScrollPane) {
  jc = sp.getParent();
  if (jc == null) {
    jc = sp;
Container spParent = sp.getParent();
spParent.remove(sp);
spParent.add(SearchableDemo.createTitledPanel("searchable", 'S', sp));

相关文章

JScrollPane类方法