Java tutorial
//package com.java2s; //License from project: Open Source License import javax.swing.*; public class Main { public static JTextArea getTextAreaFromJScrollPane(JScrollPane scrollBar) { if (scrollBar != null) return ((JTextArea) scrollBar.getViewport().getView()); else { try { throw new Exception("JTextArea received was equal to null!"); } catch (Exception e) { e.printStackTrace(); } return null; } } }