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

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

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

JComponent.isValid介绍

暂无

代码示例

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

public boolean isValid() {
  if (tableUI) {
    return true;
  } else {
    return super.isValid();
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public boolean isValid() {
  if (tableUI) {
    return true;
  } else {
    return super.isValid();
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public boolean isValid() {
  if (tableUI) {
    return true;
  } else {
    return super.isValid();
  }
}

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

@Override
protected void paintComponent(Graphics g)
{
  boolean valid = getSwingComponent().isValid();
  if (valid)
  {
    return;
  }
  getSwingComponent().revalidate(); // to inform parent scrollpane container
  Graphics2D g2 = (Graphics2D) g;
  g2.scale(zoom, zoom);
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
  if (grid.isVisible()) grid.paint(g2);
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  graph.draw(g2);
  for (IEditorPartBehavior behavior : this.behaviorManager.getBehaviors())
  {
    behavior.onPaint(g2);
  }
}

代码示例来源:origin: Geomatys/geotoolkit

/**
   * Takes a screenshot of the currently active component.
   */
  private void screenshot() {
    final JComponent active = this.active;
    if (active != null && active.isValid()) {
      final BufferedImage image = new BufferedImage(active.getWidth(), active.getHeight(), BufferedImage.TYPE_INT_RGB);
      final Graphics2D handler = image.createGraphics();
      active.print(handler);
      handler.dispose();
      File file = new File(Preferences.userNodeForPackage(DesktopPane.class).get(SCREENSHOT_DIRECTORY_PREFS, "."));
      file = new File(file, getTitle(active.getClass()) + ".png");
      try {
        assertTrue(ImageIO.write(image, "png", file));
        file = file.getParentFile();
        Desktop.getDesktop().open(file);
      } catch (IOException e) {
        JOptionPane.showInternalMessageDialog(active, e.getLocalizedMessage(),
            e.getClass().getSimpleName(), JOptionPane.ERROR_MESSAGE);
      }
    } else {
      JOptionPane.showInternalMessageDialog(this, "No active window.", "Screenshot", JOptionPane.WARNING_MESSAGE);
    }
  }
}

相关文章

JComponent类方法