Java SWING- Create a function to add elements to JScrollPanel ??? PLEASE
Posted
by battousai622
on Stack Overflow
See other posts from Stack Overflow
or by battousai622
Published on 2010-06-05T11:18:37Z
Indexed on
2010/06/05
11:22 UTC
Read the original article
Hit count: 197
I want to create a function so that i can call add JLables, ect inside the JScrollPanel. Im not sure what the command is in netbeans. I tried doing JScrollPanel -> events -> container -> componentAdded to create the code below. But nothing shows up when i add code to that function. Any help would be great please! =]
private void initComponents() {
scrollPanel = new javax.swing.JScrollPane();
scrollPanel.addContainerListener(new java.awt.event.ContainerAdapter() {
public void componentAdded(java.awt.event.ContainerEvent evt) {
scrollPanelComponentAdded(evt);
}
}
private void scrollPanelComponentAdded(java.awt.event.ContainerEvent evt) {
System.out.println("main");
}
© Stack Overflow or respective owner