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

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

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

JTextArea.getHeight介绍

暂无

代码示例

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/**
 * Gets the preferred size of the overlay.
 * @param cols Description of the Parameter
 * @return The preferredSize value
 */
public Dimension getPreferredSize(int cols) {
  return new Dimension(textArea.getWidth(), textArea.getHeight());
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

@Override
  public void run() {
    // automatically scroll down to the last line
    view.scrollRectToVisible(
        new Rectangle(0, view.getHeight() - 1, 1, 1));
  }
});

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

JTextArea users = new JTextArea();
users.setPreferredSize(new Dimension(100, users.getHeight()));
add(users, BorderLayout.EAST);

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Adjust the bottom vertical of the annotation
 * @param dy y offset
 */
public void adjustBottom(int dy) {
  if (noteText.getPreferredSize().height <= noteText.getHeight() + dy) {
    noteText.setSize(new Dimension(noteText.getWidth(), noteText.getHeight() + dy));
  }
}

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

public void RefreshMemory() {
  int addr = startaddress;
  taMemoryView.setText("");
  visiblelines = taMemoryView.getHeight() / taMemoryView.getFontMetrics(taMemoryView.getFont()).getHeight();
  for (int y = 0; y < visiblelines; y++) {
    if (y > 0) {
      taMemoryView.append("\n");
    }
    taMemoryView.append(getMemoryView(addr));
    addr += 16;
  }
}

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

public void actionPerformed(ActionEvent e) {
  BufferedImage img = new BufferedImage(text.getWidth(), text.getHeight(), BufferedImage.TYPE_INT_RGB);
  Graphics2D g2d = img.createGraphics();
  text.printAll(g2d);

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public void keyPressed( KeyEvent e )
 {
  if( e.getKeyCode() == KeyEvent.VK_ENTER )
  {
   if( _field.getHeight() > iPrefHeight * 2 - 2 && !e.isControlDown() )
   {
    return;
   }
   fireNodeChanged( _nodeListenerList, new ChangeEvent( _escapeForJava ? GosuEscapeUtil.escapeForJava( _field.getText() ) : _field.getText() ) );
   setVisible( false );
  }
 }
} );

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Adjust the right horizontal of the annotation
 * @param dx x offset
 */
public void adjustRight(int dx) {
  if (GUIConstants.ANNOTATION_MIN_WIDTH <= noteText.getWidth() + dx) {
    noteText.setSize(new Dimension(noteText.getWidth() + dx, noteText.getHeight()));
  }
}

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Adjust the top vertical of the annotation
 * @param dy y offset
 */
public void adjustTop(int dy) {
  if (noteText.getPreferredSize().height <= noteText.getHeight() - dy) {
    noteText.setSize(new Dimension(noteText.getWidth(), noteText.getHeight() - dy));
    setLocation(getX(), getY() + dy);
    originalY += dy;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.plugins/firebirdmanager

/**
 * Refresh the textarea and scroll to the end
 */
private void refreshDisplay() {
  this.textArea.setCaretPosition(this.textArea.getDocument().getLength());
  this.textArea.scrollRectToVisible(this.textArea.getVisibleRect());
  this.scrollPane.getVerticalScrollBar().setValue(this.scrollPane.getVerticalScrollBar().getMaximum());
  this.textArea.paintImmediately(0,0,this.textArea.getWidth(), this.textArea.getHeight());
}

代码示例来源:origin: MegaMek/megamek

"AdvancedChatboxSize"));
scrPlayers = new JScrollPane(playerList);
scrPlayers.setPreferredSize(new Dimension(100,chatArea.getHeight()));
inputField = new JTextField();
inputField.addKeyListener(this);

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Adjust the left horizontal of the annotation
 * @param dx x offset
 */
public void adjustLeft(int dx) {
  if (GUIConstants.ANNOTATION_MIN_WIDTH <= noteText.getWidth() - dx) {
    noteText.setSize(new Dimension(noteText.getWidth() - dx, noteText.getHeight()));
    setLocation(getX() + dx, getY());
    originalX += dx;
  }
}

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Calculates the BoundsOffsets used for setBounds() method
 *
 * Implemented because the canvas has no layout manager
 *
 */
public void updateBounds() {
  int newHeight = noteText.getPreferredSize().height;
  if (noteText.getHeight() < newHeight && newHeight >= noteText.getMinimumSize().height) {
    noteText.setSize(noteText.getWidth(), newHeight);
  }
  int rectWidth = noteText.getWidth() + GUIConstants.RESERVED_BORDER;
  int rectHeight = noteText.getHeight() + GUIConstants.RESERVED_BORDER;
  noteRect.setFrame(GUIConstants.RESERVED_BORDER / 2, GUIConstants.RESERVED_BORDER / 2, rectWidth, rectHeight);
  setSize(rectWidth + GUIConstants.ANNOTATION_SIZE_OFFSET, rectHeight + GUIConstants.ANNOTATION_SIZE_OFFSET);
  noteText.setLocation((int) noteRect.getX() + (rectWidth - noteText.getWidth()) / 2,
      (int) noteRect.getY() + (rectHeight - noteText.getHeight()) / 2);
  bounds.setBounds(model.getX() - 20, model.getY() - 20,
      rectWidth + GUIConstants.RESERVED_BORDER + GUIConstants.ANNOTATION_SIZE_OFFSET + 20,
      rectHeight + GUIConstants.RESERVED_BORDER + GUIConstants.ANNOTATION_SIZE_OFFSET + 20);
  setBounds(bounds);
}

相关文章

JTextArea类方法