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

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

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

JTextPane.getSize介绍

暂无

代码示例

代码示例来源:origin: igniterealtime/Openfire

@Override
public void paintComponent(Graphics g) {
  final Dimension size = pane.getSize();
  int x = (size.width - icon.getIconWidth()) / 2;
  int y = (size.height - icon.getIconHeight()) / 2;
  //  Approach 1: Dispaly image at at full size
  g.setColor(Color.white);
  g.fillRect(0, 0, size.width, size.height);
  g.drawImage(icon.getImage(), x, y, null);
  setOpaque(false);
  super.paintComponent(g);
}

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

void logs_componentResized(ComponentEvent e) {
//        System.err.println("pulsado");
    Point p=new Point(0,(int)logs.getSize().getHeight());
    scrollLogs.getViewport().setViewPosition(p);
    /*   Point p=scrollLogs.getViewport().getGraphLayoutCachePosition();
     p.y=p.y+10;
     scrollLogs.getViewport().setViewPosition(p);*/
  }
  void logs_componentShown(ComponentEvent e) {

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

JFrame frame = new JFrame();

final JTextPane text = new JTextPane();
text.setContentType("text/html");
text.setEditable(false);
text.setText("some random thing makes this pane bigger than its perferred size");

final JScrollPane scroll = new JScrollPane(text);
scroll.addComponentListener(new ComponentAdapter()  {
    @Override
    public void componentResized(ComponentEvent e) {
      System.out.println("Size of JScrollPane is: " + scroll.getSize());
      System.out.println("Size of JTextPane is: " + text.getSize());
    }
});

frame.setLayout(new BorderLayout());
frame.add(scroll,BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);

代码示例来源: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();
}

相关文章

JTextPane类方法