Calculatrice

De Vincy Messages postés 4 Statut Membre -  
De Vincy Messages postés 4 Statut Membre -
Bonjour à tous,
je débute en java et dois écrire une application web d'une calculatrice (avec seam et jsf). Je voudrais un coup de main pour écrire le code qui affiche le bouton cliqué et faire les calculs.
A voir également:

4 réponses

HACKER 712 Messages postés 1463 Statut Contributeur 255
 
Bonjour !

Où en es-tu ? Poste ce que tu as déjà fait, entre balises !
0
De Vincy Messages postés 4 Statut Membre
 
J'ai seulement fait l'interface graphique que voici:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="https://www.redhat.com/en/topics/middleware"
    xmlns:ui="https://www.oracle.com/java/technologies/"
    xmlns:f="https://www.oracle.com/java/technologies/"
    xmlns:h="https://www.oracle.com/java/technologies/"
    xmlns:rich="https://richfaces.jboss.org/"
    template="layout/template.xhtml">

    <ui:define name="body">
   <h:form>
        <h1>Calculatrice</h1>

<rich:panel style=" width : 260px;">
           <rich:panel style=" width : 240px;">     
              <h:inputText id="ecran" value="#{ecran.initial}" style=" height : 40px; width : 200px;"/>
           </rich:panel>
                   
 <s:div styleClass="info">  
  <rich:panel style=" width : 240px;"> 
       
    <h:panelGrid columns="3">
      <s:div>

       <s:div>
         <h:commandButton id="seven" value="7" style=" width : 35px;"/>
         <h:commandButton id="eight" value="8" style=" width : 35px;"/>
         <h:commandButton id="nine" value="9" style=" width : 35px;"/>
       </s:div>
       <s:div>         
         <h:commandButton id="four" value="4" style=" width : 35px;"/>
         <h:commandButton id="five" value="5" style=" width : 35px;"/>
         <h:commandButton id="six" value="6" style=" width : 35px;"/>
       </s:div> 
       <s:div>        
         <h:commandButton id="one" value="1" style=" width : 35px;"/>
         <h:commandButton id="two" value="2" style=" width : 35px;"/>
         <h:commandButton id="three" value="3" style=" width : 35px;"/>
       </s:div>
       <s:div>         
         <h:commandButton id="zero" value="0" style=" width : 35px;"/>
         <h:commandButton id="plusmoins" value="+/-" style=" width : 35px;"/>
         <h:commandButton id="fullstop" value="." style=" width : 35px;"/>
       </s:div>     
   
      </s:div>

       <s:div style="width : 29px; height : 100px;">         
         <h:commandButton id="diviser" value="/" style=" width : 35px;"/>
         <h:commandButton id="multiplier" value="*" style=" width : 35px;"/>
         <h:commandButton id="moins" value="-" style=" width : 35px;"/>
         <h:commandButton id="plus" value="+" style=" width : 35px;"/>
       </s:div>  
                

       <s:div style=" height : 95px;">    
       <rich:spacer style=" width : 8px"/>     
         <h:commandButton id="equal" value="=" style="width : 35px; height : 94px;"/>
       </s:div> 
                 
 
    </h:panelGrid>
  </rich:panel>         
 </s:div> 
 </rich:panel>
   </h:form>
    </ui:define>
</ui:composition>


C'est l'action des boutons en java qu'il me faut. Merci.
0
HACKER 712 Messages postés 1463 Statut Contributeur 255
 
Je ne comprends pas : tu ne dois pas faire une applet plutôt ?
0
De Vincy Messages postés 4 Statut Membre
 
Non, c'est une application qui respecte l'architecture MVC. c'est la Vue que j'ai posté. Il me reste à écrire le Controleur pour avoir une calculatrice qui fonctionne.
0