Java Code Examples for javax.swing.JTextArea#setColumns()

The following examples show how to use javax.swing.JTextArea#setColumns() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PruebaCorrelacionIdiomas.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
    * A�ade el textArea para mostrar los resultados y el texto generado.
    * @param contenedor Contendor al que a�adir.
    * @param constraints Se ignora
    */
private void anhadeTextAreaParaResultados(Container contenedor )
{
	areaResultados = new JTextArea();
       areaResultados.setLineWrap(true);
       areaResultados.setWrapStyleWord(true);
       areaResultados.setEditable(false);
       areaResultados.setColumns(40);
       areaResultados.invalidate();

       JScrollPane scrollLista = new JScrollPane(areaResultados);
       scrollLista.setBorder(new TitledBorder("Resultados"));
       GridBagConstraints constraints = new GridBagConstraints();
       constraints.gridx = 0;
       constraints.gridy = 2;
       constraints.gridwidth = 4;
       constraints.gridheight = 1;
       constraints.weightx = 1.0;
       constraints.weighty = 1.0;
       constraints.fill = GridBagConstraints.BOTH;
       contenedor.add(scrollLista, constraints);
}
 
Example 2
Source File: PruebaCorrelacionIdiomas.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void anhadeTextAreaParaResultados(Container contenedor )
{
	areaResultados = new JTextArea();
       areaResultados.setLineWrap(true);
       areaResultados.setWrapStyleWord(true);
       areaResultados.setEditable(false);
       areaResultados.setColumns(40);
       areaResultados.invalidate();

       JScrollPane scrollLista = new JScrollPane(areaResultados);
       scrollLista.setBorder(new TitledBorder("Resultados"));
       GridBagConstraints constraints = new GridBagConstraints();
       constraints.gridx = 0;
       constraints.gridy = 2;
       constraints.gridwidth = 4;
       constraints.gridheight = 1;
       constraints.weightx = 1.0;
       constraints.weighty = 1.0;
       constraints.fill = GridBagConstraints.BOTH;
       contenedor.add(scrollLista, constraints);
}
 
Example 3
Source File: ConsoleStatusLoggerGui.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
private void init() {
    setLayout(new BorderLayout(0, 5));
    setBorder(makeBorder());
    add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH);
    JTextArea info = new JTextArea();
    info.setEditable(false);
    info.setWrapStyleWord(true);
    info.setOpaque(false);
    info.setLineWrap(true);
    info.setColumns(20);

    JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
    jScrollPane1.setViewportView(info);
    jScrollPane1.setBorder(null);
    
    info.setText("This is a simple listener that prints short summary log to console while JMeter is running in non-GUI mode. "
            + "It also writes the same info into jmeter.log in GUI mode."
            + "\n\nNote that response time and latency values printed are averages.");

    add(jScrollPane1, BorderLayout.CENTER);
}
 
Example 4
Source File: SecondaryPanel.java    From Robot-Overlord-App with GNU General Public License v2.0 6 votes vote down vote up
protected void makeGCodePanel() {
	// setup the elements
	gcode = new JTextArea();
	gcode.setEditable(true);
	gcode.setColumns(128);
	gcode.setRows(512);

	JScrollPane areaScrollPane = new JScrollPane(gcode);
	areaScrollPane.setVerticalScrollBarPolicy(
	                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

	gcodePanel = new JPanel(new GridBagLayout());

	// connect it together
	GridBagConstraints c = new GridBagConstraints();
	c.gridx=0;
	c.gridy=0;
	c.weightx=1.0;
	c.weighty=1.0;
	c.fill=GridBagConstraints.BOTH;
	c.insets = new Insets(3,3,3,3);		
	c.anchor=GridBagConstraints.CENTER;
	gcodePanel.add(areaScrollPane,c);
}
 
Example 5
Source File: PruebaCorrelacionIdiomas.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void anhadeTextAreaParaTextoAnalizado(Container contenedor) {
	areaDeTextoAAnalizar = new JTextArea();
       areaDeTextoAAnalizar.setLineWrap(true);
       areaDeTextoAAnalizar.setWrapStyleWord(true);
       areaDeTextoAAnalizar.setColumns(40);
       areaDeTextoAAnalizar.invalidate();

       JScrollPane scroll = new JScrollPane(areaDeTextoAAnalizar);
       scroll.setBorder(new TitledBorder("Escribe o copia aqu� un texto"));

       GridBagConstraints constraints = new GridBagConstraints();
       constraints.gridx = 0;
       constraints.gridy = 1;
       constraints.gridwidth = 4;
       constraints.gridheight = 1;
       constraints.weightx = 1.0;
       constraints.weighty = 1.0;
       constraints.fill = GridBagConstraints.BOTH;
       contenedor.add(scroll, constraints);
}
 
Example 6
Source File: SecondaryPanel.java    From Robot-Overlord-App with GNU General Public License v2.0 6 votes vote down vote up
protected void makeLogPanel() {
	// setup the elements
	log = new JTextArea();
	log.setEditable(false);
	log.setColumns(128);
	log.setRows(512);
	JScrollPane areaScrollPane = new JScrollPane(log);
	areaScrollPane.setVerticalScrollBarPolicy(
	                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	
	logPanel = new JPanel(new GridBagLayout());

	// connect it together
	GridBagConstraints c = new GridBagConstraints();
	c.gridx=0;
	c.gridy=0;
	c.weightx=1.0;
	c.weighty=1.0;
	c.fill=GridBagConstraints.BOTH;
	c.insets = new Insets(0,3,3,0);		
	c.anchor=GridBagConstraints.CENTER;
	logPanel.add(areaScrollPane,c);
}
 
Example 7
Source File: ModulesInstaller.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JComponent getErrorNotifyPanel (Exception x) {
    JTextArea area = new JTextArea ();
    area.setWrapStyleWord (true);
    area.setLineWrap (true);
    area.setEditable (false);
    area.setRows (15);
    area.setColumns (40);
    area.setOpaque (false);
    area.setText (getBundle ("InstallerMissingModules_ErrorPanel", x.getLocalizedMessage (), x));
    return area;
}
 
Example 8
Source File: ModulesInstaller.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private JComponent getErrorNotifyPanel (Exception x) {
    JTextArea area = new JTextArea ();
    area.setWrapStyleWord (true);
    area.setLineWrap (true);
    area.setEditable (false);
    area.setRows (15);
    area.setColumns (40);
    area.setOpaque (false);
    area.setText (getBundle ("InstallerMissingModules_ErrorPanel", x.getLocalizedMessage (), x));
    return area;
}
 
Example 9
Source File: TextViewOOM.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    frame = new JFrame();
    final JScrollPane jScrollPane1 = new JScrollPane();
    ta = new JTextArea();

    ta.setEditable(false);
    ta.setColumns(20);
    ta.setRows(5);
    jScrollPane1.setViewportView(ta);
    frame.add(ta);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
 
Example 10
Source File: TextViewOOM.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    frame = new JFrame();
    final JScrollPane jScrollPane1 = new JScrollPane();
    ta = new JTextArea();

    ta.setEditable(false);
    ta.setColumns(20);
    ta.setRows(5);
    jScrollPane1.setViewportView(ta);
    frame.add(ta);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
 
Example 11
Source File: GroovyJUnitTestWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JTextComponent createMultilineLabel(String text) {
    JTextArea textArea = new JTextArea(text);
    textArea.setEditable(false);
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setEnabled(false);
    textArea.setOpaque(false);
    textArea.setColumns(25);
    textArea.setDisabledTextColor(new JLabel().getForeground());

    return textArea;
}
 
Example 12
Source File: MainFrame.java    From procamcalib with GNU General Public License v2.0 5 votes vote down vote up
private void readmeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_readmeMenuItemActionPerformed
    try {
        JTextArea textArea = new JTextArea();
        Font font = textArea.getFont();
        textArea.setFont(new Font("Monospaced", font.getStyle(), font.getSize()));
        textArea.setEditable(false);

        String text = "";
        BufferedReader r = new BufferedReader(new FileReader(
                myDirectory + File.separator + "../README.md"));
        String line;
        while ((line = r.readLine()) != null) {
            text += line + '\n';
        }

        textArea.setText(text);
        textArea.setCaretPosition(0);
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        textArea.setColumns(80);

        // stuff it in a scrollpane with a controlled size.
        JScrollPane scrollPane = new JScrollPane(textArea);
        Dimension dim = textArea.getPreferredSize();
        dim.height = dim.width*50/80;
        scrollPane.setPreferredSize(dim);

        // pass the scrollpane to the joptionpane.
        JDialog dialog = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE).
                createDialog(this, "README");
        dialog.setResizable(true);
        dialog.setModalityType(ModalityType.MODELESS);
        dialog.setVisible(true);
    } catch (Exception ex) {
        Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example 13
Source File: UI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static JTextArea createTextArea(int columns, String message) {
    JTextArea text = new JTextArea(message);
    text.setBackground(null);
    text.setEditable(false);
    text.setColumns(columns);
    text.setLineWrap(true);
    text.setWrapStyleWord(true);
    return text;
}
 
Example 14
Source File: TextViewOOM.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {
    frame = new JFrame();
    final JScrollPane jScrollPane1 = new JScrollPane();
    ta = new JTextArea();

    ta.setEditable(false);
    ta.setColumns(20);
    ta.setRows(5);
    jScrollPane1.setViewportView(ta);
    frame.add(ta);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
 
Example 15
Source File: ModuleInstallerSupport.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static JPanel problemPanel(String header, String message) {
    JPanel panel = new JPanel();
    JLabel jLabel1 = new javax.swing.JLabel();
    JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
    JTextArea jTextArea1 = new javax.swing.JTextArea();

    jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD));
    jLabel1.setText(header);

    jTextArea1.setColumns(20);
    jTextArea1.setEditable(false);
    jTextArea1.setLineWrap(true);
    jTextArea1.setWrapStyleWord(true);
    jTextArea1.setRows(5);
    jTextArea1.setText(message);
    jTextArea1.setOpaque(false);
    jScrollPane1.setViewportView(jTextArea1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(panel);
    panel.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel1)
                    .addGap(107, 107, 107)))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jLabel1)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
            .addGap(82, 82, 82))
    );
    return panel;
}
 
Example 16
Source File: FirstContactDialog.java    From freecol with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an FirstContactDialog.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 * @param player The {@code Player} making contact.
 * @param other The {@code Player} to contact.
 * @param tile An optional {@code Tile} on offer.
 * @param settlementCount The number of settlements the other
 *     player has.
 */
public FirstContactDialog(FreeColClient freeColClient, JFrame frame,
        Player player, Player other, Tile tile, int settlementCount) {
    super(freeColClient, frame);

    JPanel panel = new MigPanel(new MigLayout("wrap 1", "[center]", "[]20"));
    panel.setOpaque(false);

    String headerKey = BASE_KEY + other.getNation().getSuffix();
    if (!Messages.containsKey(headerKey)) headerKey = BASE_KEY + NATIVES;
    JLabel header = Utility.localizedHeaderLabel(headerKey,
        SwingConstants.LEADING, FontLibrary.FontSize.MEDIUM);
    JLabel image = new JLabel(new ImageIcon(ImageLibrary
            .getMeetingImage(other)));
    image.setOpaque(false);

    JTextArea tutorial = null;
    if (!player.hasContactedIndians() && freeColClient.tutorialMode()) {
        tutorial = Utility.localizedTextArea(TUTORIAL_KEY);
    }

    String messageId = (tile != null)
        ? "firstContactDialog.welcomeOffer.text"
        : "firstContactDialog.welcomeSimple.text";
    String type = ((IndianNationType)other.getNationType())
        .getSettlementTypeKey(true);
    JTextArea text = Utility.localizedTextArea(StringTemplate
        .template(messageId)
        .addStringTemplate("%nation%", other.getNationLabel())
        .addName("%camps%", Integer.toString(settlementCount))
        .add("%settlementType%", type));

    // Resize the text areas to better match the image.
    int columns = (int)Math.floor(text.getColumns()
        * image.getPreferredSize().getWidth()
        / text.getPreferredSize().getWidth());
    text.setColumns(columns);
    text.setSize(text.getPreferredSize());
    if (tutorial != null) {
        tutorial.setColumns(columns);
        tutorial.setSize(tutorial.getPreferredSize());
    }

    panel.add(header);
    panel.add(image);
    if (tutorial != null) panel.add(tutorial);
    panel.add(text);
    panel.setSize(panel.getPreferredSize());

    ImageIcon icon = new ImageIcon(getImageLibrary()
        .getScaledNationImage(other.getNation()));
    initializeConfirmDialog(frame, false, panel, icon, "yes", "no");
}
 
Example 17
Source File: SwingAppLibDownloader.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static JPanel problemPanel(String header, String message) {
    JPanel panel = new JPanel();
    JLabel jLabel1 = new javax.swing.JLabel();
    JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
    JTextArea jTextArea1 = new javax.swing.JTextArea();

    jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD));
    jLabel1.setText(header);

    jTextArea1.setColumns(20);
    jTextArea1.setEditable(false);
    jTextArea1.setLineWrap(true);
    jTextArea1.setWrapStyleWord(true);
    jTextArea1.setRows(5);
    jTextArea1.setText(message);
    jTextArea1.setOpaque(false);
    jScrollPane1.setViewportView(jTextArea1);

    javax.swing.GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel1)
                    .addGap(107, 107, 107)))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jLabel1)
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
            .addGap(82, 82, 82))
    );
    return panel;
}
 
Example 18
Source File: JWTViewTab.java    From JWT4B with GNU General Public License v3.0 4 votes vote down vote up
private void drawPanel() {
	GridBagLayout gridBagLayout = new GridBagLayout();
	gridBagLayout.columnWidths = new int[] { 10, 447, 0, 0 };
	gridBagLayout.rowHeights = new int[] { 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
	gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
	setLayout(gridBagLayout);
	
	keyLabel = new JLabel(" ");
	keyLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_inputLabel1 = new GridBagConstraints();
	gbc_inputLabel1.fill = GridBagConstraints.VERTICAL;
	gbc_inputLabel1.insets = new Insets(0, 0, 5, 5);
	gbc_inputLabel1.anchor = GridBagConstraints.WEST;
	gbc_inputLabel1.gridx = 1;
	gbc_inputLabel1.gridy = 1;
	add(keyLabel, gbc_inputLabel1);

	jwtKeyArea = new JTextArea();
	GridBagConstraints gbc_inputField1 = new GridBagConstraints();
	gbc_inputField1.insets = new Insets(0, 0, 5, 5);
	gbc_inputField1.fill = GridBagConstraints.HORIZONTAL;
	gbc_inputField1.gridx = 1;
	gbc_inputField1.gridy = 2;
	add(jwtKeyArea, gbc_inputField1);
	jwtKeyArea.setColumns(10);
	
	verificationIndicator = new JButton("");
	Dimension preferredSize = new Dimension(400, 30);
	verificationIndicator.setPreferredSize(preferredSize);
	GridBagConstraints gbc_validIndicator = new GridBagConstraints();
	gbc_validIndicator.insets = new Insets(0, 0, 5, 5);
	gbc_validIndicator.gridx = 1;
	gbc_validIndicator.gridy = 4;
	add(verificationIndicator, gbc_validIndicator);

	outputField = new RSyntaxTextArea();
	SyntaxScheme scheme = outputField.getSyntaxScheme();
	Style style = new Style();
	style.foreground = new Color(222,133,10);
	scheme.setStyle(Token.LITERAL_STRING_DOUBLE_QUOTE, style);
	outputField.revalidate();
	outputField.setHighlightCurrentLine(false);
	outputField.setCurrentLineHighlightColor(Color.WHITE);
	outputField.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
	outputField.setEditable(false);
	outputField.setPopupMenu(new JPopupMenu()); // no context menu on right-click
	
	outputLabel = new JLabel("JWT");
	outputLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_outputLabel = new GridBagConstraints();
	gbc_outputLabel.anchor = GridBagConstraints.WEST;
	gbc_outputLabel.insets = new Insets(0, 0, 5, 5);
	gbc_outputLabel.gridx = 1;
	gbc_outputLabel.gridy = 5;
	add(outputLabel, gbc_outputLabel);
	
	lbRegisteredClaims = new JLabel();
	lbRegisteredClaims.setBackground(SystemColor.controlHighlight);
	GridBagConstraints gbc_lbRegisteredClaims = new GridBagConstraints();
	gbc_lbRegisteredClaims.fill = GridBagConstraints.BOTH;
	gbc_lbRegisteredClaims.insets = new Insets(0, 0, 5, 5);
	gbc_lbRegisteredClaims.gridx = 1;
	gbc_lbRegisteredClaims.gridy = 8;
	add(lbRegisteredClaims, gbc_lbRegisteredClaims);
	
	lblCookieFlags = new JLabel(" ");
	lblCookieFlags.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_lblCookieFlags = new GridBagConstraints();
	gbc_lblCookieFlags.anchor = GridBagConstraints.SOUTHWEST;
	gbc_lblCookieFlags.insets = new Insets(0, 0, 5, 5);
	gbc_lblCookieFlags.gridx = 1;
	gbc_lblCookieFlags.gridy = 9;
	add(lblCookieFlags, gbc_lblCookieFlags);
	
	RTextScrollPane sp = new RTextScrollPane(outputField);
	sp.setLineNumbersEnabled(false);
	
	GridBagConstraints gbc_outputfield = new GridBagConstraints();
	gbc_outputfield.insets = new Insets(0, 0, 5, 5);
	gbc_outputfield.fill = GridBagConstraints.BOTH;
	gbc_outputfield.gridx = 1;
	gbc_outputfield.gridy = 6;
	add(sp, gbc_outputfield);
}
 
Example 19
Source File: MessageLocationPayloadsPanel.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public MessageLocationPayloadsPanel(
        Window parent,
        MessageLocation messageLocation,
        List<PayloadTableEntry> payloads,
        PayloadGeneratorsContainer payloadGeneratorsUIHandlers) {
    this.parent = parent;
    this.payloadGeneratorsUIHandlers = payloadGeneratorsUIHandlers;
    this.messageLocation = messageLocation;
    this.payloadsTablePanel = new PayloadsTablePanel(payloads);

    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    JLabel locationLabel =
            new JLabel(
                    Constant.messages.getString(
                            "fuzz.fuzzer.dialog.payloads.messagelocation.label.location"));
    JLabel messageLocationLabel = new JLabel(messageLocation.getDescription());
    JLabel valueLabel =
            new JLabel(
                    Constant.messages.getString(
                            "fuzz.fuzzer.dialog.payloads.messagelocation.label.value"));

    JComponent messageLocationValue;
    String value = messageLocation.getValue();
    if (value.length() > 100) {
        JTextArea messageLocationValueTextArea =
                new JTextArea(StringUIUtils.addVisibleNewLineChars(value));
        messageLocationValueTextArea.setColumns(10);
        messageLocationValueTextArea.setRows(5);
        messageLocationValueTextArea.setEditable(false);

        JScrollPane messageLocationValueScrollPane =
                new JScrollPane(messageLocationValueTextArea);
        messageLocationValue = messageLocationValueScrollPane;
    } else {
        JLabel messageLocationValueLabel =
                new JLabel(
                        StringUIUtils.containsNewLineChars(value)
                                ? StringUIUtils.replaceWithVisibleWhiteSpaceChars(value)
                                : value);
        messageLocationValue = messageLocationValueLabel;
    }

    JLabel payloadsLabel =
            new JLabel(
                    Constant.messages.getString("fuzz.fuzzer.dialog.payloads.payloads.label"));

    layout.setHorizontalGroup(
            layout.createParallelGroup()
                    .addGroup(
                            layout.createSequentialGroup()
                                    .addComponent(locationLabel)
                                    .addComponent(messageLocationLabel))
                    .addGroup(
                            layout.createSequentialGroup()
                                    .addComponent(valueLabel)
                                    .addComponent(messageLocationValue))
                    .addComponent(payloadsLabel)
                    .addComponent(payloadsTablePanel));

    layout.setVerticalGroup(
            layout.createSequentialGroup()
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(locationLabel)
                                    .addComponent(messageLocationLabel))
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(valueLabel)
                                    .addComponent(messageLocationValue))
                    .addComponent(payloadsLabel)
                    .addComponent(payloadsTablePanel));
}
 
Example 20
Source File: StringEditor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Component getCustomEditor () {
    if (customEditor == null) {
        JTextArea textArea = new JTextArea();
        textArea.setWrapStyleWord(true);
        textArea.setLineWrap(true);
        textArea.setColumns(60);
        textArea.setRows(8);
        textArea.getDocument().addDocumentListener(this);
        textArea.getAccessibleContext().setAccessibleName(
                NbBundle.getBundle(StringEditor.class).getString("ACSN_StringEditorTextArea")); //NOI18N
        textArea.getAccessibleContext().setAccessibleDescription(
                NbBundle.getBundle(StringEditor.class).getString("ACSD_StringEditorTextArea")); //NOI18N

        JScrollPane scroll = new JScrollPane();
        scroll.setViewportView(textArea);

        JLabel htmlTipLabel = new JLabel(NbBundle.getMessage(StringEditor.class, "StringEditor.htmlTipLabel.text")); // NOI18N

        JPanel panel = new JPanel();
        GroupLayout layout = new GroupLayout(panel);
        layout.setAutoCreateGaps(true);
        panel.setLayout(layout);
        layout.setHorizontalGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup()
                    .addComponent(scroll)
                    .addComponent(htmlTipLabel))
                .addContainerGap());
        layout.setVerticalGroup(layout.createSequentialGroup()
                .addContainerGap().addComponent(scroll).addComponent(htmlTipLabel));

        customEditor = panel;
        textComp = textArea;
        htmlTipLabel.setVisible(htmlText);
    }

    textComp.setEditable(editable);
    setValueToCustomEditor();

    return customEditor;
}