Example usage for javax.swing JTextArea setMinimumSize

List of usage examples for javax.swing JTextArea setMinimumSize

Introduction

In this page you can find the example usage for javax.swing JTextArea setMinimumSize.

Prototype

@BeanProperty(description = "The minimum size of the component.")
public void setMinimumSize(Dimension minimumSize) 

Source Link

Document

Sets the minimum size of this component to a constant value.

Usage

From source file:MainClass.java

public MainClass() {
    super("Simple SplitPane Frame");
    setSize(450, 200);//  w  ww  .  j  av a 2 s .co m
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JTextArea jt1 = new JTextArea(sometext);
    JTextArea jt2 = new JTextArea(sometext);

    jt1.setLineWrap(true);
    jt2.setLineWrap(true);
    jt1.setMinimumSize(new Dimension(150, 150));
    jt2.setMinimumSize(new Dimension(150, 150));
    jt1.setPreferredSize(new Dimension(250, 200));
    JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jt1, jt2);
    getContentPane().add(sp, BorderLayout.CENTER);
}

From source file:SimpleSplitPane.java

public SimpleSplitPane() {
    super("Simple SplitPane Frame");
    setSize(450, 200);//from   w  ww.  j  a  v a 2s.c o m
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JTextArea jt1 = new JTextArea(sometext);
    JTextArea jt2 = new JTextArea(sometext);

    // Make sure our text boxes do line wrapping and have reasonable
    // minimum sizes.
    jt1.setLineWrap(true);
    jt2.setLineWrap(true);
    jt1.setMinimumSize(new Dimension(150, 150));
    jt2.setMinimumSize(new Dimension(150, 150));
    jt1.setPreferredSize(new Dimension(250, 200));
    JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jt1, jt2);
    getContentPane().add(sp, BorderLayout.CENTER);
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopTextArea.java

@Override
protected JTextArea createTextComponentImpl() {
    final JTextArea impl = new TextAreaFlushableField();

    if (isTabTraversal()) {
        Set<KeyStroke> forwardFocusKey = Collections.singleton(getKeyStroke(KeyEvent.VK_TAB, 0));
        impl.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardFocusKey);

        Set<KeyStroke> backwardFocusKey = Collections
                .singleton(getKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_MASK));
        impl.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, backwardFocusKey);

        impl.addKeyListener(new KeyAdapter() {
            @Override// w  w  w .j  av a 2  s  .  c o  m
            public void keyPressed(KeyEvent e) {
                if (isEnabled() && isEditable() && e.getKeyCode() == KeyEvent.VK_TAB
                        && e.getModifiers() == KeyEvent.CTRL_MASK) {

                    if (StringUtils.isEmpty(impl.getText())) {
                        impl.setText("\t");
                    } else {
                        impl.append("\t");
                    }
                }
            }
        });
    }

    impl.setLineWrap(true);
    impl.setWrapStyleWord(true);

    int height = (int) impl.getPreferredSize().getHeight();
    impl.setMinimumSize(new Dimension(0, height));

    composition = new JScrollPane(impl);
    composition.setPreferredSize(new Dimension(150, height));
    composition.setMinimumSize(new Dimension(0, height));

    doc.putProperty("filterNewlines", false);

    return impl;
}