Nope - check it out:
http://www.meta-solutions.
Open your Java console.
Main Topics
Browse All TopicsYou'd think I'd know a thing or three about GUI by now, but I'm stumped. I've released a project on SourceForge: JFCML - JFC/Swing XML Markup Language http://meta-solutions.com/
I'm creating a demo for the website: http://meta-solutions.com/
Basically, the demo lets the user edit a JFCML description file and see the results. I use javascript to call the runDemo( String ) method defined in the demo class. The base window container in my package is called JFCMLWindow. It extends JRootPane and is basically the component that the JFCMLWindowFactory draws on based on the XML. (That's why I need to set the rootpane more than once).
It works the first time(when i call it from init()), but when you click on the button (and call it with javascript), it kills the window.
Here's my demo class (you'll need my jar if you're going to compile it):
import com.metasolutions.jfcml.JF
import com.metasolutions.jfcml.JF
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyn
import java.util.regex.MatchResul
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.SwingUtilities
import java.io.File;
public class test extends JApplet
{
private JFCMLWindowFactory factory;
private JFCMLWindow jfcmlw;
public void init()
{
factory = new JFCMLWindowFactory();
runDemo( "<JFCML><JRootPane><Conten
}
private static final String HEADER =
"<?xml version=\"1.0\" encoding=\"UTF-16\"?>\r\n\
"<!DOCTYPE JFCML SYSTEM \"http://meta-solutions.co
public void runDemo( String input ) {
final String s = HEADER + input;
try {
SwingUtilities.invokeAndWa
public void run() {
createAndShowGUI( s );
System.out.println( "ALL DONE!" );
System.out.flush();
}
});
} catch( Exception e ) {
throw new RuntimeException( "Failed to create GUI", e );
}
System.out.println( "returning from rundemo()" );
System.out.flush();
}
private void createAndShowGUI( String s ) {
if( jfcmlw != null )
remove( jfcmlw );
invalidate();
jfcmlw = new JFCMLWindow();
factory.build( new java.io.CharArrayReader( s.toCharArray() ), jfcmlw );
System.out.println( "returned from build" );
System.out.flush();
add( jfcmlw );
repaint();
System.out.println( "set root pane" );
System.out.flush();
setSize( 300,300 );
setVisible( true );
}
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Nope - check it out:
http://www.meta-solutions.
Open your Java console.
BTW - you need Java 1.4+ for the demo.
Here's what I have now:
import com.metasolutions.jfcml.JF
import com.metasolutions.jfcml.JF
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.SwingUtilities
import java.io.File;
public class test extends JApplet
{
private JFCMLWindowFactory factory;
private JFCMLWindow jfcmlw;
public void init()
{
factory = new JFCMLWindowFactory();
runDemo( "<JFCML><JRootPane><JMenuB
}
private static final String HEADER =
"<?xml version=\"1.0\" encoding=\"UTF-16\"?>\r\n\
"<!DOCTYPE JFCML SYSTEM \"http://meta-solutions.co
public void runDemo( String input ) {
System.out.println(input);
final String s = HEADER + input;
try {
SwingUtilities.invokeAndWa
public void run() {
createAndShowGUI( s );
System.out.println( "ALL DONE!" );
System.out.flush();
}
});
} catch( Exception e ) {
throw new RuntimeException( "Failed to create GUI", e );
}
System.out.println( "returning from rundemo()" );
System.out.flush();
}
private void createAndShowGUI( String s ) {
if( jfcmlw != null )
this.removeAll();
jfcmlw = new JFCMLWindow();
factory.build( new java.io.CharArrayReader( s.toCharArray() ), jfcmlw );
System.out.println( "returned from build" );
System.out.flush();
invalidate();
add( jfcmlw );
repaint();
System.out.println( "set root pane" );
System.out.flush();
setSize( 300,300 );
setVisible( true );
}
}
I use JDK1.5 and it doesn't wanna load the applet at all
-- Opera Java Console --
Java vendor: Sun Microsystems Inc.
Java version: 1.5.0-beta
type 'h' for help
--
java.lang.ClassNotFoundExc
at java.net.URLClassLoader+1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at java.lang.ClassLoader.load
at com.opera.PluginPanel.run(
at java.lang.Thread.run(Unkno
Thanks. There were actually two problems: I did need the validate() call, and, I needed to setRootPaneCheckingEnabled
So, I changed back to setRootPane(), and call validate() right after. Turns out the invalidate() call is unneccessary, as this happens automatically in Container.remove().
So anyway it works now. Check it out:
http://www.meta-solutions.
JFCML so closely models the JComponent heirarchy you can probably figure it out from the simple example provided in the demo. Otherwise, the javadocs and tutorials are a click away from the demo page! </cheap plug>
Thanks a mil,
Shawn
Business Accounts
Answer for Membership
by: Giant2Posted on 2004-10-06 at 23:03:13ID: 12245879
>It works the first time(when i call it from init()), but when you click on the button (and call it with javascript), it kills the window
Any error?