All pastes #253337 Raw Edit

Something

public text v1 · immutable
#253337 ·published 2006-11-20 17:32 UTC
rendered paste body
package moo.foo.ca;

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>