/**
*Add netbeans java project without the Main class
*Add lib spring
*create package todo and todo.ui
**/
package todo.ui;
import java.awt.Dimension;
import java.awt.Frame;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
public class MainFrame extends JFrame {
public void init() {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setSize(new Dimension(600, 400));
setVisible(true);
setState(Frame.NORMAL);
show();
}
}
//////////////////////////////////
package todo;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Launcher {
public void launch() {
String[] contextPaths = new String[] {"todo/app-context.xml"};
new ClassPathXmlApplicationContext(contextPaths);
}
}
////////////////////////////////
package todo;
public class ToDo {
public static void main(String[] args) {
Launcher launcher = new Launcher();
launcher.launch();
}
}
////////////////////////////////////////
Create an XML File path+named = src/todo/app-context.xml
///////////////////////////////////////
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="mainFrame" class="todo.ui.MainFrame" method="init"></bean>
</beans>
<beans><bean id="mainFrame" class="todo.ui.MainFrame" method="init"> </bean>
</beans>
Wednesday, May 20, 2009
Spring+Swing App
Subscribe to:
Posts (Atom)