elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


  Mostrar Temas
Páginas: [1]
1  Programación / Java / problema con BufferedReader en: 15 Junio 2007, 20:51 pm
hola:

Tengo un ciclo para leer de buffer y luego imprimir lo que leyo en un TextArea y la manera de detener el ciclo es cuando el buffer sea Null.

en el Text Area deberia aparece escrito la salida de un Script que ejecuto en UNIX como se ve en color rojo.

Ingrese una opcion [1]Prueba   [2]Salir

una vez que aparece esto se debe ingresar la opcion y sigue la ejecucion del script.

pero aparentemente el buffer nunca se hace null y se queda imprimiendo siempre lo mismo en un ciclo infinito y no se le pueden enviar los datos para la seleccion de la opcion [1] o [2]...

alguien tendra alguna sugerencia para que esto no suceda??

este es el codigo del hilo que lee el buffer de entrada.

muchas gracias

prestar atencion en esta parte del codigo

Código:
                                        while ((line = in.readLine()) != null)
                                        {
                                                t.printOut(line);
                                        }


Código:
        class InputThread implements Runnable
        {
                BufferedReader in;
                Main t;
                public boolean keepGoing;
 
                public InputThread(BufferedReader in, Main t)
                {
                        this.in = in;
                        this.t = t;
                        this.keepGoing = true;
                }
 
                public void quitIt()
                {
                        keepGoing = false;
                }
 
                public void run()
                {
                        while (keepGoing)
                        {
                                String line;
                                try
                                {
                                        while ((line = in.readLine()) != null)
                                        {
                                                t.printOut(line);
                                        }
                                }
                                catch (IOException e) 
                                {
                                        t.printOut(e.getMessage());
                                }
                        }
                }
        }
2  Programación / Java / Scroll automatico en un JScrollPane en: 14 Junio 2007, 15:19 pm
hola

tengo un JScrollPane con un JText Area y a medida que voy escribiendo texto quisiera que se hiciera un scroll automatico pues hasta ahora tengo que hacerlo manualmente con el scroll del raton.

existe algun metodo de la clase JScrollPane que haga esto??

muchas gracias
3  Programación / Java / Interfaz grafica y clase process en: 7 Junio 2007, 15:32 pm
hola:

estoy desarrollando esta interfaz grafica....

cuando ejecuto los comandos dir, ipconfig, ping me muestra la salida en el cuadro de texto.

pero con el comando date se tranca el programa pq espera a que le envie una fecha para actualizar...

dejo el codigo completo para el que lo quiera ver y me pueda ayudar... gracias

Código
  1. // Sistema de Gestión MTSO San Cristóbal
  2. // Realizado por: Wilmer Rondón
  3.  
  4. import java.awt.*;
  5. import java.awt.event.*;
  6. import javax.swing.*;
  7. import java.awt.Color;
  8. import javax.swing.JTabbedPane;
  9. import javax.swing.ImageIcon;
  10. import javax.swing.JLabel;
  11. import javax.swing.JPanel;
  12. import javax.swing.JFrame;
  13. import javax.swing.JButton;
  14. import java.io.*;
  15. import java.lang.ProcessBuilder;
  16.  
  17. //********************************************************************************************************************************
  18. // CLASE PRINCIPAL DEL PROGRAMA "VENTANA"
  19. public class Main extends JPanel
  20. {
  21. protected Boolean bd1 = false, bd2 = false, bd3 = false, bd4 = false;
  22.        protected JTextField texto1, texto2, texto3, texto4;
  23. protected JTextArea areaTexto1, areaTexto2, areaTexto3, areaTexto4;
  24. protected JPanel p1A, p1B, p1C, p1D, p2A, p2B, p2C, p2D, p3A, p3B, p3C, p3D, p4A, p4B, p4C, p4D;
  25. protected JButton btOK1, btQuitar1, btSalir1, btOK2, btQuitar2, btSalir2, btOK3, btQuitar3, btSalir3, btOK4, btQuitar4, btSalir4;
  26. protected String texto1Inicio, texto2Inicio, texto3Inicio, texto4Inicio;
  27. protected Color B, F1, F2, F3;
  28. protected int orden;
  29. protected final static String newline = "\n";
  30.  
  31. //********************************************************************************************************************************
  32. // CONSTRUCTOR DE LA CLASE VENTANA
  33. public Main()
  34. {
  35. ImageIcon icon1 = new ImageIcon("images/ic_ringroad.jpg");
  36. ImageIcon icon2 = new ImageIcon("images/ib_celtic.jpg");
  37. ImageIcon icon3 = new ImageIcon("images/ic_patio.jpg");
  38. ImageIcon icon4 = new ImageIcon("images/mante.jpg");
  39.  
  40. JTabbedPane pestanas = new JTabbedPane();
  41.  
  42. Component panel_pestana1 = pestana1("Pestana Uno");
  43. pestanas.addTab("Troncales", icon1, panel_pestana1);
  44. Component panel_pestana2 = pestana2("Pestana Dos");
  45. pestanas.addTab("Packet Pipes", icon2, panel_pestana2);
  46. Component panel_pestana3 = pestana3("Pestana Tres");
  47. pestanas.addTab("Celdas", icon3, panel_pestana3);
  48. Component panel_pestana4 = pestana4("Pestana Cuatro");
  49. pestanas.addTab("Mantenimiento", icon4, panel_pestana4);
  50.  
  51. setLayout(new GridLayout(1, 1));
  52. add(pestanas);
  53. }
  54.  
  55. //********************************************************************************************************************************
  56. // METODO PARA CONSTRUIR LA PESTAÑA "TRONCALES"
  57. protected Component pestana1(String text)
  58. {
  59. p1A = new JPanel(new GridLayout(2,1)); // panel Principal
  60. p1B = new JPanel(new BorderLayout());  //
  61. p1C = new JPanel(new BorderLayout());  //
  62. p1D = new JPanel(new GridLayout(1,3)); // panel para 3 botones en BorderLayout.SOUTH
  63. p1A.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  64.  
  65. JTabbedPane subpestanas1 = new JTabbedPane();
  66. Component panel_subpestana11 = subpestana11("Crear");
  67. subpestanas1.addTab("Crear", panel_subpestana11);
  68. Component panel_subpestana12 = subpestana12("Crecer");
  69. subpestanas1.addTab("Crecer", panel_subpestana12);
  70. Component panel_subpestana13 = subpestana13("Dedrecer");
  71. subpestanas1.addTab("Dedrecer", panel_subpestana13);
  72. Component panel_subpestana14 = subpestana14("Eliminar");
  73. subpestanas1.addTab("Eliminar", panel_subpestana14);
  74. Component panel_subpestana15 = subpestana15("Inclusión en Reporte TGCOM");
  75. subpestanas1.addTab("Inclusión en Reporte TGCOMP", panel_subpestana15);
  76. Component panel_subpestana16 = subpestana16("Mudanza");
  77. subpestanas1.addTab("Mudanza", panel_subpestana16);
  78.  
  79. texto1 = new JTextField(40);
  80. texto1.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  81. texto1Inicio = "Escriba aquí un comando y haga click sobre el botón \"OK\"";
  82. texto1.setText(texto1Inicio);
  83.  
  84. areaTexto1 = new JTextArea(10,40);
  85. areaTexto1.setEditable(false);
  86. areaTexto1.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  87. B = new Color(200,200,200);
  88. areaTexto1.setBackground(B);
  89. F1 = new Color(0,0,0);
  90. areaTexto1.setForeground(F1);
  91. JScrollPane pScroll = new JScrollPane(areaTexto1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  92.  
  93. btOK1 = new JButton("OK");
  94. btQuitar1 = new JButton("Limpiar pantalla");
  95. btSalir1 = new JButton("Salir");
  96.  
  97. texto1.addActionListener(new ejecutar());
  98. btOK1.addActionListener(new ejecutar());
  99.                btOK1.addActionListener(new bdTroncales());
  100. btQuitar1.addActionListener(new limpiarPantalla());
  101. btSalir1.addActionListener(new cerrarVentana());
  102.  
  103. p1A.add(p1B);
  104. p1A.add(p1C);
  105. p1B.add(subpestanas1);//agregar sub pestanas
  106. p1D.add(btOK1);
  107. p1D.add(btQuitar1);
  108. p1D.add(btSalir1);
  109. p1C.add(texto1,BorderLayout.NORTH);
  110. p1C.add(pScroll, BorderLayout.CENTER);
  111. p1C.add(p1D, BorderLayout.SOUTH);
  112.  
  113. btOK1.setToolTipText("Ingresar Comando");
  114. btQuitar1.setToolTipText("Limpiar la Pantalla");
  115. btSalir1.setToolTipText("Salir de la aplicación");
  116.  
  117. return p1A;
  118.  
  119. }
  120.  
  121. //********************************************************************************************************************************
  122. // METODO PARA CONSTRUIR LA PESTAÑA "PACKET PIPES"
  123. protected Component pestana2(String text)
  124. {
  125. p2A = new JPanel(new GridLayout(2,1)); // panel Principal
  126.                p2B = new JPanel(new BorderLayout());  //
  127. p2C = new JPanel(new BorderLayout());  //
  128. p2D = new JPanel(new GridLayout(1,3)); // panel para 3 botones en BorderLayout.SOUTH
  129. p2A.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  130.  
  131. JTabbedPane subpestanas2 = new JTabbedPane();
  132. Component panel_subpestana21 = subpestana21("Mudar");
  133. subpestanas2.addTab("Mudar", panel_subpestana21);
  134. Component panel_subpestana22 = subpestana22("Crecer");
  135. subpestanas2.addTab("Crecer", panel_subpestana22);
  136. Component panel_subpestana23 = subpestana23("Dedrecer");
  137. subpestanas2.addTab("Dedrecer", panel_subpestana23);
  138. Component panel_subpestana24 = subpestana24("Equipar");
  139. subpestanas2.addTab("Equipar", panel_subpestana24);
  140. Component panel_subpestana25 = subpestana25("Desequipar");
  141. subpestanas2.addTab("Desequipar", panel_subpestana25);
  142.  
  143. texto2 = new JTextField(40);
  144. texto2.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  145. texto2Inicio = "Escriba aquí un comando y haga click sobre el botón \"OK\"";
  146. texto2.setText(texto2Inicio);
  147.  
  148. areaTexto2 = new JTextArea(10,40);
  149. areaTexto2.setEditable(false);
  150. areaTexto2.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  151. B = new Color(200,200,200);
  152. areaTexto2.setBackground(B);
  153. F1 = new Color(0,0,0);
  154. areaTexto2.setForeground(F1);
  155. JScrollPane pScroll2 = new JScrollPane(areaTexto2, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  156.  
  157. btOK2 = new JButton("OK");
  158. btQuitar2 = new JButton("Limpiar pantalla");
  159. btSalir2 = new JButton("Salir");
  160.  
  161. texto2.addActionListener(new ejecutar());
  162. btOK2.addActionListener(new ejecutar());
  163. btQuitar2.addActionListener(new limpiarPantalla());
  164. btSalir2.addActionListener(new cerrarVentana());
  165.  
  166. p2A.add(p2B);
  167. p2A.add(p2C);
  168. p2B.add(subpestanas2);//agregar sub pestanas
  169. p2D.add(btOK2);
  170. p2D.add(btQuitar2);
  171. p2D.add(btSalir2);
  172. p2C.add(texto2,BorderLayout.NORTH);
  173. p2C.add(pScroll2, BorderLayout.CENTER);
  174. p2C.add(p2D, BorderLayout.SOUTH);
  175.  
  176. btOK2.setToolTipText("Ingresar Comando");
  177. btQuitar2.setToolTipText("Limpiar la Pantalla");
  178. btSalir2.setToolTipText("Salir de la aplicación");
  179.  
  180. return p2A;
  181. }
  182.  
  183. //********************************************************************************************************************************
  184. // METODO PARA CONSTRUIR LA PESTAÑA "CELDAS"
  185. protected Component pestana3(String text)
  186. {
  187. p3A = new JPanel(new GridLayout(2,1)); // panel Principal
  188.                p3B = new JPanel(new BorderLayout());  //
  189. p3C = new JPanel(new BorderLayout());  //
  190. p3D = new JPanel(new GridLayout(1,3)); // panel para 3 botones en BorderLayout.SOUTH
  191. p3A.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  192.  
  193. JTabbedPane subpestanas3 = new JTabbedPane();
  194. Component panel_subpestana31 = subpestana31("Mudanza de RCS");
  195. subpestanas3.addTab("Mudanza de RCS", panel_subpestana31);
  196. Component panel_subpestana32 = subpestana32("Crear Celda");
  197. subpestanas3.addTab("Crear Celda", panel_subpestana32);
  198. Component panel_subpestana33 = subpestana33("Borrar Celda");
  199. subpestanas3.addTab("Borrar Celda", panel_subpestana33);
  200. Component panel_subpestana34 = subpestana34("---");
  201. subpestanas3.addTab("---", panel_subpestana34);
  202. Component panel_subpestana35 = subpestana35("---");
  203. subpestanas3.addTab("---", panel_subpestana35);
  204.  
  205. texto3 = new JTextField(40);
  206. texto3.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  207. texto3Inicio = "Escriba aquí un comando y haga click sobre el botón \"OK\"";
  208. texto3.setText(texto3Inicio);
  209.  
  210. areaTexto3 = new JTextArea(10,40);
  211. areaTexto3.setEditable(false);
  212. areaTexto3.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  213. B = new Color(200,200,200);
  214. areaTexto3.setBackground(B);
  215. F1 = new Color(0,0,0);
  216. areaTexto3.setForeground(F1);
  217. JScrollPane pScroll3 = new JScrollPane(areaTexto3, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  218.  
  219. btOK3 = new JButton("OK");
  220. btQuitar3 = new JButton("Limpiar pantalla");
  221. btSalir3 = new JButton("Salir");
  222.  
  223. texto3.addActionListener(new ejecutar());
  224. btOK3.addActionListener(new ejecutar());
  225. btQuitar3.addActionListener(new limpiarPantalla());
  226. btSalir3.addActionListener(new cerrarVentana());
  227.  
  228. p3A.add(p3B);
  229. p3A.add(p3C);
  230. p3B.add(subpestanas3);//agregar sub pestanas
  231. p3D.add(btOK3);
  232. p3D.add(btQuitar3);
  233. p3D.add(btSalir3);
  234. p3C.add(texto3,BorderLayout.NORTH);
  235. p3C.add(pScroll3, BorderLayout.CENTER);
  236. p3C.add(p3D, BorderLayout.SOUTH);
  237.  
  238. btOK3.setToolTipText("Ingresar Comando");
  239. btQuitar3.setToolTipText("Limpiar la Pantalla");
  240. btSalir3.setToolTipText("Salir de la aplicación");
  241.  
  242. return p3A;
  243. }
  244.  
  245. //********************************************************************************************************************************
  246. // METODO PARA CONSTRUIR LA PESTAÑA "MANTENIMIENTO"
  247. protected Component pestana4(String text)
  248. {
  249. p4A = new JPanel(new GridLayout(2,1)); // panel Principal
  250.                p4B = new JPanel(new BorderLayout());  //
  251. p4C = new JPanel(new BorderLayout());  //
  252. p4D = new JPanel(new GridLayout(1,3)); // panel para 3 botones en BorderLayout.SOUTH
  253. p4A.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  254.  
  255. JTabbedPane subpestanas4 = new JTabbedPane();
  256. Component panel_subpestana41 = subpestana41("CKT OOS");
  257. subpestanas4.addTab("CKT OOS", panel_subpestana41);
  258. Component panel_subpestana42 = subpestana42("TST UPATH");
  259. subpestanas4.addTab("TST UPATH", panel_subpestana42);
  260. Component panel_subpestana43 = subpestana43("MEM  NRODD/RODD  SM's");
  261. subpestanas4.addTab("MEM  NRODD/RODD  SM's", panel_subpestana43);
  262. Component panel_subpestana44 = subpestana44("Información del Sistema");
  263. subpestanas4.addTab("Información del Sistema", panel_subpestana44);
  264. Component panel_subpestana45 = subpestana45("BACKUP's DE AP's");
  265. subpestanas4.addTab("BACKUP's DE AP's", panel_subpestana45);
  266. Component panel_subpestana46 = subpestana46("CHKLIST MTSO");
  267. subpestanas4.addTab("CHKLIST MTSO", panel_subpestana46);
  268.  
  269. texto4 = new JTextField(40);
  270. texto4.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  271. texto4Inicio = "Escriba aquí un comando y haga click sobre el botón \"OK\"";
  272. texto4.setText(texto4Inicio);
  273.  
  274. areaTexto4 = new JTextArea(10,40);
  275. areaTexto4.setEditable(false);
  276. areaTexto4.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  277. B = new Color(200,200,200);
  278. areaTexto4.setBackground(B);
  279. F1 = new Color(0,0,0);
  280. areaTexto4.setForeground(F1);
  281. JScrollPane pScroll4 = new JScrollPane(areaTexto4, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  282.  
  283. btOK4 = new JButton("OK");
  284. btQuitar4 = new JButton("Limpiar pantalla");
  285. btSalir4 = new JButton("Salir");
  286.  
  287. texto4.addActionListener(new ejecutar());
  288. btOK4.addActionListener(new ejecutar());
  289. btQuitar4.addActionListener(new limpiarPantalla());
  290. btSalir4.addActionListener(new cerrarVentana());
  291.  
  292. p4A.add(p4B);
  293. p4A.add(p4C);
  294. p4B.add(subpestanas4);//agregar sub pestanas
  295. p4D.add(btOK4);
  296. p4D.add(btQuitar4);
  297. p4D.add(btSalir4);
  298. p4C.add(texto4,BorderLayout.NORTH);
  299. p4C.add(pScroll4, BorderLayout.CENTER);
  300. p4C.add(p4D, BorderLayout.SOUTH);
  301.  
  302. btOK4.setToolTipText("Ingresar Comando");
  303. btQuitar4.setToolTipText("Limpiar la Pantalla");
  304. btSalir4.setToolTipText("Salir de la aplicación");
  305.  
  306. return p4A;
  307. }
  308.  
  309. //********************************************************************************************************************************
  310. // METODO PARA CONSTRUIR LA SUBPESTAÑA "CREAR" DE "TRONCALES"
  311. protected Component subpestana11(String text)
  312. {
  313. JPanel panel = new JPanel(false);
  314. JLabel filler = new JLabel(text);
  315. filler.setHorizontalAlignment(JLabel.CENTER);
  316. panel.setLayout(new GridLayout(1, 1));
  317. panel.add(filler);
  318. return panel;
  319. }
  320. //********************************************************************************************************************************
  321. // METODO PARA CONSTRUIR LA SUBPESTAÑA "CRECER" DE "TRONCALES"
  322. protected Component subpestana12(String text)
  323. {
  324. JPanel panel = new JPanel(false);
  325. JLabel filler = new JLabel(text);
  326. filler.setHorizontalAlignment(JLabel.CENTER);
  327. panel.setLayout(new GridLayout(1, 1));
  328. panel.add(filler);
  329. return panel;
  330. }
  331. //********************************************************************************************************************************
  332. // METODO PARA CONSTRUIR LA SUBPESTAÑA "DECRECER" DE "TRONCALES"
  333. protected Component subpestana13(String text)
  334. {
  335. JPanel panel = new JPanel(false);
  336. JLabel filler = new JLabel(text);
  337. filler.setHorizontalAlignment(JLabel.CENTER);
  338. panel.setLayout(new GridLayout(1, 1));
  339. panel.add(filler);
  340. return panel;
  341. }
  342. //********************************************************************************************************************************
  343. // METODO PARA CONSTRUIR LA SUBPESTAÑA "ELIMINAR" DE "TRONCALES"
  344. protected Component subpestana14(String text)
  345. {
  346. JPanel panel = new JPanel(false);
  347. JLabel filler = new JLabel(text);
  348. filler.setHorizontalAlignment(JLabel.CENTER);
  349. panel.setLayout(new GridLayout(1, 1));
  350. panel.add(filler);
  351. return panel;
  352. }
  353. //********************************************************************************************************************************
  354. // METODO PARA CONSTRUIR LA SUBPESTAÑA "INCLUSION EN REPORTE TGCOMP" DE "TRONCALES"
  355. protected Component subpestana15(String text)
  356. {
  357. JPanel panel = new JPanel(false);
  358. JLabel filler = new JLabel(text);
  359. filler.setHorizontalAlignment(JLabel.CENTER);
  360. panel.setLayout(new GridLayout(1, 1));
  361. panel.add(filler);
  362. return panel;
  363. }
  364.  
  365. //********************************************************************************************************************************
  366. // METODO PARA CONSTRUIR LA SUBPESTAÑA "MUDANZA" DE "TRONCALES"
  367. protected Component subpestana16(String text)
  368. {
  369. JPanel panel = new JPanel(false);
  370. JLabel filler = new JLabel(text);
  371. filler.setHorizontalAlignment(JLabel.CENTER);
  372. panel.setLayout(new GridLayout(1, 1));
  373. panel.add(filler);
  374. return panel;
  375. }
  376.  
  377. //********************************************************************************************************************************
  378. // METODO PARA CONSTRUIR LA SUBPESTAÑA "MUDAR" DE "PACKET PIPES"
  379. protected Component subpestana21(String text)
  380. {
  381. JPanel panel = new JPanel(false);
  382. JLabel filler = new JLabel(text);
  383. filler.setHorizontalAlignment(JLabel.CENTER);
  384. panel.setLayout(new GridLayout(1, 1));
  385. panel.add(filler);
  386. return panel;
  387. }
  388. //********************************************************************************************************************************
  389. // METODO PARA CONSTRUIR LA SUBPESTAÑA "CRECER" DE "PACKET PIPES"
  390. protected Component subpestana22(String text)
  391. {
  392. JPanel panel = new JPanel(false);
  393. JLabel filler = new JLabel(text);
  394. filler.setHorizontalAlignment(JLabel.CENTER);
  395. panel.setLayout(new GridLayout(1, 1));
  396. panel.add(filler);
  397. return panel;
  398. }
  399. //********************************************************************************************************************************
  400. // METODO PARA CONSTRUIR LA SUBPESTAÑA "DECRECER" DE "PACKET PIPES"
  401. protected Component subpestana23(String text)
  402. {
  403. JPanel panel = new JPanel(false);
  404. JLabel filler = new JLabel(text);
  405. filler.setHorizontalAlignment(JLabel.CENTER);
  406. panel.setLayout(new GridLayout(1, 1));
  407. panel.add(filler);
  408. return panel;
  409. }
  410. //********************************************************************************************************************************
  411. // METODO PARA CONSTRUIR LA SUBPESTAÑA "EQUIPAR" DE "PACKET PIPES"
  412. protected Component subpestana24(String text)
  413. {
  414. JPanel panel = new JPanel(false);
  415. JLabel filler = new JLabel(text);
  416. filler.setHorizontalAlignment(JLabel.CENTER);
  417. panel.setLayout(new GridLayout(1, 1));
  418. panel.add(filler);
  419. return panel;
  420. }
  421.  
  422. //********************************************************************************************************************************
  423. // METODO PARA CONSTRUIR LA SUBPESTAÑA "DESEQUIPAR" DE "PACKET PIPES"
  424. protected Component subpestana25(String text)
  425. {
  426. JPanel panel = new JPanel(false);
  427. JLabel filler = new JLabel(text);
  428. filler.setHorizontalAlignment(JLabel.CENTER);
  429. panel.setLayout(new GridLayout(1, 1));
  430. panel.add(filler);
  431. return panel;
  432. }
  433.  
  434. //********************************************************************************************************************************
  435. // METODO PARA CONSTRUIR LA SUBPESTAÑA "MUDANZA DE RCS" DE "CELDAS"
  436. protected Component subpestana31(String text)
  437. {
  438. JPanel panel = new JPanel(false);
  439. JLabel filler = new JLabel(text);
  440. filler.setHorizontalAlignment(JLabel.CENTER);
  441. panel.setLayout(new GridLayout(1, 1));
  442. panel.add(filler);
  443. return panel;
  444. }
  445. //********************************************************************************************************************************
  446. // METODO PARA CONSTRUIR LA SUBPESTAÑA "CREAR" DE "CELDAS"
  447. protected Component subpestana32(String text)
  448. {
  449. JPanel panel = new JPanel(false);
  450. JLabel filler = new JLabel(text);
  451. filler.setHorizontalAlignment(JLabel.CENTER);
  452. panel.setLayout(new GridLayout(1, 1));
  453. panel.add(filler);
  454. return panel;
  455. }
  456. //********************************************************************************************************************************
  457. // METODO PARA CONSTRUIR LA SUBPESTAÑA "BORRAR" DE "CELDAS"
  458. protected Component subpestana33(String text)
  459. {
  460. JPanel panel = new JPanel(false);
  461. JLabel filler = new JLabel(text);
  462. filler.setHorizontalAlignment(JLabel.CENTER);
  463. panel.setLayout(new GridLayout(1, 1));
  464. panel.add(filler);
  465. return panel;
  466. }
  467. //********************************************************************************************************************************
  468. // METODO PARA CONSTRUIR LA SUBPESTAÑA "---" DE "CELDAS"
  469. protected Component subpestana34(String text)
  470. {
  471. JPanel panel = new JPanel(false);
  472. JLabel filler = new JLabel(text);
  473. filler.setHorizontalAlignment(JLabel.CENTER);
  474. panel.setLayout(new GridLayout(1, 1));
  475. panel.add(filler);
  476. return panel;
  477. }
  478.  
  479. //********************************************************************************************************************************
  480. // METODO PARA CONSTRUIR LA SUBPESTAÑA "---" DE "CELDAS"
  481. protected Component subpestana35(String text)
  482. {
  483. JPanel panel = new JPanel(false);
  484. JLabel filler = new JLabel(text);
  485. filler.setHorizontalAlignment(JLabel.CENTER);
  486. panel.setLayout(new GridLayout(1, 1));
  487. panel.add(filler);
  488. return panel;
  489. }
  490.  
  491. //********************************************************************************************************************************
  492. // METODO PARA CONSTRUIR LA SUBPESTAÑA "CKT OOS" DE "MANTENIMIENTO"
  493. protected Component subpestana41(String text)
  494. {
  495. JPanel panel = new JPanel(false);
  496. JLabel filler = new JLabel(text);
  497. filler.setHorizontalAlignment(JLabel.CENTER);
  498. panel.setLayout(new GridLayout(1, 1));
  499. panel.add(filler);
  500. return panel;
  501. }
  502. //********************************************************************************************************************************
  503. // METODO PARA CONSTRUIR LA SUBPESTAÑA "TST UPATH" DE "MANTENIMIENTO"
  504. protected Component subpestana42(String text)
  505. {
  506. JPanel panel = new JPanel(false);
  507. JLabel filler = new JLabel(text);
  508. filler.setHorizontalAlignment(JLabel.CENTER);
  509. panel.setLayout(new GridLayout(1, 1));
  510. panel.add(filler);
  511. return panel;
  512. }
  513. //********************************************************************************************************************************
  514. // METODO PARA CONSTRUIR LA SUBPESTAÑA "MEM NRODD/RODD SM's" DE "MANTENIMIENTO"
  515. protected Component subpestana43(String text)
  516. {
  517. JPanel panel = new JPanel(false);
  518. JLabel filler = new JLabel(text);
  519. filler.setHorizontalAlignment(JLabel.CENTER);
  520. panel.setLayout(new GridLayout(1, 1));
  521. panel.add(filler);
  522. return panel;
  523. }
  524. //********************************************************************************************************************************
  525. // METODO PARA CONSTRUIR LA SUBPESTAÑA "INFORMACION DEL SISTEMA" DE "MANTENIMIENTO"
  526. protected Component subpestana44(String text)
  527. {
  528. JPanel panel = new JPanel(false);
  529. JLabel filler = new JLabel(text);
  530. filler.setHorizontalAlignment(JLabel.CENTER);
  531. panel.setLayout(new GridLayout(1, 1));
  532. panel.add(filler);
  533. return panel;
  534. }
  535.  
  536. //********************************************************************************************************************************
  537. // METODO PARA CONSTRUIR LA SUBPESTAÑA "BACKUP's DE AP's" DE "MANTENIMIENTO"
  538. protected Component subpestana45(String text)
  539. {
  540. JPanel panel = new JPanel(false);
  541. JLabel filler = new JLabel(text);
  542. filler.setHorizontalAlignment(JLabel.CENTER);
  543. panel.setLayout(new GridLayout(1, 1));
  544. panel.add(filler);
  545. return panel;
  546. }
  547.  
  548. //********************************************************************************************************************************
  549. // METODO PARA CONSTRUIR LA SUBPESTAÑA "CHKLIST MTSO" DE "MANTENIMIENTO"
  550. protected Component subpestana46(String text)
  551. {
  552. JPanel panel = new JPanel(false);
  553. JLabel filler = new JLabel(text);
  554. filler.setHorizontalAlignment(JLabel.CENTER);
  555. panel.setLayout(new GridLayout(1, 1));
  556. panel.add(filler);
  557. return panel;
  558. }
  559.  
  560. //********************************************************************************************************************************
  561. // MÉTODO DE ENTRADA AL PROGRAMA
  562. public static void main(String[] args)
  563. {
  564. JFrame.setDefaultLookAndFeelDecorated(true);
  565. JFrame frame = new JFrame("Sistema de Gestión MTSO San Cristóbal");
  566. frame.getContentPane().add(new Main(), BorderLayout.CENTER);
  567. frame.setSize(1280, 770);
  568. frame.setVisible(true);
  569. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  570. }
  571.  
  572. //********************************************************************************************************************************
  573. // CLASE PARA MOSTRAR LAS SALIDAS DE LOS COMANDOS EN PANTALLA
  574. class ejecutar implements ActionListener
  575. {
  576. public void actionPerformed(ActionEvent evt)
  577. {
  578. String texto = texto1.getText();
  579.                        Runtime rt = Runtime.getRuntime();
  580. //String[] texto = {"date"};
  581. try
  582. {
  583. // Se lanza el ejecutable.
  584.                                Process p = rt.exec("cmd /c " + texto);            
  585. // Se obtiene el stream de salida del programa
  586. InputStream is = p.getInputStream();
  587. InputStream er = p.getErrorStream();
  588.                                OutputStream sal = p.getOutputStream();
  589.  
  590. // Se prepara un bufferedReader para poder leer la salida más
  591. // comodamente.
  592.                                BufferedWriter br3 = new BufferedWriter (new OutputStreamWriter (sal));
  593.  
  594. // Se lee la primera linea                                
  595. String aux = br.readLine();
  596. String aux2 = br2.readLine();
  597.                                br3.write("07-06-2007\n");
  598. //                              p.waitFor();
  599.  
  600.  
  601. // Mientras se haya leido alguna linea
  602. while (aux!=null)
  603. {
  604. // Se escribe la linea en pantalla
  605. areaTexto1.append(aux + newline);
  606. areaTexto1.setCaretPosition(areaTexto1.getDocument().getLength());
  607. texto1.setText("");
  608.  
  609. // y se lee la siguiente.
  610. aux = br.readLine();
  611. }
  612. while (aux2!=null)
  613. {
  614. areaTexto1.append(aux2 + newline);
  615. areaTexto1.setCaretPosition(areaTexto1.getDocument().getLength());
  616. texto1.setText("");
  617. aux2 = br2.readLine();
  618. }
  619. }
  620. catch (Exception e)
  621. {
  622. // Excepciones si hay algún problema al arrancar el ejecutable o al
  623. // leer su salida.
  624. e.printStackTrace();
  625. }
  626. }
  627. }
  628.  
  629. //********************************************************************************************************************************
  630. // CLASE QUE ACTIVA LA BANDERA DE ESCRITURA EN TEXT AREA
  631. class bdTroncales implements ActionListener
  632. {
  633. public void actionPerformed(ActionEvent evt)
  634. {
  635. bd1 = true;
  636. }
  637. }
  638.  
  639. //********************************************************************************************************************************
  640. // CLASE QUE VACÍA TEXTAREA
  641. class limpiarPantalla implements ActionListener
  642. {
  643. public void actionPerformed(ActionEvent evt)
  644. {
  645. texto1.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
  646. F3 = new Color(0,0,0);
  647. texto1.setForeground(F3);
  648. texto1.setText("");
  649. texto2.setText("");
  650. }
  651. }
  652.  
  653. //********************************************************************************************************************************
  654. // CLASE QUE SALE DEL PROGRAMA
  655. class cerrarVentana implements ActionListener
  656. {
  657. public void actionPerformed(ActionEvent evt)
  658. {
  659. System.exit(0);
  660. }
  661. }
  662.  
  663. //********************************************************************************************************************************
  664.  
  665.  
  666. } //FIN DE LA CLASE VENTANA
4  Programación / Java / como usar Process.getOutputStream() en: 6 Junio 2007, 22:57 pm
hola:

alguien me puede decir como usar Process.getOutputStream() para responder a comando ejecutado desde CMD de windows como por ejemplo el comando DATE que despues de ejecutado muestra la fecha actual y espera a que se ingrese la fecha nueva.

este es parte del codigo que llevo hecho... puedo leer mas no escribir

Código:
class ejecutar implements ActionListener
{
public void actionPerformed(ActionEvent evt)
{
String texto = texto1.getText();
                        Runtime rt = Runtime.getRuntime();
//String[] texto = {"date"};
try
{
// Se lanza el ejecutable.
                                Process p = rt.exec("cmd /c " + texto);
p.waitFor();           
// Se obtiene el stream de salida del programa
InputStream is = p.getInputStream();
InputStream er = p.getErrorStream();
                                OutputStream sal = p.getOutputStream();
//                              int wait = p.waitFor();
           
// Se prepara un bufferedReader para poder leer la salida más
// comodamente.
BufferedReader br = new BufferedReader (new InputStreamReader (is));
BufferedReader br2 = new BufferedReader (new InputStreamReader (er));
           
// Se lee la primera linea
String aux = br.readLine();
String aux2 = br2.readLine();                 
                               
// Mientras se haya leido alguna linea
while (aux!=null)
{
// Se escribe la linea en pantalla
areaTexto1.append(aux + newline);
areaTexto1.setCaretPosition(areaTexto1.getDocument().getLength());
texto1.setText("");
               
// y se lee la siguiente.
aux = br.readLine();
}
while (aux2!=null)
{
areaTexto1.append(aux2 + newline);
areaTexto1.setCaretPosition(areaTexto1.getDocument().getLength());
texto1.setText("");
aux2 = br2.readLine();
}
}
catch (Exception e)
{
// Excepciones si hay algún problema al arrancar el ejecutable o al
// leer su salida.
e.printStackTrace();
}
}
}
5  Programación / Java / interfaz grafica de unix en java en: 30 Mayo 2007, 16:22 pm
hola:

quiero hacer una interfaz grafica para un scritp shell de unix.

consta de un textfield donde escribo un comando o un script y un textarea donde se muestra la salida de dicho comando o script

he hecho pruebas en windows y en unix

la aplicion funciona bien en windows cuando ejecuto comandos como "dir", "cd",
"vol", es decir me muestra perfectamente la salida de dichos comandos.

en Unix tambien funciona cuando ejecuto comandos como "ls", "pwd" entre otros.

el problema que tengo es que cuando ejecuto un comando que necesite de un posterior ingreso de datos la aplicacion se tranca.

por ejemplo:

cuando ingreso el comando "date" en windows me muestra la fecha actual y me pide ingresar una nueva fecha para actualizarla. es aqui cuando se tranca el programa y tengo que cerrarlo forzosamente

igual me pasa para un script en unix que requiere ingreso de datos posterior a su ejecucion

entiendo que runtime.exec() ejecuta un comando en la ruta especifica pero despues termina el proceso.

como hago para poder ingresar datos e interactuar con la shell una vez que la inicializo???

espero haber sido lo mas claro posible...

muchas gracias por la ayuda...


este es el codigo de mi aplicacion


Código:
// Sistema de Gestión MTSO San Cristóbal
// Realizado por: Wilmer Rondón

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.Color;
import javax.swing.JTabbedPane;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.io.*;

// CLASE PRINCIPAL DEL PROGRAMA
public class Ventana extends JPanel
{
protected JTextField texto1;
protected JTextArea texto2;
protected JPanel p1, p2;
protected JButton btOK, btQuitar, btSalir;
protected String texto1Inicio;
protected Color B, F1, F2, F3;
protected int orden;
protected final static String newline = "\n";

public Ventana()
{
ImageIcon icon1 = new ImageIcon("images/BotonInicioOff.gif");
ImageIcon icon2 = new ImageIcon("images/BotonSalirOff.gif");

JTabbedPane pestanas = new JTabbedPane();
Component panel_pestana1 = pestana1("Pestana Uno");
pestanas.addTab("Comandos", icon1, panel_pestana1);

Component panel_pestana2 = pestana2("Pestana Dos");
pestanas.addTab("Etiqueta", icon2, panel_pestana2);

setLayout(new GridLayout(1, 1));
add(pestanas);

}//Fin Constructor Ventana

protected Component pestana1(String text)
{
p1 = new JPanel(new BorderLayout()); // panel Principal
p2 = new JPanel(new GridLayout(1,3)); // panel para 3 botones en BorderLayout.SOUTH
p1.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));

texto1 = new JTextField(40);
texto1.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
texto1Inicio = "Escriba aquí un comando y haga click sobre el botón \"OK\"";
texto1.setText(texto1Inicio);

texto2 = new JTextArea(10,40);
texto2.setEditable(false);
texto2.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
B = new Color(200,200,200);
texto2.setBackground(B);
F1 = new Color(0,0,0);
texto2.setForeground(F1);
JScrollPane pScroll = new JScrollPane(texto2, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

btOK = new JButton("OK");
btQuitar = new JButton("Limpiar pantalla");
btSalir = new JButton("Salir");

texto1.addActionListener(new ponerTexto());
btOK.addActionListener(new ponerTexto());
btQuitar.addActionListener(new limpiarPantalla());
btSalir.addActionListener(new cerrarVentana());

p1.add(texto1, BorderLayout.NORTH);
p1.add(pScroll, BorderLayout.CENTER);
p1.add(p2,BorderLayout.SOUTH);
p2.add(btOK);
p2.add(btQuitar);
p2.add(btSalir);

btOK.setToolTipText("Ingresar Comando");
btQuitar.setToolTipText("Limpiar la Pantalla");
btSalir.setToolTipText("Salir de la aplicación");

return p1;

}//Fin método pestana1

protected Component pestana2(String text)
{
JPanel panel = new JPanel(false);
JLabel filler = new JLabel(text);
JButton boton = new JButton(text);
filler.setHorizontalAlignment(JLabel.CENTER);
panel.setLayout(new GridLayout(2, 2));
panel.add(boton);
panel.add(filler);
return panel;
}

// MÉTODO DE ENTRADA AL PROGRAMA
public static void main(String[] args)
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Sistema de Gestión MTSO San Cristóbal");
frame.getContentPane().add(new Ventana(), BorderLayout.CENTER);
frame.setSize(1280, 770);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

// CLASE QUE AnADE LÍNEAS DESDE JTEXTFIELD A TEXTAREA
class ponerTexto implements ActionListener
{
public void actionPerformed(ActionEvent evt)
{
String texto = texto1.getText();
//String[] texto = {"date"};
try
{
// Se lanza el ejecutable.
Process p = Runtime.getRuntime().exec("cmd /c " + texto);
//p.waitFor();
           
// Se obtiene el stream de salida del programa
InputStream is = p.getInputStream();
InputStream er = p.getErrorStream();
           
// Se prepara un bufferedReader para poder leer la salida más
// comodamente.
BufferedReader br = new BufferedReader (new InputStreamReader (is));
BufferedReader br2 = new BufferedReader (new InputStreamReader (er));
           
// Se lee la primera linea
String aux = br.readLine();
String aux2 = br2.readLine();

// Mientras se haya leido alguna linea
while (aux!=null)
{
// Se escribe la linea en pantalla
texto2.append(aux + newline);
texto2.setCaretPosition(texto2.getDocument().getLength());
texto1.setText("");
               
// y se lee la siguiente.
aux = br.readLine();
}
while (aux2!=null)
{
texto2.append(aux2 + newline);
texto2.setCaretPosition(texto2.getDocument().getLength());
texto1.setText("");
aux2 = br2.readLine();
}
}
catch (Exception e)
{
// Excepciones si hay algún problema al arrancar el ejecutable o al
// leer su salida.
e.printStackTrace();
}
}
}

// CLASE QUE VACÍA TEXTAREA
class limpiarPantalla implements ActionListener
{
public void actionPerformed(ActionEvent evt)
{
texto1.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
F3 = new Color(0,0,0);
texto1.setForeground(F3);
texto1.setText(texto1Inicio);
texto2.setText("");
texto2.append("#");
}
}

// CLASE QUE SALE DEL PROGRAMA
class cerrarVentana implements ActionListener
{
public void actionPerformed(ActionEvent evt)
{
System.exit(0);
}
}

}//Fin class Ventana
6  Programación / Java / Interfaz grafica en java para un script shell de unix en: 28 Mayo 2007, 22:27 pm
hola:

estoy desarrollando una aplicacion en Java y realmente no tengo mucha experiencia con este lenguaje.

tengo varios scripts en unix que automatizan tareas rutinarias.

deseo hacer una interfaz grafica con java para ejecutarla en xwindows que me permita ejecutar los scripts de unix haciendo click en un boton y poder visualizar en un cuadro de texto de la misma interfaz grafica las repuestas que se generen en la shell.

no se si queda claro el objetivo de mi interfaz grafica

espero que me puedan ayudar

aqui les dejo el codigo de unas pruebas que he ido haciendo para probar no se si voy por buen camino

// Sistema de Gestión MTSO San Cristóbal
// Realizado por: Wilmer Rondón

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.Color;
import javax.swing.JTabbedPane;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.io.*;

// CLASE PRINCIPAL DEL PROGRAMA
public class Ventana extends JPanel
{
   protected JTextField texto1;
   protected JTextArea texto2;
   protected JPanel p1, p2;
   protected JButton btOK, btQuitar, btSalir;
   protected String texto1Inicio;
   protected Color B, F1, F2, F3;
   protected int orden;
   protected final static String newline = "\n";

   public Ventana()
   {
   ImageIcon icon1 = new ImageIcon("images/BotonInicioOff.gif");
   ImageIcon icon2 = new ImageIcon("images/BotonSalirOff.gif");

   JTabbedPane pestanas = new JTabbedPane();
   Component panel_pestana1 = pestana1("Pestana Uno"); //Linea 35
   pestanas.addTab("Comandos", icon1, panel_pestana1);
   
   Component panel_pestana2 = pestana2("Pestana Dos");
   pestanas.addTab("Etiqueta", icon2, panel_pestana2);
   
   setLayout(new GridLayout(1, 1));
   add(pestanas);
   
   }//Fin Constructor Ventana

   protected Component pestana1(String text)
   {
      p1 = new JPanel(new BorderLayout()); // panel Principal
      p2 = new JPanel(new GridLayout(1,3)); // panel para 3 botones en BorderLayout.SOUTH
      p1.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));

      texto1 = new JTextField(40);
      texto1.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
      texto1Inicio = "Escriba aquí un comando y haga click sobre el botón \"OK\"";
      texto1.setText(texto1Inicio);
      
      texto2 = new JTextArea(10,40);
      texto2.setEditable(false);
      texto2.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
      B = new Color(200,200,200);
      texto2.setBackground(B);
      F1 = new Color(0,0,0);
      texto2.setForeground(F1);
      texto2.append("#");
      JScrollPane pScroll = new JScrollPane(texto2, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

      btOK = new JButton("OK");
      btQuitar = new JButton("Limpiar pantalla");
      btSalir = new JButton("Salir");
      
      texto1.addActionListener(new ponerTexto());
      btOK.addActionListener(new ponerTexto());
      btQuitar.addActionListener(new limpiarPantalla());
      btSalir.addActionListener(new cerrarVentana());
      
      p1.add(texto1, BorderLayout.NORTH);
      p1.add(pScroll, BorderLayout.CENTER);
      p1.add(p2,BorderLayout.SOUTH);
      p2.add(btOK);
      p2.add(btQuitar);
      p2.add(btSalir);
      
      btOK.setToolTipText("Ingresar Comando"); //Linea 78
      btQuitar.setToolTipText("Limpiar la Pantalla");
      btSalir.setToolTipText("Salir de la aplicación");
      
      return p1;
      
   }//Fin método pestana1

   protected Component pestana2(String text)
   {
      JPanel panel = new JPanel(false);
      JLabel filler = new JLabel(text);
      JButton boton = new JButton(text);   
      filler.setHorizontalAlignment(JLabel.CENTER);
      panel.setLayout(new GridLayout(2, 2));
      panel.add(boton);
      panel.add(filler);
      return panel;
   }

   // MÉTODO DE ENTRADA AL PROGRAMA
   public static void main(String[] args)
   {
      JFrame.setDefaultLookAndFeelDecorated(true);
      JFrame frame = new JFrame("Sistema de Gestión MTSO San Cristóbal");
      frame.getContentPane().add(new Ventana(), BorderLayout.CENTER);
      frame.setSize(1280, 770);
      frame.setVisible(true);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }

   // CLASE QUE AnADE LÍNEAS DESDE JTEXTFIELD A TEXTAREA
   class ponerTexto implements ActionListener
   {
      public void actionPerformed(ActionEvent evt)
      {
         String texto = texto1.getText();
         try
         {
            // Se lanza el ejecutable.
            Process p = Runtime.getRuntime().exec("cmd /c " + texto);
           
            // Se obtiene el stream de salida del programa
            InputStream is = p.getInputStream();
           
            // Se prepara un bufferedReader para poder leer la salida más
            // comodamente.
            BufferedReader br = new BufferedReader (new InputStreamReader (is));
           
            // Se lee la primera linea
            String aux = br.readLine();
           
            // Mientras se haya leido alguna linea
            while (aux!=null)
            {
               // Se escribe la linea en pantalla
               texto2.append(aux + newline);
               texto2.setCaretPosition(texto2.getDocument().getLength());
               texto1.setText("");
               
               // y se lee la siguiente.
               aux = br.readLine();
            }
         }
         catch (Exception e)
         {
            // Excepciones si hay algún problema al arrancar el ejecutable o al
            // leer su salida.
            e.printStackTrace();
         }
      }
   }

   // CLASE QUE VACÍA TEXTAREA
   class limpiarPantalla implements ActionListener
   {
      public void actionPerformed(ActionEvent evt)
      {
         texto1.setFont(new java.awt.Font("Arial", Font.PLAIN, 12));
         F3 = new Color(0,0,0);
         texto1.setForeground(F3);
         texto1.setText(texto1Inicio);
         texto2.setText("");
         texto2.append("#");
      }
   }
   
   // CLASE QUE SALE DEL PROGRAMA
   class cerrarVentana implements ActionListener
   {
      public void actionPerformed(ActionEvent evt)
      {
         System.exit(0);
      }
   }
   
}//Fin class Ventana
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines