javax.swing.JTextArea#setBounds ( )源码实例Demo

下面列出了javax.swing.JTextArea#setBounds ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: sldeditor   文件: InlineGMLPreviewPanel.java
/**
 * Creates the UI.
 *
 * @param noOfRows the no of rows
 */
private void createUI(int noOfRows) {
    setLayout(new BorderLayout());

    int xPos = 0;
    int width = BasePanel.FIELD_PANEL_WIDTH - xPos - 20;
    int height = BasePanel.WIDGET_HEIGHT * (noOfRows - 1);
    this.setBounds(0, 0, width, height);
    textField = new JTextArea();
    textField.setBounds(xPos, BasePanel.WIDGET_HEIGHT, width, height);
    Font font = textField.getFont();

    // Create a new, smaller font from the current font
    Font updatedFont = new Font(font.getFontName(), font.getStyle(), FONT_SIZE);

    // Set the new font in the editing area
    textField.setFont(updatedFont);
    textField.setEditable(true);

    // Wrap the text field with a scroll pane
    JScrollPane scroll = new JScrollPane(textField);
    scroll.setAutoscrolls(true);

    add(scroll, BorderLayout.CENTER);
}