Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.99 KB | None | 0 0
  1. package login;
  2. import java.awt.Color;
  3. import java.sql.*;
  4. import java.util.logging.Level;
  5. import java.util.logging.Logger;
  6. import javax.swing.JOptionPane;
  7. public class Principal extends javax.swing.JFrame {
  8.  
  9. /** Creates new form Principal */
  10. public Principal() {
  11.  
  12. initComponents();
  13. new Splash().run();
  14. Dialogo.setSize(400,200);
  15. Dialogo.setTitle("Bienvendio.");
  16. Dialogo.setLocationRelativeTo(this);
  17. Dialogo.setVisible(true);
  18.  
  19. }
  20.  
  21. @SuppressWarnings("unchecked")
  22. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  23. private void initComponents() {
  24.  
  25. Dialogo = new javax.swing.JDialog();
  26. txtUsers = new javax.swing.JTextField();
  27. jLabel1 = new javax.swing.JLabel();
  28. jLabel2 = new javax.swing.JLabel();
  29. btnEntrar = new javax.swing.JButton();
  30. btnCerrar = new javax.swing.JButton();
  31. txtPassword = new javax.swing.JPasswordField();
  32. jLabel3 = new javax.swing.JLabel();
  33. DialogoSplash = new javax.swing.JDialog();
  34. jLabel4 = new javax.swing.JLabel();
  35. PanelPrincipal = new javax.swing.JPanel();
  36. btnPrincipalPacientes = new javax.swing.JButton();
  37. btnPrincipalContabilidad = new javax.swing.JButton();
  38. btnPrincipalAgenda = new javax.swing.JButton();
  39. btnPrincipalUsuario = new javax.swing.JButton();
  40. btnPrincipalResumen = new javax.swing.JButton();
  41. btnPrincipalInformacion = new javax.swing.JButton();
  42. btnPrincipalHerramientas = new javax.swing.JButton();
  43. btnPrincipalAyuda = new javax.swing.JButton();
  44. lblInformacion = new javax.swing.JLabel();
  45. btnPrincipalAjustes = new javax.swing.JButton();
  46.  
  47. Dialogo.setTitle("");
  48. Dialogo.setIconImage(null);
  49. Dialogo.setMinimumSize(new java.awt.Dimension(500, 100));
  50. Dialogo.addWindowListener(new java.awt.event.WindowAdapter() {
  51. public void windowClosing(java.awt.event.WindowEvent evt) {
  52. DialogoWindowClosing(evt);
  53. }
  54. });
  55.  
  56. txtUsers.addActionListener(new java.awt.event.ActionListener() {
  57. public void actionPerformed(java.awt.event.ActionEvent evt) {
  58. txtUsersActionPerformed(evt);
  59. }
  60. });
  61.  
  62. jLabel1.setText("Usuario:");
  63.  
  64. jLabel2.setText("Clave:");
  65.  
  66. btnEntrar.setText("Entrar");
  67. btnEntrar.addActionListener(new java.awt.event.ActionListener() {
  68. public void actionPerformed(java.awt.event.ActionEvent evt) {
  69. btnEntrarActionPerformed(evt);
  70. }
  71. });
  72.  
  73. btnCerrar.setText("Cerrar");
  74. btnCerrar.addActionListener(new java.awt.event.ActionListener() {
  75. public void actionPerformed(java.awt.event.ActionEvent evt) {
  76. btnCerrarActionPerformed(evt);
  77. }
  78. });
  79.  
  80. txtPassword.addActionListener(new java.awt.event.ActionListener() {
  81. public void actionPerformed(java.awt.event.ActionEvent evt) {
  82. txtPasswordActionPerformed(evt);
  83. }
  84. });
  85. txtPassword.addKeyListener(new java.awt.event.KeyAdapter() {
  86. public void keyReleased(java.awt.event.KeyEvent evt) {
  87. txtPasswordKeyReleased(evt);
  88. }
  89. });
  90.  
  91. jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/login.jpg"))); // NOI18N
  92.  
  93. javax.swing.GroupLayout DialogoLayout = new javax.swing.GroupLayout(Dialogo.getContentPane());
  94. Dialogo.getContentPane().setLayout(DialogoLayout);
  95. DialogoLayout.setHorizontalGroup(
  96. DialogoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  97. .addGroup(DialogoLayout.createSequentialGroup()
  98. .addGap(20, 20, 20)
  99. .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
  100. .addGap(30, 30, 30)
  101. .addGroup(DialogoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  102. .addGroup(DialogoLayout.createSequentialGroup()
  103. .addGroup(DialogoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  104. .addGroup(DialogoLayout.createSequentialGroup()
  105. .addGap(20, 20, 20)
  106. .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
  107. .addGroup(DialogoLayout.createSequentialGroup()
  108. .addGap(20, 20, 20)
  109. .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
  110. .addGap(30, 30, 30))
  111. .addGroup(DialogoLayout.createSequentialGroup()
  112. .addComponent(btnCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
  113. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
  114. .addGroup(DialogoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  115. .addComponent(txtUsers, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
  116. .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
  117. .addComponent(btnEntrar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
  118. .addContainerGap(48, Short.MAX_VALUE))
  119. );
  120. DialogoLayout.setVerticalGroup(
  121. DialogoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  122. .addGroup(DialogoLayout.createSequentialGroup()
  123. .addGroup(DialogoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  124. .addGroup(DialogoLayout.createSequentialGroup()
  125. .addGap(10, 10, 10)
  126. .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
  127. .addGroup(DialogoLayout.createSequentialGroup()
  128. .addGap(30, 30, 30)
  129. .addComponent(jLabel1)
  130. .addGap(16, 16, 16)
  131. .addComponent(jLabel2)
  132. .addGap(26, 26, 26)
  133. .addGroup(DialogoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  134. .addComponent(btnCerrar)
  135. .addComponent(btnEntrar)))
  136. .addGroup(DialogoLayout.createSequentialGroup()
  137. .addGap(30, 30, 30)
  138. .addComponent(txtUsers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  139. .addGap(10, 10, 10)
  140. .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  141. .addContainerGap(23, Short.MAX_VALUE))
  142. );
  143.  
  144. jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cielo.jpg"))); // NOI18N
  145. jLabel4.setText("jLabel4");
  146.  
  147. javax.swing.GroupLayout DialogoSplashLayout = new javax.swing.GroupLayout(DialogoSplash.getContentPane());
  148. DialogoSplash.getContentPane().setLayout(DialogoSplashLayout);
  149. DialogoSplashLayout.setHorizontalGroup(
  150. DialogoSplashLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  151. .addGroup(DialogoSplashLayout.createSequentialGroup()
  152. .addContainerGap()
  153. .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)
  154. .addContainerGap(186, Short.MAX_VALUE))
  155. );
  156. DialogoSplashLayout.setVerticalGroup(
  157. DialogoSplashLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  158. .addGroup(DialogoSplashLayout.createSequentialGroup()
  159. .addContainerGap()
  160. .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
  161. .addContainerGap(105, Short.MAX_VALUE))
  162. );
  163.  
  164. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  165. setTitle("Consultorio Virtual");
  166. setBackground(new java.awt.Color(51, 51, 255));
  167. setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  168. setForeground(new java.awt.Color(204, 204, 255));
  169. setMinimumSize(new java.awt.Dimension(640, 350));
  170. setResizable(false);
  171. getContentPane().setLayout(null);
  172.  
  173. PanelPrincipal.setBackground(new java.awt.Color(255, 255, 255));
  174. PanelPrincipal.setMaximumSize(new java.awt.Dimension(0, 0));
  175. PanelPrincipal.setMinimumSize(new java.awt.Dimension(0, 0));
  176. PanelPrincipal.setLayout(null);
  177.  
  178. btnPrincipalPacientes.setBackground(new java.awt.Color(204, 204, 255));
  179. btnPrincipalPacientes.setFont(new java.awt.Font("Sylfaen", 1, 24));
  180. btnPrincipalPacientes.setText("Pacientes");
  181. btnPrincipalPacientes.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  182. btnPrincipalPacientes.setBorderPainted(false);
  183. btnPrincipalPacientes.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  184. btnPrincipalPacientes.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  185. btnPrincipalPacientes.setMargin(new java.awt.Insets(1, 1, 1, 1));
  186. btnPrincipalPacientes.addMouseListener(new java.awt.event.MouseAdapter() {
  187. public void mouseExited(java.awt.event.MouseEvent evt) {
  188. btnPrincipalPacientesMouseExited(evt);
  189. }
  190. });
  191. btnPrincipalPacientes.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  192. public void mouseMoved(java.awt.event.MouseEvent evt) {
  193. btnPrincipalPacientesMouseMoved(evt);
  194. }
  195. });
  196. btnPrincipalPacientes.addActionListener(new java.awt.event.ActionListener() {
  197. public void actionPerformed(java.awt.event.ActionEvent evt) {
  198. btnPrincipalPacientesActionPerformed(evt);
  199. }
  200. });
  201. PanelPrincipal.add(btnPrincipalPacientes);
  202. btnPrincipalPacientes.setBounds(10, 0, 180, 70);
  203.  
  204. btnPrincipalContabilidad.setBackground(new java.awt.Color(204, 204, 255));
  205. btnPrincipalContabilidad.setFont(new java.awt.Font("Sylfaen", 1, 24));
  206. btnPrincipalContabilidad.setText("Contabilidad");
  207. btnPrincipalContabilidad.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  208. btnPrincipalContabilidad.setBorderPainted(false);
  209. btnPrincipalContabilidad.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  210. btnPrincipalContabilidad.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  211. btnPrincipalContabilidad.setMargin(new java.awt.Insets(1, 1, 1, 1));
  212. btnPrincipalContabilidad.addMouseListener(new java.awt.event.MouseAdapter() {
  213. public void mouseExited(java.awt.event.MouseEvent evt) {
  214. btnPrincipalContabilidadMouseExited(evt);
  215. }
  216. });
  217. btnPrincipalContabilidad.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  218. public void mouseMoved(java.awt.event.MouseEvent evt) {
  219. btnPrincipalContabilidadMouseMoved(evt);
  220. }
  221. });
  222. btnPrincipalContabilidad.addActionListener(new java.awt.event.ActionListener() {
  223. public void actionPerformed(java.awt.event.ActionEvent evt) {
  224. btnPrincipalContabilidadActionPerformed(evt);
  225. }
  226. });
  227. PanelPrincipal.add(btnPrincipalContabilidad);
  228. btnPrincipalContabilidad.setBounds(190, 0, 180, 70);
  229.  
  230. btnPrincipalAgenda.setBackground(new java.awt.Color(204, 204, 255));
  231. btnPrincipalAgenda.setFont(new java.awt.Font("Sylfaen", 1, 24));
  232. btnPrincipalAgenda.setText("Agenda");
  233. btnPrincipalAgenda.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  234. btnPrincipalAgenda.setBorderPainted(false);
  235. btnPrincipalAgenda.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  236. btnPrincipalAgenda.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  237. btnPrincipalAgenda.setMargin(new java.awt.Insets(1, 1, 1, 1));
  238. btnPrincipalAgenda.addMouseListener(new java.awt.event.MouseAdapter() {
  239. public void mouseExited(java.awt.event.MouseEvent evt) {
  240. btnPrincipalAgendaMouseExited(evt);
  241. }
  242. });
  243. btnPrincipalAgenda.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  244. public void mouseMoved(java.awt.event.MouseEvent evt) {
  245. btnPrincipalAgendaMouseMoved(evt);
  246. }
  247. });
  248. btnPrincipalAgenda.addActionListener(new java.awt.event.ActionListener() {
  249. public void actionPerformed(java.awt.event.ActionEvent evt) {
  250. btnPrincipalAgendaActionPerformed(evt);
  251. }
  252. });
  253. PanelPrincipal.add(btnPrincipalAgenda);
  254. btnPrincipalAgenda.setBounds(370, 0, 180, 70);
  255.  
  256. btnPrincipalUsuario.setBackground(new java.awt.Color(204, 204, 255));
  257. btnPrincipalUsuario.setFont(new java.awt.Font("Sylfaen", 1, 24));
  258. btnPrincipalUsuario.setText("Usuarios");
  259. btnPrincipalUsuario.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  260. btnPrincipalUsuario.setBorderPainted(false);
  261. btnPrincipalUsuario.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  262. btnPrincipalUsuario.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  263. btnPrincipalUsuario.setMargin(new java.awt.Insets(1, 1, 1, 1));
  264. btnPrincipalUsuario.addMouseListener(new java.awt.event.MouseAdapter() {
  265. public void mouseExited(java.awt.event.MouseEvent evt) {
  266. btnPrincipalUsuarioMouseExited(evt);
  267. }
  268. });
  269. btnPrincipalUsuario.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  270. public void mouseMoved(java.awt.event.MouseEvent evt) {
  271. btnPrincipalUsuarioMouseMoved(evt);
  272. }
  273. });
  274. btnPrincipalUsuario.addActionListener(new java.awt.event.ActionListener() {
  275. public void actionPerformed(java.awt.event.ActionEvent evt) {
  276. btnPrincipalUsuarioActionPerformed(evt);
  277. }
  278. });
  279. PanelPrincipal.add(btnPrincipalUsuario);
  280. btnPrincipalUsuario.setBounds(370, 70, 180, 70);
  281.  
  282. btnPrincipalResumen.setBackground(new java.awt.Color(204, 204, 255));
  283. btnPrincipalResumen.setFont(new java.awt.Font("Sylfaen", 1, 24));
  284. btnPrincipalResumen.setText("Resumen");
  285. btnPrincipalResumen.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  286. btnPrincipalResumen.setBorderPainted(false);
  287. btnPrincipalResumen.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  288. btnPrincipalResumen.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  289. btnPrincipalResumen.setMargin(new java.awt.Insets(1, 1, 1, 1));
  290. btnPrincipalResumen.addMouseListener(new java.awt.event.MouseAdapter() {
  291. public void mouseExited(java.awt.event.MouseEvent evt) {
  292. btnPrincipalResumenMouseExited(evt);
  293. }
  294. });
  295. btnPrincipalResumen.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  296. public void mouseMoved(java.awt.event.MouseEvent evt) {
  297. btnPrincipalResumenMouseMoved(evt);
  298. }
  299. });
  300. btnPrincipalResumen.addActionListener(new java.awt.event.ActionListener() {
  301. public void actionPerformed(java.awt.event.ActionEvent evt) {
  302. btnPrincipalResumenActionPerformed(evt);
  303. }
  304. });
  305. PanelPrincipal.add(btnPrincipalResumen);
  306. btnPrincipalResumen.setBounds(190, 70, 180, 70);
  307.  
  308. btnPrincipalInformacion.setBackground(new java.awt.Color(204, 204, 255));
  309. btnPrincipalInformacion.setFont(new java.awt.Font("Sylfaen", 1, 24));
  310. btnPrincipalInformacion.setText("Informacion");
  311. btnPrincipalInformacion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  312. btnPrincipalInformacion.setBorderPainted(false);
  313. btnPrincipalInformacion.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  314. btnPrincipalInformacion.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  315. btnPrincipalInformacion.setMargin(new java.awt.Insets(1, 1, 1, 1));
  316. btnPrincipalInformacion.addMouseListener(new java.awt.event.MouseAdapter() {
  317. public void mouseExited(java.awt.event.MouseEvent evt) {
  318. btnPrincipalInformacionMouseExited(evt);
  319. }
  320. });
  321. btnPrincipalInformacion.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  322. public void mouseMoved(java.awt.event.MouseEvent evt) {
  323. btnPrincipalInformacionMouseMoved(evt);
  324. }
  325. });
  326. btnPrincipalInformacion.addActionListener(new java.awt.event.ActionListener() {
  327. public void actionPerformed(java.awt.event.ActionEvent evt) {
  328. btnPrincipalInformacionActionPerformed(evt);
  329. }
  330. });
  331. PanelPrincipal.add(btnPrincipalInformacion);
  332. btnPrincipalInformacion.setBounds(10, 70, 180, 70);
  333.  
  334. btnPrincipalHerramientas.setBackground(new java.awt.Color(204, 204, 255));
  335. btnPrincipalHerramientas.setFont(new java.awt.Font("Sylfaen", 1, 24));
  336. btnPrincipalHerramientas.setText("Herramientas");
  337. btnPrincipalHerramientas.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  338. btnPrincipalHerramientas.setBorderPainted(false);
  339. btnPrincipalHerramientas.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  340. btnPrincipalHerramientas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  341. btnPrincipalHerramientas.setMargin(new java.awt.Insets(1, 1, 1, 1));
  342. btnPrincipalHerramientas.addMouseListener(new java.awt.event.MouseAdapter() {
  343. public void mouseExited(java.awt.event.MouseEvent evt) {
  344. btnPrincipalAjustesMouseExited(evt);
  345. }
  346. public void mousePressed(java.awt.event.MouseEvent evt) {
  347. btnPrincipalHerramientasMousePressed(evt);
  348. }
  349. });
  350. btnPrincipalHerramientas.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  351. public void mouseMoved(java.awt.event.MouseEvent evt) {
  352. btnPrincipalHerramientasMouseMoved(evt);
  353. }
  354. });
  355. btnPrincipalHerramientas.addActionListener(new java.awt.event.ActionListener() {
  356. public void actionPerformed(java.awt.event.ActionEvent evt) {
  357. btnPrincipalHerramientasActionPerformed(evt);
  358. }
  359. });
  360. PanelPrincipal.add(btnPrincipalHerramientas);
  361. btnPrincipalHerramientas.setBounds(10, 140, 180, 70);
  362.  
  363. btnPrincipalAyuda.setBackground(new java.awt.Color(204, 204, 255));
  364. btnPrincipalAyuda.setFont(new java.awt.Font("Sylfaen", 1, 24));
  365. btnPrincipalAyuda.setText("Ayuda");
  366. btnPrincipalAyuda.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  367. btnPrincipalAyuda.setBorderPainted(false);
  368. btnPrincipalAyuda.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  369. btnPrincipalAyuda.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  370. btnPrincipalAyuda.setMargin(new java.awt.Insets(1, 1, 1, 1));
  371. btnPrincipalAyuda.addMouseListener(new java.awt.event.MouseAdapter() {
  372. public void mouseExited(java.awt.event.MouseEvent evt) {
  373. btnPrincipalAyudaMouseExited(evt);
  374. }
  375. public void mousePressed(java.awt.event.MouseEvent evt) {
  376. btnPrincipalAyudaMousePressed(evt);
  377. }
  378. });
  379. btnPrincipalAyuda.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  380. public void mouseMoved(java.awt.event.MouseEvent evt) {
  381. btnPrincipalAyudaMouseMoved(evt);
  382. }
  383. });
  384. btnPrincipalAyuda.addActionListener(new java.awt.event.ActionListener() {
  385. public void actionPerformed(java.awt.event.ActionEvent evt) {
  386. btnPrincipalAyudaActionPerformed(evt);
  387. }
  388. });
  389. PanelPrincipal.add(btnPrincipalAyuda);
  390. btnPrincipalAyuda.setBounds(370, 140, 180, 70);
  391.  
  392. lblInformacion.setBackground(new java.awt.Color(0, 0, 0));
  393. lblInformacion.setFont(new java.awt.Font("Sylfaen", 0, 14));
  394. lblInformacion.setForeground(new java.awt.Color(0, 0, 255));
  395. lblInformacion.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  396. lblInformacion.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
  397. PanelPrincipal.add(lblInformacion);
  398. lblInformacion.setBounds(10, 220, 540, 50);
  399.  
  400. btnPrincipalAjustes.setBackground(new java.awt.Color(204, 204, 255));
  401. btnPrincipalAjustes.setFont(new java.awt.Font("Sylfaen", 1, 24));
  402. btnPrincipalAjustes.setText("Ajustes");
  403. btnPrincipalAjustes.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  404. btnPrincipalAjustes.setBorderPainted(false);
  405. btnPrincipalAjustes.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  406. btnPrincipalAjustes.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  407. btnPrincipalAjustes.setMargin(new java.awt.Insets(1, 1, 1, 1));
  408. btnPrincipalAjustes.addMouseListener(new java.awt.event.MouseAdapter() {
  409. public void mouseExited(java.awt.event.MouseEvent evt) {
  410. btnPrincipalAjustesMouseExited1(evt);
  411. }
  412. public void mousePressed(java.awt.event.MouseEvent evt) {
  413. btnPrincipalAjustesMousePressed(evt);
  414. }
  415. });
  416. btnPrincipalAjustes.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
  417. public void mouseMoved(java.awt.event.MouseEvent evt) {
  418. btnPrincipalAjustesMouseMoved(evt);
  419. }
  420. });
  421. btnPrincipalAjustes.addActionListener(new java.awt.event.ActionListener() {
  422. public void actionPerformed(java.awt.event.ActionEvent evt) {
  423. btnPrincipalAjustesActionPerformed(evt);
  424. }
  425. });
  426. PanelPrincipal.add(btnPrincipalAjustes);
  427. btnPrincipalAjustes.setBounds(190, 140, 180, 70);
  428.  
  429. getContentPane().add(PanelPrincipal);
  430. PanelPrincipal.setBounds(30, 20, 560, 280);
  431.  
  432. pack();
  433. }// </editor-fold>
  434.  
  435. private void DialogoWindowClosing(java.awt.event.WindowEvent evt) {
  436. // TODO add your handling code here:
  437. System.exit(0);
  438. }
  439.  
  440. private void btnEntrarActionPerformed(java.awt.event.ActionEvent evt) {
  441. String user = txtUsers.getText();
  442. String password = txtPassword.getText();
  443.  
  444. if(user.isEmpty() || password.isEmpty())
  445. {
  446. JOptionPane.showMessageDialog(null, "Ingrese su nombre de usuario y su contraseña");
  447. }else{
  448. Conexion conexion = new Conexion();
  449.  
  450. try{
  451. int id_user =0;
  452. Statement statement = conexion.conectar();
  453. ResultSet resultset = statement.executeQuery("SELECT * FROM users WHERE user_name ='"+ user + "' AND user_password ='" + password + "'");
  454. resultset.last();
  455.  
  456. int encontrado = resultset.getRow();
  457. System.out.print(String.valueOf(encontrado));
  458.  
  459. if(encontrado ==1)
  460. {
  461. this.setVisible(true);
  462. Dialogo.setVisible(false);
  463.  
  464. }else{
  465. JOptionPane.showMessageDialog(null, "Sus datos son incorrecto. Revise por favor");
  466. }
  467. resultset.close();
  468. statement.close();
  469.  
  470. }
  471. catch(SQLException ex){
  472. Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
  473. }
  474.  
  475.  
  476.  
  477. }
  478.  
  479.  
  480. }
  481.  
  482. private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {
  483. // TODO add your handling code here:
  484. System.exit(0);
  485. }
  486.  
  487. private void txtPasswordActionPerformed(java.awt.event.ActionEvent evt) {
  488. // TODO add your handling code here:
  489. }
  490.  
  491. private void txtPasswordKeyReleased(java.awt.event.KeyEvent evt) {
  492. // TODO add your handling code here:
  493. if(evt.getKeyCode() == 10){
  494. System.out.print("Enter");
  495. this.btnEntrarActionPerformed(null);
  496. }
  497. }
  498.  
  499. private void btnPrincipalPacientesActionPerformed(java.awt.event.ActionEvent evt) {
  500. new Pacientes().setVisible(true);
  501. }
  502.  
  503. private void btnPrincipalResumenActionPerformed(java.awt.event.ActionEvent evt) {
  504. // TODO add your handling code here:
  505. new Visualizar().setVisible(true);
  506. }
  507.  
  508. private void btnPrincipalInformacionActionPerformed(java.awt.event.ActionEvent evt) {
  509. try {
  510. new InfMedico().setVisible(true);
  511. } catch (SQLException ex) {
  512. Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
  513. }
  514.  
  515. }
  516.  
  517. private void btnPrincipalContabilidadActionPerformed(java.awt.event.ActionEvent evt) {
  518. // TODO add your handling code here:
  519. new ContabilidadGeneral().setVisible(true);
  520. }
  521.  
  522. private void btnPrincipalPacientesMouseMoved(java.awt.event.MouseEvent evt) {
  523. // TODO add your handling code here:
  524. lblInformacion.setText("Informacion del Paciente");
  525. btnPrincipalPacientes.setForeground(Color.blue);
  526. btnPrincipalPacientes.setBackground(Color.white);
  527. }
  528.  
  529. private void btnPrincipalContabilidadMouseMoved(java.awt.event.MouseEvent evt) {
  530. // TODO add your handling code here:
  531. lblInformacion.setText("LLevar a cabo la contabilidad");
  532. btnPrincipalContabilidad.setForeground(Color.blue);
  533. btnPrincipalContabilidad.setBackground(Color.white);
  534. }
  535.  
  536. private void btnPrincipalAgendaActionPerformed(java.awt.event.ActionEvent evt) {
  537. // TODO add your handling code here:
  538. new Agenda().setVisible(true);
  539. }
  540.  
  541. private void btnPrincipalAgendaMouseMoved(java.awt.event.MouseEvent evt) {
  542. // TODO add your handling code here:
  543. lblInformacion.setText("Agenda Programada del Medico");
  544. btnPrincipalAgenda.setForeground(Color.blue);
  545. btnPrincipalAgenda.setBackground(Color.white);
  546. }
  547.  
  548. private void btnPrincipalInformacionMouseMoved(java.awt.event.MouseEvent evt) {
  549. // TODO add your handling code here:
  550. lblInformacion.setText("Informacion relativa a los medicos.");
  551. btnPrincipalInformacion.setForeground(Color.blue);
  552. btnPrincipalInformacion.setBackground(Color.white);
  553. }
  554.  
  555. private void btnPrincipalResumenMouseMoved(java.awt.event.MouseEvent evt) {
  556. // TODO add your handling code here:
  557. lblInformacion.setText("Resumen General");
  558. btnPrincipalResumen.setForeground(Color.blue);
  559. btnPrincipalResumen.setBackground(Color.white);
  560. }
  561.  
  562. private void btnPrincipalUsuarioMouseMoved(java.awt.event.MouseEvent evt) {
  563. // TODO add your handling code here:
  564. lblInformacion.setText("Mantenimiento de usuarios del sistema");
  565. btnPrincipalUsuario.setForeground(Color.blue);
  566. btnPrincipalUsuario.setBackground(Color.white);
  567. }
  568.  
  569. private void btnPrincipalHerramientasMousePressed(java.awt.event.MouseEvent evt) {
  570. // TODO add your handling code here:
  571.  
  572. }
  573.  
  574. private void btnPrincipalAyudaMousePressed(java.awt.event.MouseEvent evt) {
  575. // TODO add your handling code here:
  576.  
  577. }
  578.  
  579. private void btnPrincipalHerramientasMouseMoved(java.awt.event.MouseEvent evt) {
  580. // TODO add your handling code here:
  581. lblInformacion.setText("Herramientas varias, calculadora etc.");
  582. btnPrincipalHerramientas.setForeground(Color.blue);
  583. btnPrincipalHerramientas.setBackground(Color.white);
  584. }
  585.  
  586. private void btnPrincipalAyudaMouseMoved(java.awt.event.MouseEvent evt) {
  587. // TODO add your handling code here:
  588. lblInformacion.setText("Documentacion y Ayuda del Sistema.");
  589. btnPrincipalAyuda.setBackground(Color.white);
  590. btnPrincipalAyuda.setForeground(Color.blue);
  591.  
  592.  
  593. }
  594.  
  595. private void btnPrincipalAyudaMouseExited(java.awt.event.MouseEvent evt) {
  596. // TODO add your handling code here:
  597. btnPrincipalAyuda.setBackground(new java.awt.Color(204, 204, 255));
  598. btnPrincipalAyuda.setForeground(Color.black);
  599. }
  600.  
  601. private void btnPrincipalPacientesMouseExited(java.awt.event.MouseEvent evt) {
  602. // TODO add your handling code here:
  603. btnPrincipalPacientes.setForeground(Color.black);
  604. btnPrincipalPacientes.setBackground(new java.awt.Color(204, 204, 255));
  605. }
  606.  
  607. private void btnPrincipalContabilidadMouseExited(java.awt.event.MouseEvent evt) {
  608. // TODO add your handling code here:
  609. btnPrincipalContabilidad.setForeground(Color.black);
  610. btnPrincipalContabilidad.setBackground(new java.awt.Color(204, 204, 255));
  611. }
  612.  
  613. private void btnPrincipalAgendaMouseExited(java.awt.event.MouseEvent evt) {
  614. // TODO add your handling code here:
  615. btnPrincipalAgenda.setForeground(Color.black);
  616. btnPrincipalAgenda.setBackground(new java.awt.Color(204, 204, 255));
  617. }
  618.  
  619. private void btnPrincipalInformacionMouseExited(java.awt.event.MouseEvent evt) {
  620. // TODO add your handling code here:
  621. btnPrincipalInformacion.setForeground(Color.black);
  622. btnPrincipalInformacion.setBackground(new java.awt.Color(204, 204, 255));
  623. }
  624.  
  625. private void btnPrincipalResumenMouseExited(java.awt.event.MouseEvent evt) {
  626. // TODO add your handling code here:
  627. btnPrincipalResumen.setForeground(Color.black);
  628. btnPrincipalResumen.setBackground(new java.awt.Color(204, 204, 255));
  629. }
  630.  
  631. private void btnPrincipalUsuarioMouseExited(java.awt.event.MouseEvent evt) {
  632. // TODO add your handling code here:
  633. btnPrincipalUsuario.setForeground(Color.black);
  634. btnPrincipalUsuario.setBackground(new java.awt.Color(204, 204, 255));
  635. }
  636.  
  637. private void btnPrincipalAjustesMouseExited(java.awt.event.MouseEvent evt) {
  638. // TODO add your handling code here:
  639. btnPrincipalHerramientas.setForeground(Color.black);
  640. btnPrincipalHerramientas.setBackground(new java.awt.Color(204, 204, 255));
  641. }
  642.  
  643. private void btnPrincipalAjustesMouseExited1(java.awt.event.MouseEvent evt) {
  644. // TODO add your handling code here:
  645. btnPrincipalAjustes.setForeground(Color.black);
  646. btnPrincipalAjustes.setBackground(new java.awt.Color(204, 204, 255));
  647. }
  648.  
  649. private void btnPrincipalAjustesMousePressed(java.awt.event.MouseEvent evt) {
  650. // TODO add your handling code here:
  651. }
  652.  
  653. private void btnPrincipalAjustesMouseMoved(java.awt.event.MouseEvent evt) {
  654. // TODO add your handling code here:
  655. lblInformacion.setText("Ajustes generales del Sistema.");
  656. btnPrincipalAjustes.setForeground(Color.blue);
  657. btnPrincipalAjustes.setBackground(Color.white);
  658.  
  659. }
  660.  
  661. private void txtUsersActionPerformed(java.awt.event.ActionEvent evt) {
  662. // TODO add your handling code here:
  663. }
  664.  
  665. private void btnPrincipalUsuarioActionPerformed(java.awt.event.ActionEvent evt) {
  666. // TODO add your handling code here:
  667. new Usuarios().setVisible(true);
  668. }
  669.  
  670. private void btnPrincipalHerramientasActionPerformed(java.awt.event.ActionEvent evt) {
  671. // TODO add your handling code here:
  672. new Herramientas().setVisible(true);
  673. }
  674.  
  675. private void btnPrincipalAjustesActionPerformed(java.awt.event.ActionEvent evt) {
  676. // TODO add your handling code here:
  677. new Ajustes().setVisible(true);
  678. }
  679.  
  680. private void btnPrincipalAyudaActionPerformed(java.awt.event.ActionEvent evt) {
  681. // TODO add your handling code here:
  682. new Ayuda().setVisible(true);
  683. }
  684.  
  685. /**
  686. * @param args the command line arguments
  687. */
  688. public static void main(String args[]) {
  689. java.awt.EventQueue.invokeLater(new Runnable() {
  690.  
  691. public void run() {
  692. new Principal().setLocationRelativeTo(null);
  693. }
  694. });
  695. }
  696. // Variables declaration - do not modify
  697. private javax.swing.JDialog Dialogo;
  698. private javax.swing.JDialog DialogoSplash;
  699. private javax.swing.JPanel PanelPrincipal;
  700. private javax.swing.JButton btnCerrar;
  701. private javax.swing.JButton btnEntrar;
  702. private javax.swing.JButton btnPrincipalAgenda;
  703. private javax.swing.JButton btnPrincipalAjustes;
  704. private javax.swing.JButton btnPrincipalAyuda;
  705. private javax.swing.JButton btnPrincipalContabilidad;
  706. private javax.swing.JButton btnPrincipalHerramientas;
  707. private javax.swing.JButton btnPrincipalInformacion;
  708. private javax.swing.JButton btnPrincipalPacientes;
  709. private javax.swing.JButton btnPrincipalResumen;
  710. private javax.swing.JButton btnPrincipalUsuario;
  711. private javax.swing.JLabel jLabel1;
  712. private javax.swing.JLabel jLabel2;
  713. private javax.swing.JLabel jLabel3;
  714. private javax.swing.JLabel jLabel4;
  715. private javax.swing.JLabel lblInformacion;
  716. private javax.swing.JPasswordField txtPassword;
  717. private javax.swing.JTextField txtUsers;
  718. // End of variables declaration
  719. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement