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

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  Java
| | | |-+  Interfaz grafica y clase process
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Interfaz grafica y clase process  (Leído 3,121 veces)
wilmer.rondon

Desconectado Desconectado

Mensajes: 16


Ver Perfil
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


« Última modificación: 30 Junio 2007, 18:55 pm por ||MadAntrax|| » En línea

»~^~«CkNU!»~^~«

Desconectado Desconectado

Mensajes: 79



Ver Perfil
Re: Interfaz grafica y clase process
« Respuesta #1 en: 7 Junio 2007, 16:44 pm »

Caramba, mira lo que me devuelve la ayuda del comando... ;)
Citar
C:\>date /?
Muestra o establece la fecha.

DATE  [/T | fecha]

Escriba DATE sin parámetros para mostrar la fecha actual y poder
especificar una nueva. Presione Entrar para mantener la misma fecha.

Si están habilitadas las extensiones de comandos, el comando DATE admite
el parámetro /T, que indica al comando generar tan sólo la fecha actual
sin pedir una nueva fecha.

PD: No era necesario que copiaras todo el código. Claramente no era un problema de programa, o en todo caso sólo copiás la subrutina en donde se hace la llamada.


« Última modificación: 7 Junio 2007, 16:46 pm por »~^~«CkNU!»~^~« » En línea

»~^~«ChiCkENURiNE»~^~«
Casidiablo
Desarrollador
Colaborador
***
Desconectado Desconectado

Mensajes: 2.919



Ver Perfil WWW
Re: Interfaz grafica y clase process
« Respuesta #2 en: 7 Junio 2007, 20:49 pm »

Hola... no quiero pasar como "mala gente" ni nada de eso, pero no me parece que abras un nuevo hilo cada vez que entras al foro, teniendo en cuenta que todos se refieren al mismo programa/problema. Ya llevas cuatro:

https://foro.elhacker.net/index.php/topic,167282.0.html
https://foro.elhacker.net/index.php/topic,167218.0.html
https://foro.elhacker.net/index.php/topic,166365.0.html
https://foro.elhacker.net/index.php/topic,166200.0.html

Saludos!!!
En línea

wilmer.rondon

Desconectado Desconectado

Mensajes: 16


Ver Perfil
Re: Interfaz grafica y clase process
« Respuesta #3 en: 7 Junio 2007, 21:10 pm »

tienes razon, por mal uso del foro abri mas hilos de la cuenta, no se si puedan borrarse... procurare no hacerlo en el futuro... la verdad todavia no he podido resolver el problema... gracias por tu ayuda...
En línea

Casidiablo
Desarrollador
Colaborador
***
Desconectado Desconectado

Mensajes: 2.919



Ver Perfil WWW
Re: Interfaz grafica y clase process
« Respuesta #4 en: 7 Junio 2007, 21:25 pm »

Gracias a ti por tener sentido común. Con respecto a lo de tu problema, veo que te han sugerido varias cosas, mas en el momento no tengo donde probar... más tarde me lo pillo que también me interesa.

Saludos!!!
En línea

»~^~«CkNU!»~^~«

Desconectado Desconectado

Mensajes: 79



Ver Perfil
Re: Interfaz grafica y clase process
« Respuesta #5 en: 13 Junio 2007, 05:27 am »

tienes razon, por mal uso del foro abri mas hilos de la cuenta, no se si puedan borrarse... procurare no hacerlo en el futuro... la verdad todavia no he podido resolver el problema... gracias por tu ayuda...

Oiga, ya le respondí. Aproveche y lea.
Si ejecutas el comando con el parámetro /T no queda esperando que ingreses una nueva hora, simplemente te muestra la fecha y hora actual.
Tal vez si no hubieses pegado todo ese código hubieras visto la respuesta antes.
En línea

»~^~«ChiCkENURiNE»~^~«
wilmer.rondon

Desconectado Desconectado

Mensajes: 16


Ver Perfil
Re: Interfaz grafica y clase process
« Respuesta #6 en: 13 Junio 2007, 16:06 pm »

HOla:

ya habia leido tu respuesta. disculpa por no responder...

la idea es poder responderle al comando DATE con una nueva fecha... por eso tu sugerencia aunque buena no me sirve... pero muchas gracias por tu interes en ayudarme

saludos
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Duda Java: Usando una única clase que actúe como Interfaz de usuario
Java
llvvrr 3 2,670 Último mensaje 30 Septiembre 2011, 19:11 pm
por llvvrr
Problema con separar interfaz de implementación de una clase.
Programación C/C++
reethok 6 6,162 Último mensaje 25 Diciembre 2011, 14:43 pm
por 3mp3z@ndo
Problema con ejercicio de separar interfaz de implementación de una clase
Programación C/C++
Mordecai 1 2,266 Último mensaje 14 Septiembre 2013, 04:49 am
por erest0r
No puedo usar la clase Process en c++
Programación C/C++
FMLTGRD 3 2,133 Último mensaje 20 Noviembre 2014, 03:32 am
por FMLTGRD
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines