javax.swing.JTextPane.setSize()方法的使用及代码示例

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

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

JTextPane.setSize介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy

@Override
  public void setSize(final Dimension d) {
    if (d.width < getParent().getSize().width) {
      d.width = getParent().getSize().width;
    }
    super.setSize(d);
  }
}

代码示例来源:origin: groovy/groovy-core

PRINT_SIZE.setSize(paper.getImageableWidth(),
    getSize().getHeight());
PRINT_PANE.setSize(PRINT_SIZE);

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

@Override
public void setSize(Dimension d) {
 if (d.width < getGraphicsConfiguration().getBounds().width) {
  d.width = getGraphicsConfiguration().getBounds().width;
 }
 super.setSize(d);
}

代码示例来源:origin: Waikato/weka-trunk

@Override
public void setSize(Dimension d) {
 if (d.width < getGraphicsConfiguration().getBounds().width) {
  d.width = getGraphicsConfiguration().getBounds().width;
 }
 super.setSize(d);
}

代码示例来源:origin: net.sf.ingenias/ingeniasjgraphmod

/**
 * Overrides the parent's implementation to return a slightly larger
 * preferred size for circles and rounded rectangles.
 * 
 * @return Returns the preferreds size for the current view.
 */
public Dimension getPreferredSize() {
  Dimension d = super.getPreferredSize();
  if (shape == SHAPE_CIRCLE) {
    d.width += d.width / 8;
    d.height += d.height / 2;
  } else if (shape == SHAPE_ROUNDED)
    d.width += d.height / 5;
  else if (isRichText) {
    textPane.setSize(ZERO_DIMENSION);
    return textPane.getPreferredSize();
  } else if (valueComponent != null)
    return valueComponent.getPreferredSize();
  return d;
}

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

/**
 * Affiche une boite de dialogue modale permettant de modifier l'expression
 * R.
 * 
 * @param rCall r instruction to edit
 * @return user edited r instruction
 */
protected String editRInstruction(String rCall) {
  JLabel label = new JLabel(t("Modifier le code R envoyé si vous le souhaitez"));
  JTextPane text = new JTextPane();
  text.setText(rCall);
  text.setSize(400, 400);
  text.setPreferredSize(text.getSize());
  Box box = Box.createVerticalBox();
  box.add(label);
  box.add(new JScrollPane(text));
  JOptionPane.showMessageDialog(null, box, t("R modif"), JOptionPane.QUESTION_MESSAGE);
  return text.getText();
}

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

int h = preferredSize.height;
pane.setSize(w, h);
pane.addNotify();
pane.validate();

代码示例来源:origin: jdmp/java-data-mining-package

public void setSize(Dimension d) {
    if (d.width < getParent().getSize().width) {
      d.width = getParent().getSize().width;
    }
    super.setSize(d);
  }
};

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public void setSize(Dimension d){
    if(d.width<getParent().getSize().width){
      d.width = getParent().getSize().width;
    }
    super.setSize(d);
  }
}

代码示例来源:origin: org.rescarta.rc-dct/rc-dct

public void setSize(Dimension d) {
  if (d.width < getParent().getSize().width)
    d.width = getParent().getSize().width;
  super.setSize(d);
}

代码示例来源:origin: org.rescarta.rc-cvt/rc-cvt

public void setSize(Dimension d) {
  if (d.width < getParent().getSize().width)
    d.width = getParent().getSize().width;
  super.setSize(d);
}

代码示例来源:origin: org.rescarta.rc-indexer/rc-indexer

public void setSize(Dimension d) {
  if (d.width < getParent().getSize().width)
    d.width = getParent().getSize().width;
  super.setSize(d);
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

public void setSize(Dimension d){
    if(d.width<getParent().getSize().width){
      d.width = getParent().getSize().width;
    }
    super.setSize(d);
  }
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public void setSize(Dimension d){
    if(d.width<getParent().getSize().width){
      d.width = getParent().getSize().width;
    }
    super.setSize(d);
  }
}

代码示例来源:origin: de.sciss/abc4j

public void setSize(Dimension d)
{
 if(d.width < getParent().getSize().width)
  d.width = getParent().getSize().width;
 super.setSize(d);
}

代码示例来源:origin: org.kohsuke.droovy/groovy

public void setSize(Dimension d){
    if(d.width<getParent().getSize().width){
      d.width = getParent().getSize().width;
    }
    super.setSize(d);
  }
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

/**
 * Updates the UI elements in this panel to reflect the attributes in the {@link
 * #currentCloudLibrary}.
 */
private void updateUI() {
 panel.setVisible(true);
 if (currentCloudLibrary.getIcon() == null) {
  nameLabel.setIcon(null);
 } else {
  nameLabel.setIcon(GoogleCloudCoreIcons.LOADING);
  loadImageAsync(currentCloudLibrary.getIcon(), nameLabel::setIcon);
 }
 nameLabel.setText(currentCloudLibrary.getName());
 descriptionTextPane.setText(currentCloudLibrary.getDescription());
 descriptionTextPane.setSize(
   descriptionTextPane.getWidth(), descriptionTextPane.getPreferredSize().height);
 links.clear();
 Optional<String> docsLink =
   makeLink(
     GoogleCloudApisMessageBundle.message("cloud.libraries.documentation.link"),
     currentCloudLibrary.getDocumentation());
 links.add(docsLink);
 linksTextPane.setText(joinLinks(links));
 managementWarningTextPane.setText(
   GoogleCloudApisMessageBundle.message("cloud.apis.management.section.info.text"));
}

代码示例来源:origin: net.sf.ingenias/ingeniasjgraphmod

/**
 * Utility method to paint the rich text content for rich text values. This
 * implementation simulates rich text vertical alignment by translating the
 * graphics before painting the textPane.
 * 
 * @param g
 *            The graphics to paint the rich text content to.
 */
protected void paintRichText(Graphics g) {
  textPane.setSize(getSize());
  int yoffset = 0;
  // Computes the vertical offset to match the vertical alignment
  if (getVerticalAlignment() == CENTER)
    yoffset = (int) ((getHeight() - textPane.getPreferredSize()
        .getHeight()) / 2)
        + 2 * INSET;
  else if (getVerticalAlignment() == BOTTOM)
    yoffset = (int) (getHeight()
        - textPane.getPreferredSize().getHeight() + 3 * INSET);
  g.translate(0, yoffset);
  textPane.paint(g);
  g.translate(0, -yoffset);
}

代码示例来源:origin: blurpy/kouchat

/**
 * Makes sure the size of the textpane fills the whole viewport.
 *
 * <p>Since {@link #getScrollableTracksViewportWidth()} is disabled
 * then the size set here is the textpane's preferred size.
 * Which is the width of the text in it. If the text in this
 * textpane is shorter than the viewport, then the part of the
 * textpane not filled with text is grayed out.</p>
 *
 * <p>To fix this, the size is adjusted to the same size
 * as the viewport.</p>
 *
 * {@inheritDoc}
 */
@Override
public void setSize(final Dimension d) {
  // Parent is the viewport
  if (d.width < getParent().getSize().width) {
    d.width = getParent().getSize().width;
  }
  super.setSize(d);
}

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

public class DialogTest {
public static void main(String[] args) throws Exception {
  JTextPane jtp = new JTextPane();
  Document doc = jtp.getDocument();
  for (int i = 0; i < 50; i++) {
    doc.insertString(doc.getLength(), " Hello Java World ", new SimpleAttributeSet());
    if ((3 == i) || (7 == i) || (15 == i)) {
      doc.insertString(doc.getLength(), " Hello Java World ", new SimpleAttributeSet());
      SimpleAttributeSet attrs = new SimpleAttributeSet();
      StyleConstants.setUnderline(attrs, true);
      StyleConstants.setForeground(attrs, Color.BLUE);
      String text = "www.google.com";
      URL url = new URL("http://" + text);
      attrs.addAttribute(HTML.Attribute.HREF, url.toString());
      doc.insertString(doc.getLength(), text, attrs);
    }
  }
  //JScrollPane jsp = new JScrollPane(jtp);
  //jsp.setPreferredSize(new Dimension(480, 150));
  //jsp.setBorder(null);
  jtp.setSize(new Dimension(480, 10));
  jtp.setPreferredSize(new Dimension(480, jtp.getPreferredSize().height));

  //JOptionPane.showMessageDialog(null, jsp, "Title", JOptionPane.INFORMATION_MESSAGE);
  JOptionPane.showMessageDialog(null, jtp, "Title", JOptionPane.INFORMATION_MESSAGE);
}}

相关文章

JTextPane类方法