import com.toedter.calendar.*;
import org.swixml.SwingEngine;
import org.swixml.ConverterLibrary;
import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.theme.SubstanceEbonyTheme;import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;public class CustomTags extends WindowAdapter {
public CustomTags() throws Exception {
SwingEngine swix = new SwingEngine(this);
swix.getTaglib().registerTag("Calendar", JCalendar.class);
swix.render("customtags.xml").setVisible(true);
} /**
* Invoked when a window is in the process of being closed.
* The close operation can be overridden at this point.
*/
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
} //
// Make the class bootable
//
public static void main(String[] args) throws Exception {
new CustomTags();
}
}这是xml
<?xml version="1.0" encoding="UTF-8" ?>
<frame title="Swixml: Custom Tags" size="400,260" defaultCloseOperation="JFrame.EXIT_ON_CLOSE">
<!--plaf="org.jvnet.substance.skin.SubstanceRavenLookAndFeel"> -->
<panel layout="BorderLayout">
<panel border="TitledBorder(JCalendar,0,1,VERDANA-BOLD-18)" background="white" constraints="BorderLayout.NORTH">
<label font="Comic Sans MS-BOLD-18" foreground="black">Custom Components in Swixml</label>
</panel>
<calendar initclass="java.util.Date"/>
</panel>
</frame>生成的效果没有例子中的图片那么漂亮
import org.swixml.SwingEngine;
import org.swixml.ConverterLibrary;
import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.theme.SubstanceEbonyTheme;import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;public class CustomTags extends WindowAdapter {
public CustomTags() throws Exception {
SwingEngine swix = new SwingEngine(this);
swix.getTaglib().registerTag("Calendar", JCalendar.class);
swix.render("customtags.xml").setVisible(true);
} /**
* Invoked when a window is in the process of being closed.
* The close operation can be overridden at this point.
*/
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
} //
// Make the class bootable
//
public static void main(String[] args) throws Exception {
new CustomTags();
}
}这是xml
<?xml version="1.0" encoding="UTF-8" ?>
<frame title="Swixml: Custom Tags" size="400,260" defaultCloseOperation="JFrame.EXIT_ON_CLOSE">
<!--plaf="org.jvnet.substance.skin.SubstanceRavenLookAndFeel"> -->
<panel layout="BorderLayout">
<panel border="TitledBorder(JCalendar,0,1,VERDANA-BOLD-18)" background="white" constraints="BorderLayout.NORTH">
<label font="Comic Sans MS-BOLD-18" foreground="black">Custom Components in Swixml</label>
</panel>
<calendar initclass="java.util.Date"/>
</panel>
</frame>生成的效果没有例子中的图片那么漂亮
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货