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