Search in sources :

Example 31 with JTextArea

use of javax.swing.JTextArea in project zaproxy by zaproxy.

the class HttpTextViewUtilsUnitTest method shouldNotAllowUndefinedViewWhenGettingHeaderToViewPosition.

@Test(expected = IllegalArgumentException.class)
public void shouldNotAllowUndefinedViewWhenGettingHeaderToViewPosition() {
    // Given
    JTextArea undefinedView = null;
    // When
    HttpTextViewUtils.getHeaderToViewPosition(undefinedView, HEADER, 0, 0);
// Then = IllegalArgumentException
}
Also used : JTextArea(javax.swing.JTextArea) Test(org.junit.Test)

Example 32 with JTextArea

use of javax.swing.JTextArea in project zaproxy by zaproxy.

the class HttpTextViewUtilsUnitTest method shouldReturnInvalidPositionIfOffsetStartIsGreaterThanViewLengthWhenGettingHeaderToViewPosition.

@Test
public void shouldReturnInvalidPositionIfOffsetStartIsGreaterThanViewLengthWhenGettingHeaderToViewPosition() {
    // Given
    JTextArea view = new JTextArea("ABC");
    int start = 5;
    int end = 6;
    // When
    int[] pos = HttpTextViewUtils.getHeaderToViewPosition(view, HEADER, start, end);
    // Then
    assertThat(pos, is(equalTo(HttpTextViewUtils.INVALID_POSITION)));
}
Also used : JTextArea(javax.swing.JTextArea) Test(org.junit.Test)

Example 33 with JTextArea

use of javax.swing.JTextArea in project zaproxy by zaproxy.

the class HttpTextViewUtilsUnitTest method shouldReturnInvalidPositionIfOffsetEndIsGreaterThanViewLengthWhenGettingHeaderToViewPosition.

@Test
public void shouldReturnInvalidPositionIfOffsetEndIsGreaterThanViewLengthWhenGettingHeaderToViewPosition() {
    // Given
    JTextArea view = new JTextArea("ABC");
    int start = 2;
    int end = 6;
    // When
    int[] pos = HttpTextViewUtils.getHeaderToViewPosition(view, HEADER, start, end);
    // Then
    assertThat(pos, is(equalTo(HttpTextViewUtils.INVALID_POSITION)));
}
Also used : JTextArea(javax.swing.JTextArea) Test(org.junit.Test)

Example 34 with JTextArea

use of javax.swing.JTextArea in project nhin-d by DirectProject.

the class ValidatePanel method initUI.

protected void initUI() {
    setLayout(new BorderLayout());
    setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
    // File Load Fields
    policyFileField = new FileField("Policy Definition File:", "");
    certFileField = new FileField("Certificate File: ", "");
    final JPanel filePanel = new JPanel(new GridLayout(1, 2));
    filePanel.add(certFileField);
    filePanel.add(policyFileField);
    this.add(filePanel, BorderLayout.NORTH);
    // Report panel
    final JLabel reportHeaderLabel = new JLabel("Validation Report");
    reportText = new JTextArea();
    reportText.setLineWrap(true);
    reportText.setWrapStyleWord(true);
    reportText.setEditable(false);
    final JScrollPane scrollPane = new JScrollPane(reportText);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    final JPanel reportPanel = new JPanel(new BorderLayout());
    reportPanel.add(reportHeaderLabel, BorderLayout.NORTH);
    reportPanel.add(scrollPane, BorderLayout.CENTER);
    this.add(reportPanel, BorderLayout.CENTER);
    // Button Panel
    cmdValidate = new JButton("Validate");
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(cmdValidate);
    this.add(buttonPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JTextArea(javax.swing.JTextArea) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) JButton(javax.swing.JButton) SoftBevelBorder(javax.swing.border.SoftBevelBorder) JLabel(javax.swing.JLabel) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 35 with JTextArea

use of javax.swing.JTextArea in project nhin-d by DirectProject.

the class EditorPanel method initUI.

protected void initUI() {
    setLayout(new BorderLayout());
    setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
    policyText = new JTextArea();
    policyText.setLineWrap(true);
    policyText.setWrapStyleWord(true);
    policyText.setEditable(true);
    final JScrollPane scrollPane = new JScrollPane(policyText);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    fileNameLabel = new JLabel("*New File*");
    final JPanel reportPanel = new JPanel(new BorderLayout());
    reportPanel.add(fileNameLabel, BorderLayout.NORTH);
    reportPanel.add(scrollPane, BorderLayout.CENTER);
    //this.add(reportPanel, BorderLayout.CENTER);
    validatePanel = new ValidatePanel();
    validatePanel.setFeedMode(PolicyLexicon.SIMPLE_TEXT_V1, policyText.getDocument());
    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, reportPanel, validatePanel);
    splitPane.setDividerLocation(400);
    this.add(splitPane, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) ValidatePanel(org.nhindirect.policy.tools.policyvalidate.ValidatePanel) BorderLayout(java.awt.BorderLayout) SoftBevelBorder(javax.swing.border.SoftBevelBorder) JLabel(javax.swing.JLabel) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) JSplitPane(javax.swing.JSplitPane)

Aggregations

JTextArea (javax.swing.JTextArea)182 JScrollPane (javax.swing.JScrollPane)104 JPanel (javax.swing.JPanel)79 BorderLayout (java.awt.BorderLayout)60 JButton (javax.swing.JButton)59 JLabel (javax.swing.JLabel)59 Dimension (java.awt.Dimension)36 JTextField (javax.swing.JTextField)35 JFrame (javax.swing.JFrame)33 ActionEvent (java.awt.event.ActionEvent)26 Font (java.awt.Font)24 GridBagLayout (java.awt.GridBagLayout)23 GridBagConstraints (java.awt.GridBagConstraints)22 Insets (java.awt.Insets)22 ActionListener (java.awt.event.ActionListener)21 FlowLayout (java.awt.FlowLayout)20 Color (java.awt.Color)18 JCheckBox (javax.swing.JCheckBox)18 JSplitPane (javax.swing.JSplitPane)16 EmptyBorder (javax.swing.border.EmptyBorder)16