javax.swing.JTextArea Java Examples

The following examples show how to use javax.swing.JTextArea. 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: CounterRequestDetailPanel.java    From javamelody with Apache License 2.0 7 votes vote down vote up
private JPanel createSqlRequestExplainPlanPanel(String sqlRequestExplainPlan) {
	final JTextArea textArea = new JTextArea();
	textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, textArea.getFont().getSize() - 1));
	textArea.setEditable(false);
	textArea.setCaretPosition(0);
	// background nécessaire avec la plupart des look and feels dont Nimbus,
	// sinon il reste blanc malgré editable false
	textArea.setBackground(Color.decode("#E6E6E6"));
	textArea.setText(sqlRequestExplainPlan);
	final JPanel panel = new JPanel(new BorderLayout());
	panel.setOpaque(false);
	final JLabel label = new JLabel(getString("Plan_d_execution"));
	label.setFont(label.getFont().deriveFont(Font.BOLD));
	panel.add(label, BorderLayout.NORTH);
	final JScrollPane scrollPane = new JScrollPane(textArea);
	panel.add(scrollPane, BorderLayout.CENTER);
	return panel;
}
 
Example #2
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 el texto que se va a analizar
 * @param contenedor contendor en el que añadirlo.
 */
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 #3
Source File: MissingDragExitEventTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void initAndShowUI() {
    frame = new JFrame("Test frame");

    frame.setSize(SIZE, SIZE);
    frame.setLocationRelativeTo(null);
    final JTextArea jta = new JTextArea();
    jta.setBackground(Color.RED);
    frame.add(jta);
    jta.setText("1234567890");
    jta.setFont(jta.getFont().deriveFont(150f));
    jta.setDragEnabled(true);
    jta.selectAll();
    jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY,
                                     new TestdropTargetListener()));
    jta.addMouseListener(new TestMouseAdapter());
    frame.setVisible(true);
}
 
Example #4
Source File: ChooseDirectory.java    From orbit-image-analysis with GNU General Public License v3.0 6 votes vote down vote up
public ChooseDirectory() {
  setLayout(new PercentLayout(PercentLayout.VERTICAL, 3));

  if (System.getProperty("javawebstart.version") != null) {   
    JTextArea area = new JTextArea(RESOURCE.getString("message.webstart"));
    LookAndFeelTweaks.makeMultilineLabel(area);
    add(area);
  }

  final JButton button = new JButton(RESOURCE.getString("selectDirectory"));
  add(button);
  button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      selectDirectory(button, null);
    }
  });
}
 
Example #5
Source File: ChatMainPane.java    From osrsclient with GNU General Public License v2.0 6 votes vote down vote up
public void addChanPanel(String chanName) {

        JTextArea messagePanel = new JTextArea();
        messagePanel.setLineWrap(true);
        messagePanel.setBackground(new Color(71, 71, 71));
        messagePanel.setForeground(Color.white);
        messagePanel.setFont(ircFont);
        messagePanel.setEditable(false);
        DefaultCaret dc = (DefaultCaret) messagePanel.getCaret();
        dc.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

        JTextArea userPanel = new JTextArea();
        userPanel.setBackground(new Color(71, 71, 71));

        messagePanels.put(chanName, messagePanel);
        userPanels.put(chanName, userPanel);
       
    }
 
Example #6
Source File: DomGui.java    From DominionSim with MIT License 6 votes vote down vote up
private JPanel getAboutPanel() {
       JPanel theAboutPanel = new JPanel( new GridBagLayout() );
       GridBagConstraints theCons = getGridBagConstraints( 2 );
       JLabel lab = new JLabel( new ImageIcon( getClass().getResource("images/Godctoon.gif" ) ) );
       lab.setOpaque( false );
       theAboutPanel.add( lab, theCons );
       theCons.gridy++;
       JTextArea a = new JTextArea( 250, 260 );
       a.setText( "\n Geronimoo's Dominion Simulator \n\n"
           + " Version:\n      2.2.0\n" + " Written by:\n      Jeroen Aga\n"
           + " Released:\n      january 2019\n\n"
           + " Website:\n      http://dominionsimulator.wordpress.com\n" 
           + " Report bugs/Sing Praise:\n      [email protected]\n" );
       theAboutPanel.add( a, theCons );
       theAboutPanel.setPreferredSize(new Dimension(250,260));
       return theAboutPanel;
}
 
Example #7
Source File: License.java    From DTMF-Decoder with MIT License 6 votes vote down vote up
/**
 * Create the frame.
 */
public License() {
	setTitle("License");
	setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
	setBounds(100, 100, 450, 300);
	setResizable(false);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JScrollPane scrollPane = new JScrollPane();
	scrollPane.setBounds(5, 5, 434, 265);
	contentPane.add(scrollPane);
	
	JTextArea txtrTheMitLicense = new JTextArea();
	scrollPane.setViewportView(txtrTheMitLicense);
	txtrTheMitLicense.setLineWrap(true);
	txtrTheMitLicense.setEditable(false);
	txtrTheMitLicense.setWrapStyleWord(true);
	txtrTheMitLicense.setText("The MIT License (MIT)\n\nCopyright (c) 2015 Tinotenda Chemvura\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.");
}
 
Example #8
Source File: MarkdownTextAreaWithPreview.java    From meka with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Initializes the widgets.
 */
@Override
protected void initGUI() {
	super.initGUI();

	setLayout(new BorderLayout());

	m_TabbedPane = new JTabbedPane();
	add(m_TabbedPane, BorderLayout.CENTER);

	m_TextCode = new JTextArea();
	m_TextCode.setFont(GUIHelper.getMonospacedFont());
	m_TabbedPane.addTab("Write", new BaseScrollPane(m_TextCode));

	m_PanePreview = new JEditorPane();
	m_PanePreview.setEditable(false);
	m_PanePreview.setContentType("text/html");
	m_TabbedPane.addTab("Preview", new BaseScrollPane(m_PanePreview));

	m_TabbedPane.addChangeListener(new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			update();
		}
	});
}
 
Example #9
Source File: RunConfigurationFlagStateTest.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Test
public void testNestedQuotesRetainedAfterRoundTripSerialization() {
  RunConfigurationFlagsState state = new RunConfigurationFlagsState("tag", "field");
  RunConfigurationStateEditor editor = state.getEditor(null);
  JTextArea textArea = getTextField(editor);

  String originalText = "--where_clause=\"op = 'addshardreplica' AND purpose = 'rebalancing'\"";
  textArea.setText(originalText);
  editor.applyEditorTo(state);
  assertThat(state.getRawFlags()).containsExactly(originalText);
  editor.resetEditorFrom(state);
  assertThat(textArea.getText()).isEqualTo(originalText);
  // test flags generated for commands
  assertThat(state.getFlagsForExternalProcesses())
      .containsExactly("--where_clause=op = 'addshardreplica' AND purpose = 'rebalancing'");
}
 
Example #10
Source File: SendEMail.java    From tn5250j with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Show the error list from the e-mail API if there are errors
 *
 * @param parent
 * @param sfe
 */
private void showFailedException(SendFailedException sfe) {

   String error = sfe.getMessage() + "\n";

   Address[] ia = sfe.getInvalidAddresses();

   if (ia != null) {
      for (int x = 0; x < ia.length; x++) {
         error += "Invalid Address: " + ia[x].toString() + "\n";
      }
   }

   JTextArea ea = new JTextArea(error,6,50);
   JScrollPane errorScrollPane = new JScrollPane(ea);
   errorScrollPane.setHorizontalScrollBarPolicy(
   JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   errorScrollPane.setVerticalScrollBarPolicy(
   JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   JOptionPane.showMessageDialog(null,
                                    errorScrollPane,
                                    LangTool.getString("em.titleConfirmation"),
                                    JOptionPane.ERROR_MESSAGE);


}
 
Example #11
Source File: LWTextAreaPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void insert(final String text, final int pos) {
    final ScrollableJTextArea pane = getDelegate();
    synchronized (getDelegateLock()) {
        final JTextArea area = pane.getView();
        final boolean doScroll = pos >= area.getDocument().getLength()
                                 && area.getDocument().getLength() != 0;
        area.insert(text, pos);
        revalidate();
        if (doScroll) {
            final JScrollBar vbar = pane.getVerticalScrollBar();
            if (vbar != null) {
                vbar.setValue(vbar.getMaximum() - vbar.getVisibleAmount());
            }
        }
    }
    repaintPeer();
}
 
Example #12
Source File: PanelLogging.java    From java-ocr-api with GNU Affero General Public License v3.0 6 votes vote down vote up
private static void logAndScrollToBottom(final JTextArea textArea, final String mesg) {
    if(! SwingUtilities.isEventDispatchThread()) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                logAndScrollToBottom(textArea, mesg);
            }
        });
        return;
    }
    textArea.append(textArea.getText().length() == 0 ? mesg : "\n" + mesg);

    String text = textArea.getText();
    if(text.length() > 2) {
        int lastLinePos = text.lastIndexOf("\n", text.length() - 2);
        if(lastLinePos > 0) {
            textArea.setCaretPosition(lastLinePos + 1); 
        }
    }
}
 
Example #13
Source File: JXMLViewer.java    From freeinternals with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 *
 * @param xml XML data to be displayed
 */
public JXMLViewer(final InputStream xml) {
    this.tabbedPane = new JTabbedPane();
    if (xml instanceof PosDataInputStream) {
        byte[] buf = ((PosDataInputStream) xml).getBuf();
        StringBuilder sb = new StringBuilder(buf.length + 1);
        for (byte b : buf) {
            sb.append((char) b);
        }

        JTextArea textPlainText = new JTextArea(sb.toString());
        textPlainText.setLineWrap(true);
        textPlainText.setEditable(false);
        tabbedPane.addTab("XML Plain Text", new JScrollPane(textPlainText));
    }

    this.setLayout(new BorderLayout());
    this.add(this.tabbedPane, BorderLayout.CENTER);
}
 
Example #14
Source File: ClearVolumeTCPClientHelper.java    From clearvolume with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void showEditableOptionPane(final String pText,
									final String pTitle,
									final int pMessageType)
{
	final JTextArea ta = new JTextArea(48, 100);
	ta.setText(pText);
	ta.setWrapStyleWord(true);
	ta.setLineWrap(false);
	ta.setCaretPosition(0);
	ta.setEditable(false);

	JOptionPane.showMessageDialog(	null,
									new JScrollPane(ta),
									pTitle,
									pMessageType);
}
 
Example #15
Source File: WindowGui.java    From winthing with Apache License 2.0 5 votes vote down vote up
public void reload() {
    if (isVisible()) {
        JTextArea area = (JTextArea)components.get(Gui.TEXTAREA.key);
        area.setText(ConsoleLogger.getEvents());

        JScrollPane scroll = (JScrollPane)components.get(Gui.SCROLLBAR.key);
        scroll.getVerticalScrollBar().setValue(scroll.getVerticalScrollBar().getMaximum());
    }
}
 
Example #16
Source File: WhiteRabbitMain.java    From WhiteRabbit with Apache License 2.0 5 votes vote down vote up
private JComponent createConsolePanel() {
	JTextArea consoleArea = new JTextArea();
	consoleArea.setToolTipText("General progress information");
	consoleArea.setEditable(false);
	Console console = new Console();
	console.setTextArea(consoleArea);
	System.setOut(new PrintStream(console));
	System.setErr(new PrintStream(console));
	JScrollPane consoleScrollPane = new JScrollPane(consoleArea);
	consoleScrollPane.setBorder(BorderFactory.createTitledBorder("Console"));
	consoleScrollPane.setPreferredSize(new Dimension(800, 200));
	consoleScrollPane.setAutoscrolls(true);
	ObjectExchange.console = console;
	return consoleScrollPane;
}
 
Example #17
Source File: RemotePrinterStatusRefresh.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private JPanel createInstructionsPanel() {
    JPanel instructionsPanel = new JPanel(new BorderLayout());
    JTextArea instructionText = new JTextArea(INSTRUCTIONS_TEXT);
    instructionText.setEditable(false);
    instructionsPanel.setBorder(createTitledBorder("Test Instructions"));
    instructionsPanel.add(new JScrollPane(instructionText));
    return  instructionsPanel;
}
 
Example #18
Source File: TextViewOOM.java    From jdk8u-jdk 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 #19
Source File: ImageableAreaTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowTestDialog(String description,
        String failMessage, Runnable action) {
    final JDialog dialog = new JDialog();
    dialog.setTitle("Test: " + (++testCount));
    dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    JTextArea textArea = new JTextArea(description);
    textArea.setEditable(false);
    final JButton testButton = new JButton("Print Table");
    final JButton passButton = new JButton("PASS");
    passButton.setEnabled(false);
    passButton.addActionListener((e) -> {
        dialog.dispose();
    });
    final JButton failButton = new JButton("FAIL");
    failButton.setEnabled(false);
    failButton.addActionListener((e) -> {
        throw new RuntimeException(failMessage);
    });
    testButton.addActionListener((e) -> {
        testButton.setEnabled(false);
        action.run();
        passButton.setEnabled(true);
        failButton.setEnabled(true);
    });
    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(textArea, BorderLayout.CENTER);
    JPanel buttonPanel = new JPanel(new FlowLayout());
    buttonPanel.add(testButton);
    buttonPanel.add(passButton);
    buttonPanel.add(failButton);
    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
    dialog.add(mainPanel);
    dialog.pack();
    dialog.setVisible(true);
}
 
Example #20
Source File: AboutDialog.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates a panel showing the licence.
 *
 * @return a panel.
 */
private JPanel createLicencePanel() {

  final JPanel licencePanel = new JPanel( new BorderLayout() );
  final JTextArea area = new JTextArea( this.licence );
  area.setLineWrap( true );
  area.setWrapStyleWord( true );
  area.setCaretPosition( 0 );
  area.setEditable( false );
  licencePanel.add( new JScrollPane( area ) );
  return licencePanel;

}
 
Example #21
Source File: QOptionPaneUI.java    From pumpernickel with MIT License 5 votes vote down vote up
protected void updateMainMessage(QOptionPane pane) {
	String mainMessage = pane.getMainMessage();
	JTextArea textArea = getMainMessageTextArea(pane);
	if (mainMessage == null) {
		textArea.setText("");
		textArea.setVisible(false);
	} else {
		textArea.setText(mainMessage);
		textArea.setVisible(true);
	}
}
 
Example #22
Source File: HeaderPanel.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method creates header panel with given title and description
 *
 * @param title header title
 * @param text header description
 */
private void create(String title, String text) {
  setLayout(new FlowLayout());

  Icon icon = IconManager.SESSION_INVITATION_ICON;
  textMain = new JTextArea();
  textMain.setEditable(false);

  textTitle = new JLabel();
  String textConvertedToJLabelHTML = convertTextToJLabelHTML(title);

  JPanel titlePanel = new JPanel();
  titlePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
  titlePanel.setBackground(backColor);

  textTitle.setText(textConvertedToJLabelHTML);
  titlePanel.add(textTitle);

  textMain.setText(text);
  textMain.setSize(500, 100);

  textMain.setWrapStyleWord(true);
  textMain.setLineWrap(true);

  JPanel textPanel = new JPanel();

  textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.Y_AXIS));

  textPanel.add(titlePanel);
  textPanel.add(textMain);
  textPanel.setBackground(backColor);

  add(textPanel);

  JLabel lblIcon = new JLabel();
  lblIcon.setIcon(icon);
  add(lblIcon);

  setBackground(backColor);
}
 
Example #23
Source File: LicenseWindow.java    From amidst with GNU General Public License v3.0 5 votes vote down vote up
private JTextArea createLicenseTextArea() {
	JTextArea result = new JTextArea();
	result.setEditable(false);
	result.setLineWrap(true);
	result.setWrapStyleWord(true);
	return result;
}
 
Example #24
Source File: SwingSet3.java    From littleluck with Apache License 2.0 5 votes vote down vote up
protected void displayErrorMessage(String message, Exception ex) {
    JPanel messagePanel = new JPanel(new BorderLayout());       
    JLabel label = new JLabel(message);
    messagePanel.add(label);
    if (ex != null) {
        RoundedPanel panel = new RoundedPanel(new BorderLayout());
        panel.setBorder(new RoundedBorder());
        
        // remind(aim): provide way to allow user to see exception only if desired
        StringWriter writer = new StringWriter();
        ex.printStackTrace(new PrintWriter(writer));
        JTextArea exceptionText = new JTextArea();
        exceptionText.setText("Cause of error:\n" +
                writer.getBuffer().toString());
        exceptionText.setBorder(new RoundedBorder());
        exceptionText.setOpaque(false);
        exceptionText.setBackground(
                Utilities.deriveColorHSB(UIManager.getColor("Panel.background"),
                0, 0, -.2f));
        JScrollPane scrollpane = new LuckScrollPane(exceptionText);
        scrollpane.setBorder(EMPTY_BORDER);
        scrollpane.setPreferredSize(new Dimension(600,240));
        panel.add(scrollpane);
        messagePanel.add(panel, BorderLayout.SOUTH);            
    }
    JOptionPane.showMessageDialog(getMainFrame(), messagePanel, 
            resourceMap.getString("error.title"),
            JOptionPane.ERROR_MESSAGE);
            
}
 
Example #25
Source File: MetalworksDocumentFrame.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example #26
Source File: OperationPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JComponent getTitleComponent (String msg) {
    JTextArea area = new JTextArea (msg);
    area.setWrapStyleWord (true);
    area.setLineWrap (true);
    area.setEditable (false);
    area.setOpaque (false);
    area.setBorder(BorderFactory.createEmptyBorder());
    area.setBackground(new Color(0, 0, 0, 0));
    area.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
    return area;
}
 
Example #27
Source File: VectorContentViewer.java    From SVG-Android with Apache License 2.0 5 votes vote down vote up
VectorContentViewer(String stringData, OnTextWatcher textWatcher) {
    this.mTextWatcher = textWatcher;
    setLayout(new GridLayout(1, 1));
    mTextArea = new JTextArea();
    mTextArea.setText(stringData);
    mTextArea.getDocument().addDocumentListener(this);
    mTextArea.setMinimumSize(new Dimension(200, 200));
    add(mTextArea);
}
 
Example #28
Source File: GerarEstrutura.java    From JCEditor with GNU General Public License v2.0 5 votes vote down vote up
/**
* O construtor recebe o JTextArea no qual será gerada a estrutura e a String
* que contém o nome da linguagem de programação.
*/
public GerarEstrutura(JTextArea area, String linguagem) {
	this.area = area;
	this.linguagem = linguagem;

	gerar();
}
 
Example #29
Source File: bug8132503.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init() {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            JTextArea textArea = new JTextArea("Text area of the test.", 40, 40);
            add(new JScrollPane(textArea));
        }
    });
}
 
Example #30
Source File: bug4337267.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void testTextComponent() {
    System.out.println("testTextComponent:");
    JTextArea area1 = new JTextArea();
    injectComponent(p1, area1, false);
    area1.setText(shaped);
    JTextArea area2 = new JTextArea();
    injectComponent(p2, area2, true);
    area2.setText(text);
    window.repaint();
    printq = new JComponent[] { area1, area2 };
    SwingUtilities.invokeLater(printComponents);
    SwingUtilities.invokeLater(compareRasters);
}