javax.swing.JComponent.repaint()方法的使用及代码示例

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

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

JComponent.repaint介绍

暂无

代码示例

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

public void run() {
  component.repaint();
 }
});

代码示例来源:origin: mabe02/lanterna

@Override
  public void run() {
    component.repaint();
  }
});

代码示例来源:origin: mabe02/lanterna

@Override
protected void repaint() {
  if(SwingUtilities.isEventDispatchThread()) {
    component.repaint();
  }
  else {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        component.repaint();
      }
    });
  }
}

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

@Override
public void receive(LookChanged message) {
  for(JComponent c : installedComponents) {
    c.repaint();
  }
}

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

private void removeSearchField() {
  if (isAlwaysShown()) {
    return;
  }
  if (searchPanel == null) {
    return;
  }
  if (animationTimer != null) {
    animationTimer.stopProgressAnimation();
  }
  Component sp = searchPanel;
  searchPanel = null;
  component.remove(sp);
  component.invalidate();
  component.revalidate();
  component.repaint();
}

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

component.repaint();
searchTextField.requestFocus();

代码示例来源:origin: magefree/mage

/**
 * Mouse released -> we are done the drag
 */
@Override
public void mouseReleased(MouseEvent e) {
  // No longer dragging
  isDragging = false;
  // Remove listeners
  dragComponent.removeMouseListener(this);
  dragComponent.removeMouseMotionListener(this);
  // Convert the event into root coords
  e = SwingUtilities.convertMouseEvent(dragComponent, e, currentEventRootMagePane);
  // Remove the drag card
  glassPane.remove(dragView);
  glassPane.repaint();
  // Let the drag source know
  source.dragCardEnd(currentDragTarget);
  // Update the target, and do the drop
  updateCurrentTarget(e, true);
}

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

protected void appendCharacterToSearchString(char keyChar) {
  // Update search string with the key that has just been typed
  // Since the search string has been updated, match information has changed as well
  // and we need to repaint the table.
  searchString += keyChar;
  component.repaint();
}

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

/**
 * Handle a ListDataEvent signallying a drag-reordering of the map layers. The event is
 * published by the list model after the layers have been reordered there.
 *
 * @param ev the event
 */
private void onReorderLayers(ListDataEvent ev) {
  ((JComponent) mapPane).setIgnoreRepaint(true);
  for (int pos = ev.getIndex0(); pos <= ev.getIndex1(); pos++) {
    Layer layer = listModel.getElementAt(pos);
    /*
     * MapLayerTable stores layers in the reverse order to
     * the MapContent layer list
     */
    int newContextPos = listModel.getSize() - pos - 1;
    int curContextPos = mapPane.getMapContent().layers().indexOf(layer);
    if (curContextPos != newContextPos) {
      mapPane.getMapContent().moveLayer(curContextPos, newContextPos);
    }
  }
  ((JComponent) mapPane).setIgnoreRepaint(false);
  ((JComponent) mapPane).repaint();
}

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

protected void removeLastCharacterFromSearchString() {
  // Remove last character from the search string
  // Since the search string has been updated, match information has changed as well
  // and we need to repaint the table.
  // Note that we only repaint if the search string is not empty: if it's empty,
  // the cancel() method will be called, and repainting twice would result in an
  // unpleasant graphical artifact.
  searchString = searchString.substring(0, searchString.length()-1);
  if(searchString.length() != 0)
    component.repaint();
}

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

JComponent myComponent = ...
int delay = 1000; //milliseconds

ActionListener taskPerformer = new ActionListener() {
 public void actionPerformed(ActionEvent evt) {
  myComponent.repaint();
 }
};

new Timer(delay, taskPerformer).start();

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

@Override
public void preferenceChanged(View child, boolean width, boolean height) {
  if(! setSizeRunning){
    host.revalidate();
    host.repaint();
  }
}

代码示例来源:origin: google/sagetv

public void actionPerformed(java.awt.event.ActionEvent evt)
{
 if (colorHexField.getText().length() > 0)
 {
  try
  {
   colorSample.setBackground(java.awt.Color.decode(colorHexField.getText()));
  }
  catch (Exception e){}
  colorSample.repaint();
 }
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public void actionPerformed(ActionEvent e) {
  new BeanConnection(realSource, tempTarget, esd, tab);
  displayComponent.repaint();
 }
});

代码示例来源:origin: Audiveris/audiveris

private void updateSize (MouseEvent e)
{
  // Update width and height of rawRect
  rawRect.setSize(e.getX() - rawRect.x, e.getY() - rawRect.y);
  normalize();
  // Repaint the component (with the resized rectangle)
  component.repaint();
}

代码示例来源:origin: protegeproject/protege

private void doUpdate(Point mousePoint) {
  // Repaint the last rectangle
  if (rect != null) {
    linkedObjectComponent.getComponent().repaint(rect);
  }
  // Store the cell rect as the last cell rect
  rect = linkedObjectComponent.getMouseCellRect();
  if (rect != null) {
    linkedObjectComponent.getComponent().repaint(rect);
  }
}

代码示例来源:origin: abc9070410/JComicDownloader

@Override
public void mouseExited(MouseEvent event) {
  if (SetUp.getUsingBackgroundPicOfMainFrame()) {
    if (event.getSource() instanceof JTable) { // 主要是table
      CommonGUI.nowMouseAtRow = 10000; // 給很大的初始值,避免剛開始就有上色情形
      ((JComponent) event.getSource()).repaint();
    } else {
      ((JComponent) event.getSource()).setForeground(SetUp.getMainFrameOtherDefaultColor());
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

public void threadsMonitoringDisabled() {
  ((CardLayout)getLayout()).show(this, LAYOUT_DISABLED);
  fitAct.setEnabled(false);
  threadsToolbar.getComponent().repaint();
}

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

public void recalibrate() {
    if(getClientProperty(ALREADY_IN_PAINT) == null) {
      final JComponent parent = (JComponent) getParent();
      if(parent != null) {
        parent.revalidate();
        parent.repaint();
      }
    }
  }
}

代码示例来源:origin: JetBrains/jediterm

public static void setupEnclosingDialogBounds(final JComponent component) {
  component.revalidate();
  component.repaint();
  final Window window = SwingUtilities.windowForComponent(component);
  if (window != null &&
      (window.getSize().height < window.getMinimumSize().height || window.getSize().width < window.getMinimumSize().width)) {
    window.pack();
  }
}

相关文章

JComponent类方法