javax.swing.JEditorPane.getHeight()方法的使用及代码示例

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

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

JEditorPane.getHeight介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

@Override
public Dimension getPreferredSize() {
  return new Dimension(WIDTH, editorPane.getHeight());
}

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

//load the webpage into the editor
JEditorPane ed = new JEditorPane(new URL("http://www.google.com"));
ed.setSize(200,200);

//create a new image
BufferedImage image = new BufferedImage(ed.getWidth(), ed.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);

//paint the editor onto the image
SwingUtilities.paintComponent(image.createGraphics(), 
               ed, 
               new JPanel(), 
               0, 0, image.getWidth(), image.getHeight());

//save the image to file
ImageIO.write((RenderedImage)image, "png", new File("google.png"));

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

JEditorPane jp = new JEditorPane("text/html", textString);
jp.validate();
int w = jp.getWidth(), h = jp.getHeight();
BufferedImage saveimg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = saveimg.createGraphics();
jp.paint(g2);

代码示例来源:origin: igvteam/igv

public static synchronized void showMessage(Level level, String message) {
  log.log(level, message);
  boolean showDialog = !(Globals.isHeadless() || Globals.isSuppressMessages() || Globals.isTesting() || Globals.isBatch());
  if (showDialog) {
    UIUtilities.invokeOnEventThread(() -> {
      // Always use HTML for message displays, but first remove any embedded <html> tags.
      String dlgMessage = "<html>" + message.replaceAll("<html>", "");
      Frame parent = IGV.hasInstance() ? IGV.getMainFrame() : null;
      Color background = parent != null ? parent.getBackground() : Color.lightGray;
      //JEditorPane So users can select text
      JEditorPane content = new JEditorPane();
      content.setContentType("text/html");
      content.setText(dlgMessage);
      content.setBackground(background);
      content.setEditable(false);
      Component dispMessage = content;
      //Really long messages should be scrollable
      if (dlgMessage.length() > 200) {
        Dimension size = new Dimension(1000, content.getHeight() + 100);
        content.setPreferredSize(size);
        JScrollPane pane = new JScrollPane(content);
        dispMessage = pane;
      }
      JOptionPane.showMessageDialog(parent, dispMessage);
    });
  }
}

代码示例来源:origin: fr.ifremer/isis-fish

int height = comp.getHeight();

代码示例来源:origin: nroduit/Weasis

protected void calculatePageInfo() {
  pages = new ArrayList<>();
  int startY = 0;
  int endPageY = getEndPageY(startY);
  while (startY + pageHeight - margins.top - margins.bottom < sourcePane.getHeight()) {
    Shape pageShape = getPageShape(startY, pageWidth - margins.left - margins.right,
      pageHeight - margins.top - margins.bottom, sourcePane);
    PagePanel p = new PagePanel(startY, endPageY, pageShape);
    updateUIToRemoveLF(p);
    pages.add(p);
    startY = endPageY;
    endPageY = getEndPageY(startY);
  }
  Shape pageShape = getPageShape(startY, pageWidth - margins.left - margins.right,
    pageHeight - margins.top - margins.bottom, sourcePane);
  PagePanel p = new PagePanel(startY, endPageY, pageShape);
  updateUIToRemoveLF(p);
  pages.add(p);
  int count = 0;
  for (PagePanel pi : pages) {
    add(pi);
    pi.setLocation(PAGE_SHIFT, PAGE_SHIFT + count * (pageHeight + PAGE_SHIFT));
    count++;
  }
}

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

final int lastHeight = textfield.getHeight();
final boolean lineWrap = lastWidth == maxWidth;
Dimension preferredSize = textfield.getPreferredSize();

相关文章

JEditorPane类方法