List of usage examples for java.awt.event ContainerAdapter ContainerAdapter
ContainerAdapter
From source file:Main.java
public static void main() { ContainerListener listener = new ContainerAdapter() { public void componentAdded(ContainerEvent evt) { Component c = evt.getChild(); }//from w w w .j av a2 s . c o m public void componentRemoved(ContainerEvent evt) { Component c = evt.getChild(); } }; JFrame frame = new JFrame(); frame.addContainerListener(listener); }
From source file:Main.java
public Main() { addContainerListener(new ContainerAdapter() { @Override//from w w w .j a va2 s .co m public void componentAdded(ContainerEvent e) { if (jProgressBar1 == e.getChild()) { new Thread(new Task()).start(); } } }); jProgressBar1.setName(""); jProgressBar1.setValue(0); jProgressBar1.setStringPainted(true); add(jProgressBar1); }