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

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

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

JComponent.getGraphicsConfiguration介绍

暂无

代码示例

代码示例来源:origin: org.cytoscape/filter2-impl

@Override
public void dragGestureRecognized(DragGestureEvent event) {
  int width = view.getWidth();
  int height = view.getHeight();
  BufferedImage image = view.getGraphicsConfiguration().createCompatibleImage(width, height);
  Graphics2D graphics = image.createGraphics();
  view.setBackground(ViewUtil.UNSELECTED_BACKGROUND_COLOR);
  view.paint(graphics);
  
  Point offset = computeOffset(width, height);
  event.startDrag(null, image, offset, transferable, this);
}

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

public static Point getToolTipLocation(JComponent component)
{
 Point point = component.getLocationOnScreen();
 int componentHeight = component.getHeight();
 int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
 Insets scnMax = Toolkit.getDefaultToolkit().getScreenInsets(component.getGraphicsConfiguration());
 int taskBarSize = scnMax.bottom;

 FontMetrics metrics = component.getFontMetrics(component.getFont());
 int height = metrics.getHeight();
 int lines = 1;

 //Tool tip location shifted to up if screen does not have space in the bottom.
 if (point.y + componentHeight + taskBarSize + (height * lines) > screenHeight)
 {
  int xPos = component.getWidth() / 2;
  return new Point(xPos, -((height * lines) + 25));
 }
 return null;
}

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

if (fm == null && c.getGraphicsConfiguration() != null) {
  fm = c.getGraphicsConfiguration().createCompatibleImage(1,1)
     .getGraphics().getFontMetrics(c.getFont());

代码示例来源:origin: org.gephi/ui-components

Point location = new Point();
GraphicsConfiguration gc;
gc = component.getGraphicsConfiguration();
Rectangle sBounds = gc.getBounds();
Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc);

代码示例来源:origin: edu.stanford.protege/ca.uvic.cs.chisel.cajun

Point screenLocation = insideComponent.getLocationOnScreen();
Point location = new Point();
Rectangle sBounds = insideComponent.getGraphicsConfiguration().getBounds();

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

private void exportSlide(File presentationDirectory, Slide slide) {
    final NodeModel placedNode = slide.getCurrentPlacedNode();
    if(placedNode != null)
      slide.apply(presentationZoomFactor);
    else
      slide.apply(1f);
    mapViewComponent.validate();
    mapViewComponent.setSize(mapViewComponent.getPreferredSize());
    File exportFile = new File(presentationDirectory, FileUtils.validFileNameOf(slide.getName()) + ".png");
    final ExportToImage exporter = ExportToImage.toPNG();
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    if(placedNode != null) {
      final Dimension slideSize;
      if(ResourceController.getResourceController().getBooleanProperty(SWITCH_TO_FULL_SCREEN_PROPERTY))
        slideSize = mapViewComponent.getGraphicsConfiguration().getBounds().getSize();
      else
        slideSize = SwingUtilities.getWindowAncestor(mapViewComponent).getSize();
      exporter.export(map, slideSize, slide.getCurrentPlacedNode(), slide.getPlacedNodePosition(), exportFile);
    } else
      exporter.export(map, exportFile);
  }
}

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

Point screenLocation = cellTipComponent.getLocationOnScreen();
Point location = new Point();
Rectangle sBounds = cellTipComponent.getGraphicsConfiguration().getBounds();

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

Point screenLocation = cellTipComponent.getLocationOnScreen();
Point location = new Point();
Rectangle sBounds = cellTipComponent.getGraphicsConfiguration().getBounds();

相关文章

JComponent类方法