TabbedPane.xml
<?xml version="1.0" encoding="UTF-8"?>
<panel layout="BorderLayout">
<label text="TabbedPane sample" constraints="BorderLayout.NORTH" />
<tabbedpane>
<panel name="Tab 1" layout="FlowLayout(FlowLayout.LEFT)">
<label text="Blue content" foreground="0000FF" font="BOLD-30" />
</panel>
<panel name="Tab 2" layout="FlowLayout(FlowLayout.LEFT)">
<label text="Green content" foreground="00FF00" font="BOLD-30" />
</panel>
<panel name="Tab 3" layout="FlowLayout(FlowLayout.LEFT)">
<label text="Red content" foreground="FF0000" font="BOLD-30" />
</panel>
</tabbedpane>
</panel>
TabbedPane.java
package swixml.sample;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.swixml.SwingEngine;
public class TabbedPane extends JPanel {
public TabbedPane() {
try {
new SwingEngine(this).insert("swixml/sample/TabbedPane.xml", this);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("SwiXML - TabbedPane");
frame.setContentPane(new TabbedPane());
frame.pack();
Dimension sc = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((sc.width - frame.getWidth()) / 2, (sc.height - frame.getHeight()) / 2);
frame.setVisible(true);
}
}