Example usage for javax.swing JTextArea JTextArea

List of usage examples for javax.swing JTextArea JTextArea

Introduction

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

Prototype

public JTextArea(Document doc) 

Source Link

Document

Constructs a new JTextArea with the given document model, and defaults for all of the other arguments (null, 0, 0).

Usage

From source file:net.aepik.alasca.gui.util.LoadFileFrame.java

/**
 * Initialize frame content.//  w  w  w  .  j  a  v a  2  s. c o  m
 */
private void initFrame() {
    // - Panel bouton du bas -

    JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    boutonsPanel.add(boutonOk);
    boutonsPanel.add(boutonAnnuler);

    // - Panel nom du fichier -

    JTextArea textAreaFilename = new JTextArea(
            "Indiquez le nom du fichier contenant les dfinitions du schma LDAP que vous souhaitez charger.");
    textAreaFilename.setEditable(false);
    textAreaFilename.setLineWrap(true);
    textAreaFilename.setWrapStyleWord(true);
    textAreaFilename.setFont((new JLabel()).getFont());
    textAreaFilename.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6));
    textAreaFilename.setBackground(new Color(240, 235, 226));

    boutonOpenFile.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(0, 5, 0, 0, boutonsPanel.getBackground()),
            boutonOpenFile.getBorder()));

    JPanel filenamePanel = new JPanel(new BorderLayout());
    filenamePanel.add(textAreaFilename, BorderLayout.NORTH);
    filenamePanel.add(filename, BorderLayout.CENTER);
    filenamePanel.add(boutonOpenFile, BorderLayout.EAST);
    filenamePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Schma LDAP "),
                    BorderFactory.createEmptyBorder(0, 5, 5, 5))));

    // - Panel du selecteur de syntaxes -

    JTextArea textAreaSyntaxes = new JTextArea(
            "Il vous faut appliquer un filtre sur le schma que vous voulez charger. Voici la liste des filtres disponibles :");
    textAreaSyntaxes.setEditable(false);
    textAreaSyntaxes.setLineWrap(true);
    textAreaSyntaxes.setWrapStyleWord(true);
    textAreaSyntaxes.setFont((new JLabel()).getFont());
    textAreaSyntaxes.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6));
    textAreaSyntaxes.setBackground(new Color(240, 235, 226));

    JPanel syntaxesPanel = new JPanel(new BorderLayout());
    syntaxesPanel.add(textAreaSyntaxes, BorderLayout.NORTH);
    syntaxesPanel.add(syntaxes);
    syntaxesPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Syntaxe LDAP "),
                    BorderFactory.createEmptyBorder(0, 5, 5, 5))));

    // On injecte le nom des classes de syntaxes possibles
    // dynamiquement.
    String[] syntaxesName = Schema.getSyntaxeNames();
    for (int i = 0; syntaxesName != null && i < syntaxesName.length; i++) {
        syntaxes.addItem(syntaxesName[i]);
    }

    // - Organisation gnrale -

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(filenamePanel, BorderLayout.NORTH);
    mainPanel.add(syntaxesPanel, BorderLayout.CENTER);

    JPanel mainPanelContainer = new JPanel(new BorderLayout());
    mainPanelContainer.add(mainPanel, BorderLayout.NORTH);
    mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH);
    mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1));

    getContentPane().add(new DescriptiveInternalFrame(mainFrame.getIconImage(),
            "Slectionner un fichier et sa syntaxe.", mainPanelContainer));

    // - Listeners -

    addWindowListener(this);
    boutonOpenFile.addActionListener(this);
    boutonOk.addActionListener(this);
    boutonAnnuler.addActionListener(this);
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchSwing.CFFreeSwitchSwingVersionAskDeleteJPanel.java

public CFFreeSwitchSwingVersionAskDeleteJPanel(ICFFreeSwitchSwingSchema argSchema,
        ICFInternetVersionObj argFocus) {
    super();/*from   w  w  w.jav  a  2  s .  c o m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    // Construct the various objects
    textAreaMessage = new JTextArea("Are you sure you want to delete this Version?");
    actionOk = new ActionOk();
    actionCancel = new ActionCancel();
    buttonOk = new JButton(actionOk);
    buttonCancel = new JButton(actionCancel);
    attrJPanel = argSchema.getVersionFactory().newAttrJPanel(argFocus);
    scrollPane = new CFHSlaveJScrollPane(attrJPanel);
    // Lay out the widgets
    setSize(1024, 480);
    Dimension min = new Dimension(480, 300);
    setMinimumSize(min);
    add(textAreaMessage);
    textAreaMessage.setBounds(0, 0, 1024, 50);
    int xparts = (768 - (2 * 125)) / 3;
    add(buttonOk);
    buttonOk.setBounds(xparts, 55, 125, 40);
    add(buttonCancel);
    buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
    add(scrollPane);
    scrollPane.setBounds(0, 100, 1024, 480 - 100);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingSecDeviceAskDeleteJPanel.java

public CFAsteriskSwingSecDeviceAskDeleteJPanel(ICFAsteriskSwingSchema argSchema,
        ICFSecuritySecDeviceObj argFocus) {
    super();/*from  w  w w.jav a  2 s  . c om*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    // Construct the various objects
    textAreaMessage = new JTextArea("Are you sure you want to delete this Security Device?");
    actionOk = new ActionOk();
    actionCancel = new ActionCancel();
    buttonOk = new JButton(actionOk);
    buttonCancel = new JButton(actionCancel);
    attrJPanel = argSchema.getSecDeviceFactory().newAttrJPanel(argFocus);
    scrollPane = new CFHSlaveJScrollPane(attrJPanel);
    // Lay out the widgets
    setSize(1024, 480);
    Dimension min = new Dimension(480, 300);
    setMinimumSize(min);
    add(textAreaMessage);
    textAreaMessage.setBounds(0, 0, 1024, 50);
    int xparts = (768 - (2 * 125)) / 3;
    add(buttonOk);
    buttonOk.setBounds(xparts, 55, 125, 40);
    add(buttonCancel);
    buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
    add(scrollPane);
    scrollPane.setBounds(0, 100, 1024, 480 - 100);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingTopDomainAskDeleteJPanel.java

public CFAsteriskSwingTopDomainAskDeleteJPanel(ICFAsteriskSwingSchema argSchema,
        ICFInternetTopDomainObj argFocus) {
    super();/*from ww w .  j  a  v a2  s.c  om*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    // Construct the various objects
    textAreaMessage = new JTextArea("Are you sure you want to delete this TopDomain?");
    actionOk = new ActionOk();
    actionCancel = new ActionCancel();
    buttonOk = new JButton(actionOk);
    buttonCancel = new JButton(actionCancel);
    attrJPanel = argSchema.getTopDomainFactory().newAttrJPanel(argFocus);
    scrollPane = new CFHSlaveJScrollPane(attrJPanel);
    // Lay out the widgets
    setSize(1024, 480);
    Dimension min = new Dimension(480, 300);
    setMinimumSize(min);
    add(textAreaMessage);
    textAreaMessage.setBounds(0, 0, 1024, 50);
    int xparts = (768 - (2 * 125)) / 3;
    add(buttonOk);
    buttonOk.setBounds(xparts, 55, 125, 40);
    add(buttonCancel);
    buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
    add(scrollPane);
    scrollPane.setBounds(0, 100, 1024, 480 - 100);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingTSecGroupAskDeleteJPanel.java

public CFAsteriskSwingTSecGroupAskDeleteJPanel(ICFAsteriskSwingSchema argSchema,
        ICFSecurityTSecGroupObj argFocus) {
    super();/*w ww  .ja v  a2s  .  c  o m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    // Construct the various objects
    textAreaMessage = new JTextArea("Are you sure you want to delete this Tenant Security Group?");
    actionOk = new ActionOk();
    actionCancel = new ActionCancel();
    buttonOk = new JButton(actionOk);
    buttonCancel = new JButton(actionCancel);
    attrJPanel = argSchema.getTSecGroupFactory().newAttrJPanel(argFocus);
    scrollPane = new CFHSlaveJScrollPane(attrJPanel);
    // Lay out the widgets
    setSize(1024, 480);
    Dimension min = new Dimension(480, 300);
    setMinimumSize(min);
    add(textAreaMessage);
    textAreaMessage.setBounds(0, 0, 1024, 50);
    int xparts = (768 - (2 * 125)) / 3;
    add(buttonOk);
    buttonOk.setBounds(xparts, 55, 125, 40);
    add(buttonCancel);
    buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
    add(scrollPane);
    scrollPane.setBounds(0, 100, 1024, 480 - 100);
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetSwing.CFInternetSwingTSecGroupIncludeAskDeleteJPanel.java

public CFInternetSwingTSecGroupIncludeAskDeleteJPanel(ICFInternetSwingSchema argSchema,
        ICFInternetTSecGroupIncludeObj argFocus) {
    super();/*from   w ww .  j ava  2  s  .  c o m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    // Construct the various objects
    textAreaMessage = new JTextArea("Are you sure you want to delete this Tenant Security Group Include?");
    actionOk = new ActionOk();
    actionCancel = new ActionCancel();
    buttonOk = new JButton(actionOk);
    buttonCancel = new JButton(actionCancel);
    attrJPanel = argSchema.getTSecGroupIncludeFactory().newAttrJPanel(argFocus);
    scrollPane = new CFHSlaveJScrollPane(attrJPanel);
    // Lay out the widgets
    setSize(1024, 480);
    Dimension min = new Dimension(480, 300);
    setMinimumSize(min);
    add(textAreaMessage);
    textAreaMessage.setBounds(0, 0, 1024, 50);
    int xparts = (768 - (2 * 125)) / 3;
    add(buttonOk);
    buttonOk.setBounds(xparts, 55, 125, 40);
    add(buttonCancel);
    buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
    add(scrollPane);
    scrollPane.setBounds(0, 100, 1024, 480 - 100);
}

From source file:com.ethercamp.harmony.desktop.HarmonyDesktop.java

private void showErrorWindow(String title, String body) {
    try {/*from w  w w  . j a v a2 s  .co m*/
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        //            System.setProperty("apple.awt.UIElement", "false");

        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

        JTextArea textArea = new JTextArea(body);
        JScrollPane scrollPane = new JScrollPane(textArea);
        textArea.setLineWrap(true);
        textArea.setFont(Font.getFont(Font.MONOSPACED));
        textArea.setEditable(false);
        textArea.setWrapStyleWord(true);
        scrollPane.setPreferredSize(new Dimension(500, 500));

        JTextPane titleLabel = new JTextPane();
        titleLabel.setContentType("text/html"); // let the text pane know this is what you want
        titleLabel.setText("<html>" + "<b>" + title + "</b>" + "</html>"); // showing off
        titleLabel.setEditable(false);
        titleLabel.setBackground(null);
        titleLabel.setBorder(null);

        panel.add(titleLabel);
        panel.add(scrollPane);

        final JFrame frame = new JFrame();
        frame.setAlwaysOnTop(true);
        moveCenter(frame);
        frame.setVisible(true);

        JOptionPane.showMessageDialog(frame, panel, "Oops. Ethereum Harmony stopped with error.",
                JOptionPane.CLOSED_OPTION);
        System.exit(1);
    } catch (Exception e) {
        log.error("Problem showing error window", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingDomainBaseAskDeleteJPanel.java

public CFAsteriskSwingDomainBaseAskDeleteJPanel(ICFAsteriskSwingSchema argSchema,
        ICFInternetDomainBaseObj argFocus) {
    super();//w  w  w  .j  av a2  s. c  o  m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    // Construct the various objects
    textAreaMessage = new JTextArea("Are you sure you want to delete this DomainBase?");
    actionOk = new ActionOk();
    actionCancel = new ActionCancel();
    buttonOk = new JButton(actionOk);
    buttonCancel = new JButton(actionCancel);
    attrJPanel = argSchema.getDomainBaseFactory().newAttrJPanel(argFocus);
    scrollPane = new CFHSlaveJScrollPane(attrJPanel);
    // Lay out the widgets
    setSize(1024, 480);
    Dimension min = new Dimension(480, 300);
    setMinimumSize(min);
    add(textAreaMessage);
    textAreaMessage.setBounds(0, 0, 1024, 50);
    int xparts = (768 - (2 * 125)) / 3;
    add(buttonOk);
    buttonOk.setBounds(xparts, 55, 125, 40);
    add(buttonCancel);
    buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
    add(scrollPane);
    scrollPane.setBounds(0, 100, 1024, 480 - 100);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingISOCountryAskDeleteJPanel.java

public CFAsteriskSwingISOCountryAskDeleteJPanel(ICFAsteriskSwingSchema argSchema,
        ICFSecurityISOCountryObj argFocus) {
    super();//w  w w  .  j av a2  s  . co m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    // Construct the various objects
    textAreaMessage = new JTextArea("Are you sure you want to delete this ISO Country?");
    actionOk = new ActionOk();
    actionCancel = new ActionCancel();
    buttonOk = new JButton(actionOk);
    buttonCancel = new JButton(actionCancel);
    attrJPanel = argSchema.getISOCountryFactory().newAttrJPanel(argFocus);
    scrollPane = new CFHSlaveJScrollPane(attrJPanel);
    // Lay out the widgets
    setSize(1024, 480);
    Dimension min = new Dimension(480, 300);
    setMinimumSize(min);
    add(textAreaMessage);
    textAreaMessage.setBounds(0, 0, 1024, 50);
    int xparts = (768 - (2 * 125)) / 3;
    add(buttonOk);
    buttonOk.setBounds(xparts, 55, 125, 40);
    add(buttonCancel);
    buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
    add(scrollPane);
    scrollPane.setBounds(0, 100, 1024, 480 - 100);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingSecSessionAskDeleteJPanel.java

public CFAsteriskSwingSecSessionAskDeleteJPanel(ICFAsteriskSwingSchema argSchema,
        ICFSecuritySecSessionObj argFocus) {
    super();//from  www  .  j  a v  a  2  s.  c om
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    swingSchema = argSchema;
    swingFocus = argFocus;
    // Construct the various objects
    textAreaMessage = new JTextArea("Are you sure you want to delete this Security Session?");
    actionOk = new ActionOk();
    actionCancel = new ActionCancel();
    buttonOk = new JButton(actionOk);
    buttonCancel = new JButton(actionCancel);
    attrJPanel = argSchema.getSecSessionFactory().newAttrJPanel(argFocus);
    scrollPane = new CFHSlaveJScrollPane(attrJPanel);
    // Lay out the widgets
    setSize(1024, 480);
    Dimension min = new Dimension(480, 300);
    setMinimumSize(min);
    add(textAreaMessage);
    textAreaMessage.setBounds(0, 0, 1024, 50);
    int xparts = (768 - (2 * 125)) / 3;
    add(buttonOk);
    buttonOk.setBounds(xparts, 55, 125, 40);
    add(buttonCancel);
    buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
    add(scrollPane);
    scrollPane.setBounds(0, 100, 1024, 480 - 100);
}