Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2012, 11:25
gobodeath
 
Fecha de Ingreso: marzo-2012
Mensajes: 75
Antigüedad: 12 años, 1 mes
Puntos: 3
Pregunta Interfaces para JAVA con CSS y HTML?

Hola, estoy tratando de hacer una calculadora a punta de arreglos, es decir las sumas las multimplicaciones, todo hacerlo manual, con java, y pues quiero agregarle una Interfaz, lo que sucede es que no se como hacer la interfaz de la calculadora, porque la estoy haciendo en un proyecto JAVAWEB, es decir se me reproduce en el navegador, pero nosé como inplementar la interfaz con JAVA la interfaz esta hecha en html y CSS, pero no me funciona, traté de ver si era igual que en JavaScript pero no jaja y no se cómo hacer para que cada que presione un número aparezca en el display de la calculadora, tampoco se como hacer para interactuar y hacer las respectivas operaciones con los número de cada botón ayuda aquí les dejo el codigo

Código HTML:
Ver original
  1. <%--
  2.    Document   : Calculadora
  3.    Created on : 03-jun-2012, 11:00:15
  4.    Author     : @Velandia
  5. --%>
  6. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  7. <!DOCTYPE html>
  8.     <head>  
  9.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  10.         <title>Calculadora con arreglos en Java</title>
  11.         <style type="text/css">
  12. @import url('EstilosCalculadora.css');
  13.     </head>
  14.     <body>
  15.         <h1 textalign="center">Bienvenido</h1>
  16.     <div id="global_container">
  17.        <form>
  18. <table border="5" align=center>
  19. <tr align="center">
  20. <td colspan = 4>
  21.  
  22. <table border="3">
  23. <tr>
  24. <td align=center><input name="display" value="0" size=20></td>
  25. </tr>
  26.  
  27. </td>
  28. </tr>
  29.  
  30. <tr align=center>
  31. <td>
  32. <label class="uiButton uiButtonConfirm" for="uc5md2_3">
  33. <input id="uc5md2_3" type="button" value="    7    "
  34.  onClick="System.out.print(this.form.display, '7')"/>
  35. </td>
  36. <td>
  37. <label class="uiButton uiButtonConfirm" for="uc5md2_3">
  38. <input id="uc5md2_3" type="button" value="    8    "
  39.  onClick="addChar(this.form.display, '8')">
  40. </td>
  41. <td>
  42. <label class="uiButton uiButtonConfirm" for="uc5md2_3">    
  43. <input id="uc5md2_3" type="button" value="    9    "
  44.  onClick="addChar(this.form.display, '9')">
  45. </td>
  46. <td>
  47. <label class="uiButton uiButtonConfirm" for="uc5md2_3">
  48. <input id="uc5md2_3" type="button" value="    /     "
  49.  onClick="addChar(this.form.display, '/')">
  50. </td>
  51. </tr>
  52.  
  53. <tr align=center>
  54. <td>
  55. <label class="uiButton uiButtonConfirm" for="uc5md2_3">    
  56. <input id="uc5md2_3" type="button" value="    4    "
  57.  onClick="addChar(this.form.display, '4')">
  58. </td>
  59. <td>
  60. <label class="uiButton uiButtonConfirm" for="uc5md2_3">
  61. <input id="uc5md2_3" type="button" value="    5    "
  62.  onClick="addChar(this.form.display, '5')">
  63. </td>
  64. <td>
  65. <label class="uiButton uiButtonConfirm" for="uc5md2_3">    
  66. <input id="uc5md2_3" type="button" value="    6    "
  67.  onClick="addChar(this.form.display, '6')">
  68. </td>
  69. <td>
  70. <label class="uiButton uiButtonConfirm" for="uc5md2_3">    
  71. <input id="uc5md2_3" type="button" value="    *    "
  72.  onClick="addChar(this.form.display, '*')">
  73. </td>
  74. </tr>
  75.  
  76. <tr align=center>
  77. <td>
  78. <label class="uiButton uiButtonConfirm" for="uc5md2_3">        
  79. <input id="uc5md2_3" type="button" value="    1    "
  80.  onClick="addChar(this.form.display, '1')">
  81. </td>
  82. <td>
  83. <label class="uiButton uiButtonConfirm" for="uc5md2_3">        
  84. <input id="uc5md2_3" type="button" value="    2    "
  85.  onClick="addChar(this.form.display, '2')">
  86. </td>
  87.  
  88. <td>
  89. <label class="uiButton uiButtonConfirm" for="uc5md2_3">        
  90. <input id="uc5md2_3" type="button" value="    3    "
  91.  onClick="addChar(this.form.display, '3')">
  92. </td>
  93. <td>
  94. <label class="uiButton uiButtonConfirm" for="uc5md2_3">        
  95. <input id="uc5md2_3" type="button" value="     -    "
  96.  onClick="addChar(this.form.display, '-')">
  97. </td>
  98. </tr>
  99.  
  100. <tr align=center>
  101. <td>
  102. <label class="uiButton uiButtonConfirm" for="uc5md2_3">            
  103. <input id="uc5md2_3" type="button" value="    0    "
  104.  onClick="addChar(this.form.display, '0')">
  105. </td>
  106. <td>
  107. <label class="uiButton uiButtonConfirm" for="uc5md2_3">            
  108. <input id="uc5md2_3" type="button" value="     .    "
  109.  onClick="addChar(this.form.display, '.')">
  110. </td>
  111. <td>
  112. <label class="uiButton uiButtonConfirm" for="uc5md2_3">            
  113. <input id="uc5md2_3" type="button" value="   +/-   "
  114.  onClick="changeSign(this.form.display)">
  115. </td>
  116. <td>
  117. <label class="uiButton uiButtonConfirm" for="uc5md2_3">            
  118. <input id="uc5md2_3" type="button" value="    +    "
  119.  onClick="addChar(this.form.display, '+')">
  120. </td>
  121. </tr>
  122.  
  123. <tr align=center>
  124. <td>
  125. <label class="uiButton uiButtonConfirm" for="uc5md2_3">                
  126. <input id="uc5md2_3" type="button" value="    (    "
  127.  onClick="addChar(this.form.display, '(')">
  128. </td>
  129. <td>
  130. <label class="uiButton uiButtonConfirm" for="uc5md2_3">                
  131. <input id="uc5md2_3" type="button" value="     )    "
  132.  onClick="addChar(this.form.display, ')')">
  133. </td>
  134. <td>
  135. <label class="uiButton uiButtonConfirm" for="uc5md2_3">                
  136. <input id="uc5md2_3" type="button" value="   sq    "
  137.  onClick="if (checkNum(this.form.display.value))
  138.     { square(this.form) }">
  139. </td>
  140. <td>
  141. <label class="uiButton uiButtonConfirm" for="uc5md2_3">            
  142. <input id="uc5md2_3" type="button" value="    <-   "
  143.  onClick="deleteChar(this.form.display)">
  144. </td>
  145. </tr>
  146.  
  147. <tr align=center>
  148. <td colspan="2">
  149. <label class="uiButton uiButtonSpecial" for="gxz_4124">    
  150. <input id="gxz_4124" type="button" value="      Invio      " name="enter"
  151.  onClick="if (checkNum(this.form.display.value))
  152.     { compute(this.form) }">
  153. </td>
  154. <td colspan="2">
  155. <label class="uiButton uiButtonSpecial" for="gxz_4124">    
  156. <input id="gxz_4124" type="button" value="         C          "
  157.  onClick="this.form.display.value = 0 ">
  158. </td>
  159. </tr>
  160. </form>
  161.        
  162.     </div
  163.    </body>
  164. </html>