Package com.cedarsoft.presenter.demo

Source Code of com.cedarsoft.presenter.demo.SpringDemo

package com.cedarsoft.presenter.demo;

import com.cedarsoft.commons.struct.Node;
import com.cedarsoft.presenter.JMenuBarPresenter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.swing.JFrame;

/**
*
*/
public class SpringDemo {
  private Node rootNode;

  public static void main( String[] args ) {
    new SpringDemo().run();
  }

  public SpringDemo() {
    ApplicationContext applicationContext = new ClassPathXmlApplicationContext( "SpringDemo.spr.xml", SpringDemo.class );
    rootNode = ( Node ) applicationContext.getBean( "menuNode" );
  }

  private void run() {
    JMenuBarPresenter presenter = new JMenuBarPresenter();

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );

    frame.setJMenuBar( presenter.present( rootNode ) );

    frame.pack();
    frame.setSize( 800, 600 );
    frame.setLocationRelativeTo( null );


    frame.setVisible( true );
  }

}
TOP

Related Classes of com.cedarsoft.presenter.demo.SpringDemo

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.