rendered paste bodypackage ca.uqam.in4375.tp3;
import org.swixml.SwingEngine;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.io.File;
public class Tp3Gui extends JPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
public JFrame ecran;
public JTextArea searchStr;
public JTextArea resultat;
public JButton quit;
public static void main( String[] args ) throws Exception {
new Tp3Gui();
}
public Tp3Gui() throws Exception {
new SwingEngine( this ).render( new File( "xml/tp3gui.xml" ) );
this.ecran.setVisible( true );
}
public Action doHelloWorld = new AbstractAction() {
private static final long serialVersionUID = -8484249421113665155L;
public void actionPerformed( ActionEvent event ) {
try {
resultat.setText("moo foo");
} catch ( Exception ex ) {
resultat.setText( "Erreur ! : " + ex.getMessage() );
}
}
};
}
//------------------------------------------------------------------the xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
tp3 gui
-->
<frame id="ecran" size="600,800" title="Aggrégateur de recherche">
<panel layout="BorderLayout" constraints="BorderLayout.NORTH">
<panel constraints="BorderLayout.RIGHT">
<label text="Recherche : " />
<textarea id="searchStr" text="" columns="20"/>
<button id="quit" Text="Rechercher" Action="doHelloWorld" icon="/web/img/google.gif" />
</panel>
</panel>
<scrollpane horizontalAlignment="CENTER" background="666666" constraints="BorderLayout.CENTER">
<textarea id="resultat" text="Le résultat sera affiché ici" background="EEEEEE"/>
</scrollpane>
</frame>