Example usage for javax.swing JScrollPane setSize

List of usage examples for javax.swing JScrollPane setSize

Introduction

In this page you can find the example usage for javax.swing JScrollPane setSize.

Prototype

public void setSize(int width, int height) 

Source Link

Document

Resizes this component so that it has width width and height height .

Usage

From source file:org.springframework.amqp.rabbit.stocks.ui.StockPanel.java

public StockPanel(StockController controller) {
    this.stockController = controller;
    controller.setStockPanel(this);
    this.setBorder(BorderFactory.createTitledBorder("Stock Form"));

    FormLayout formLayout = new FormLayout("pref, 150dlu", // columns
            "pref, fill:100dlu:grow"); // rows
    setLayout(formLayout);//from  w  w  w  . j a va2  s.  c o m
    CellConstraints c = new CellConstraints();

    tradeRequestButton = new JButton("Send Trade Request");
    add(tradeRequestButton, c.xy(1, 1));

    tradeRequestTextField = new JTextField("");
    add(tradeRequestTextField, c.xy(2, 1));

    add(new JLabel("Market Data"), c.xy(1, 2));

    marketDataTextArea = new JTextArea();
    JScrollPane sp = new JScrollPane(marketDataTextArea);
    sp.setSize(200, 300);

    add(sp, c.xy(2, 2));

    tradeRequestTextField.addFocusListener(new FocusListener() {
        public void focusLost(FocusEvent e) {
        }

        public void focusGained(FocusEvent e) {
            tradeRequestTextField.setText("");
            tradeRequestTextField.setForeground(Color.BLACK);
        }
    });

    tradeRequestButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            sendTradeRequest();
        }
    });
}