Foro de programacion

programacion
RegistrateNewsletter
zonas:adsl:area-flash:area-php:area-asp:area-vb:area-photoshop:area-Vfox:area-Soft:area.:Mas
+ de 45.000 registrados
Secciones: Manuales-Diseño-Trucos-Recursos-Foros/Comunidad-Software-CodigoFuente-compras
AñadenosFavoritos
Secciones: Herramientas-Libros-Webmasters/Google-Noticias -Biblioteca-Cursos--Directorio-EmpleoN
Foros de Programacion - Cominidad de Programadores
 
Foros de programacion
es una web de ayuda a los programadores y webmasters, la buena utilizacion del foro sera el premio que tendremos para q este elemento sea util para los usuarios.

Colaborar: Si deseais ser moderadores de alguno de los foros estaremos encantados en que nos presteis esa ayuda , tan solo es necesario tener algun conocimiento
del tema que trata el foro y tener ganas ganas de colaborar para ser moderador mandar un mail indicando de que foro deseais ser moderador

Deseais que pongamos algun nuevo foro de programacion? ¿quieres crear un nuevo foro y ser su moderador? ponte en contacto con nosotros

Retroceder   Foros > Programacion > java

Respuesta
 
LinkBack Herramientas Desplegado
  #1 (permalink)  
Antiguo 11 de noviembre,2011, 14:43
Junior Member
Nivel basico por msg
 
Fecha de Ingreso: nov 2011
Mensajes: 1
Predeterminado Como hacer que un dibujo applet se mantenga oculto

hola quisiera que me ayudaran a ver como hacer que el siguiente applet mantenga oculto los dibujos y los muestre una vez quede verificada la sentencia


import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Ingenieria extends Applet implements ActionListener {
int D = 0;
Button btnComprobar = new Button("Comprobar");
Button btnlimpiar = new Button("Limpiar");
Button btnSalir = new Button("Salir");
TextField txtfor = new TextField (3);
TextField txtVar = new TextField (3);
TextField txtSimbolo = new TextField (3);
TextField txtRangInicial = new TextField (3);
TextField txtto = new TextField (3);
TextField txtRangFinal = new TextField (3);
TextField txtdo = new TextField (3);

public void init() {
setSize(1000, 500);
add(txtfor);
add(txtVar);
add(txtSimbolo);
add(txtRangInicial);
add(txtto);
add(txtRangFinal);
add(txtdo);
add(btnComprobar);
add(btnlimpiar);
add(btnSalir);
btnComprobar.addActionListener(this);
btnlimpiar.addActionListener(this);
btnSalir.addActionListener(this);
}

public void paint(Graphics g) {

g.drawLine(50, 137, 100, 137);
g.drawLine(100, 137, 90, 125);
g.drawLine(100, 135, 90, 150);
g.drawOval(100, 100, 75, 75);
g.drawString("q0", 130, 140);
g.drawString("" + D, 198, 130);

g.drawLine(175, 137, 230, 137);
g.drawLine(229, 137, 219, 125);
g.drawLine(229, 137, 219, 150);
g.drawOval(230, 100, 75, 75);
g.drawString("q1", 260, 140);
g.drawString("" + D, 327, 130);

g.drawLine(306, 137, 360, 137);
g.drawLine(360, 137, 350, 125);
g.drawLine(360, 137, 350, 150);
g.drawArc(378, 60, 40, 90, 0, 180);
g.drawLine(429, 83, 419, 105);
g.drawLine(400, 83, 419, 107);
g.drawOval(360, 100, 75, 75);
g.drawString("q2", 390, 140);
g.drawString("" + D, 456, 130);
g.drawString("" + D, 415, 70);

g.drawLine(435, 137, 490, 137);
g.drawLine(489, 137, 481, 125);
g.drawLine(489, 137, 481, 150);
g.drawOval(490, 100, 75, 75);
g.drawString("q3", 520, 140);
g.drawString("" + D, 585, 130);

g.drawLine(565, 137, 620, 137);
g.drawLine(620, 137, 612, 125);
g.drawLine(620, 137, 612, 150);
g.drawArc(638, 60, 40, 90, 0, 180);
g.drawLine(689, 83, 678, 105);
g.drawLine(661, 83, 679, 107);
g.drawOval(620, 100, 75, 75);
g.drawString("q4", 650, 140);
g.drawString("" + D, 718, 130);
g.drawString("" + D, 677, 70);

g.drawLine(695, 137, 750, 137);
g.drawLine(751, 137, 741, 125);
g.drawLine(751, 137, 741, 150);
g.drawArc(769, 61, 40, 90, 0, 180);
g.drawLine(820, 83, 810, 105);
g.drawLine(791, 83, 810, 107);
g.drawOval(750, 100, 75, 75);
g.drawString("q5", 780, 140);
g.drawString("" + D, 847, 130);
g.drawString("" + D, 807, 70);

g.drawLine(825, 137, 880, 137);
g.drawLine(881, 137, 871, 125);
g.drawLine(881, 137, 871, 150);
g.drawOval(880, 100, 75, 75);
g.drawOval(892, 113, 50, 50);
g.drawString("q6", 910, 140);

//Lineas Verticales
g.drawRect(50, 200, 750, 250);
g.drawLine(125, 200, 125, 450);
g.drawLine(200, 225, 200, 450);
g.drawLine(275, 225, 275, 450);
g.drawLine(350, 225, 350, 450);
g.drawLine(425, 225, 425, 450);
g.drawLine(500, 225, 500, 450);
g.drawLine(575, 225, 575, 450);
g.drawLine(650, 225, 650, 450);
g.drawLine(725, 200, 725, 450);

//Lineas Horizontales
g.drawLine(125, 225, 725, 225);
g.drawLine(50, 250, 800, 250);
g.drawLine(50, 275, 800, 275);
g.drawLine(50, 300, 800, 300);
g.drawLine(50, 325, 800, 325);
g.drawLine(50, 350, 800, 350);
g.drawLine(50, 375, 800, 375);
g.drawLine(50, 400, 800, 400);
g.drawLine(50, 425, 800, 425);
}
public void actionPerformed(ActionEvent evento) {
if (evento.getSource()==btnComprobar){
int[] i=new int[7];

try{
String f1=txtfor.getText();
String f3=txtSimbolo.getText();
String f5=txtto.getText();
String f7=txtdo.getText();

if(f1.equals("For")){
JOptionPane.showMessageDialog(null, "Comprobando For ¡¡Correcto!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
txtfor.setEditable(false);
i[0]=1;
}
else{
JOptionPane.showMessageDialog(null, "Comprobando For ¡¡INCORRECTO!!","Comprobando...",JOptionPane.INFOR MATION_MESSAGE);
}

JOptionPane.showMessageDialog(null, "Comprobando i ¡¡Correcto!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
txtVar.setEditable(false);
i[1]=i[0]+1;

if(f3.equals(":=")){
JOptionPane.showMessageDialog(null, "Comprobando := ¡¡Correcto!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
txtSimbolo.setEditable(false);i[2]=i[1]+1;
}
else{
JOptionPane.showMessageDialog(null, "Comprobando := ¡¡INCORRECTO!!","Comprobando...",JOptionPane.INFOR MATION_MESSAGE);
}

JOptionPane.showMessageDialog(null, "Comprobando Rango de Inicio ¡¡Correcto!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
txtRangInicial.setEditable(false);
i[3]=i[2]+1;

if(f5.equals("to")){
JOptionPane.showMessageDialog(null, "Comprobando to ¡¡Correcto!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
txtto.setEditable(false);i[4]=i[3]+1;
}
else{
JOptionPane.showMessageDialog(null, "Comprobando to ¡¡INCORRECTO!!","Comprobando...",JOptionPane.INFOR MATION_MESSAGE);
}

JOptionPane.showMessageDialog(null, "Comprobando Rango Final ¡¡Correcto!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
txtRangFinal.setEditable(false);
i[5]=i[4]+1;

if(f7.equals("do")){
JOptionPane.showMessageDialog(null, "Comprobando do ¡¡Correcto!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
txtdo.setEditable(false);i[6]=i[5]+1;
}
else{
JOptionPane.showMessageDialog(null, "Comprobando do ¡¡INCORRECTO!!","Comprobando...",JOptionPane.INFOR MATION_MESSAGE);
}
if(i[6]=='5'){
JOptionPane.showMessageDialog(null, "¡¡SENTENCIA CORRECTA!!","Comprobando...",JOptionPane.INFORMATI ON_MESSAGE);
}
else{
JOptionPane.showMessageDialog(null, "¡¡SENTENCIA INCORRECTA!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
}
}

catch(NumberFormatException e){
JOptionPane.showMessageDialog(null, "¡¡SENTENCIA INCORRECTA!!","Comprobando...",JOptionPane.INFORMA TION_MESSAGE);
}

}

if (evento.getSource()==btnlimpiar){
btnComprobar.setEnabled(true);
txtfor.setText("");
txtVar.setText("");
txtSimbolo.setText("");
txtRangInicial.setText("");
txtto.setText("");
txtRangFinal.setText("");
txtdo.setText("");
txtfor.setEditable(true);
txtVar.setEditable(true);
txtSimbolo.setEditable(true);
txtRangInicial.setEditable(true);
txtto.setEditable(true);
txtRangFinal.setEditable(true);
txtdo.setEditable(true);
repaint();
}
if (evento.getSource()==btnSalir){
System.exit(1);
}
}
}
Responder Citando
Respuesta

Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Las caritas están Activado
El codigo [IMG] está Activado
Código HTML está Desactivado
Trackbacks are Activado
Pingbacks are Activado
Refbacks are Activado
Ir al Foro

Programacion : LWPI Solorecursos I programacion I abcdatos I TrucosTecnicos I servicios gratisI ofertas de ADSL Ipueblos20
Areas exclusivas:cursosIofertasIadslIwebtutoriales ISMSareaItutorialesItrucos de windows IgooglemaniaI programatium.netIcompras
noticias: SaludIOcio/cineIMusicaIMotorIDeportes IJuegos I FinanzasIMovilesIEnergiaIEcologiaITech-yIMujerIMACISaludIViajes-Pueblos
site programatium.com : site1 - site2 - site3 - site4 - site5 - site6 - site7 - site8
manuales Sugiere un manual para esta seccion
who's online
Linkanos
www.programatium.com© 1999 - web esta optimizada para Microsoft explorer 6.0
tutoriales

Content Relevant URLs by vBSEO 3.2.0