![JAR search and dependency download from the Maven repository](/logo.png)
tutorial.support.JTutorialFrame Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docking-frames-demo-tutorial Show documentation
Show all versions of docking-frames-demo-tutorial Show documentation
${project.name} is an enry-level tutorial for docking-frames
The newest version!
package tutorial.support;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import bibliothek.gui.DockController;
import bibliothek.gui.DockFrontend;
public class JTutorialFrame extends JFrame{
private List runOnClose = new ArrayList();
public JTutorialFrame( Class> clazz ){
setBounds( 40, 40, 800, 600 );
Tutorial tutorial = (Tutorial)clazz.getAnnotation( Tutorial.class );
setTitle( tutorial == null ? clazz.getSimpleName() : tutorial.title() );
setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
addWindowListener( new WindowAdapter(){
public void windowClosing( WindowEvent e ){
dispose();
for( Runnable onClose : runOnClose ){
onClose.run();
}
}
});
}
public void runOnClose( Runnable run ){
runOnClose.add( run );
}
public void destroyOnClose( final DockController controller ){
runOnClose( new Runnable(){
public void run(){
controller.kill();
}
});
}
public void destroyOnClose( final DockFrontend frontend ){
runOnClose( new Runnable(){
public void run(){
frontend.kill();
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy