Example usage for java.awt TextArea setEditable

List of usage examples for java.awt TextArea setEditable

Introduction

In this page you can find the example usage for java.awt TextArea setEditable.

Prototype

public synchronized void setEditable(boolean b) 

Source Link

Document

Sets the flag that determines whether or not this text component is editable.

Usage

From source file:de.codesourcery.eve.skills.ui.components.impl.PriceInfoComponent.java

@Override
protected JPanel createPanelHook() {

    final JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());

    final String kind;

    switch (priceType) {
    case BUY://from   w w w . jav  a2 s .  c  o m
        kind = "buy";
        break;
    case SELL:
    default:
        throw new RuntimeException(
                "Invalid data in switch/case: PriceInfo.Type.ALL cannot be queried from user");
    }

    minPrice.addActionListener(listener);
    maxPrice.addActionListener(listener);
    avgPrice.addActionListener(listener);

    final TextArea desc = new TextArea();
    desc.setText(message);
    desc.setEditable(false);

    panel.add(desc, constraints(0, 0).width(2).resizeBoth().end());

    panel.add(new JLabel("Minimum " + kind + " price"), constraints(0, 1).useRelativeWidth().end());
    panel.add(minPrice, constraints(1, 1).useRemainingWidth().end());

    panel.add(new JLabel("Average " + kind + " price"), constraints(0, 2).useRelativeWidth().end());
    panel.add(avgPrice, constraints(1, 2).useRemainingWidth().end());

    panel.add(new JLabel("Maximum " + kind + " price"), constraints(0, 3).useRelativeWidth().end());
    panel.add(maxPrice, constraints(1, 3).useRemainingWidth().end());

    return panel;
}

From source file:MessageViewer.java

/**
 * sets the current message to be displayed in the viewer
 */// w w  w  .j a  v  a  2  s  . com
public void setMessage(Message what) {
    displayed = what;

    if (mainbody != null)
        remove(mainbody);

    if (what != null) {
        loadHeaders();
        mainbody = getBodyComponent();
    } else {
        headers.setText("");
        TextArea dummy = new TextArea("", 24, 80, TextArea.SCROLLBARS_NONE);
        dummy.setEditable(false);
        mainbody = dummy;
    }

    // add the main body
    GridBagConstraints gb = new GridBagConstraints();
    gb.gridwidth = GridBagConstraints.REMAINDER;
    gb.fill = GridBagConstraints.BOTH;
    gb.weightx = 1.0;
    gb.weighty = 1.0;
    add(mainbody, gb);

    invalidate();
    validate();
}