Advertisement
Guest User

Untitled

a guest
Jul 9th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.90 KB | None | 0 0
  1. FormLogin
  2.  
  3.  
  4.  
  5. package Teste2018;
  6.  
  7. import javax.swing.JFrame;
  8. import javax.swing.JPanel;
  9. import java.awt.BorderLayout;
  10. import java.awt.Color;
  11. import java.awt.Dimension;
  12. import java.awt.GridLayout;
  13. import java.awt.Image;
  14.  
  15. import javax.swing.JTextField;
  16. import java.awt.event.FocusAdapter;
  17. import java.awt.event.FocusEvent;
  18. import java.io.IOException;
  19. import java.net.URISyntaxException;
  20. import java.sql.SQLException;
  21. import java.text.DateFormat;
  22. import java.text.ParseException;
  23. import java.text.SimpleDateFormat;
  24. import java.util.ArrayList;
  25. import java.util.Date;
  26. import java.util.List;
  27.  
  28. import javax.swing.border.TitledBorder;
  29. import javax.swing.text.JTextComponent;
  30. import javax.swing.border.LineBorder;
  31. import javax.swing.JLabel;
  32. import javax.swing.JOptionPane;
  33. import javax.swing.SwingConstants;
  34. import javax.swing.ImageIcon;
  35. import javax.swing.JButton;
  36. import java.awt.event.ActionListener;
  37. import java.awt.event.ActionEvent;
  38. import java.awt.SystemColor;
  39. import javax.swing.UIManager;
  40. import java.awt.Font;
  41. import java.awt.event.MouseAdapter;
  42. import java.awt.event.MouseEvent;
  43. import java.awt.event.KeyAdapter;
  44. import java.awt.event.KeyEvent;
  45. import javax.swing.JComboBox;
  46. import javax.swing.DefaultComboBoxModel;
  47. import java.awt.Toolkit;
  48.  
  49. public class FormLogin extends JFrame {
  50.  
  51. private static final long serialVersionUID = 1L;
  52. private JTextField nifLocaliza;
  53. private JTextField nomee;
  54. private JTextField dadospw;
  55. private JTextField dadosemail;
  56. private JPanel painelacoes;
  57. JPanel painelrelogio;
  58. private int registoAtual=0;
  59. List <loginOO> listaLogin = new ArrayList<loginOO>();
  60. operacaocrud op=new operacaocrud();
  61. loginOO login=new loginOO();
  62. private List<loginOO> loginList;
  63. private JTextComponent dadosnome;
  64. private int idlogin;
  65. private JTextComponent nacionalidade;
  66. private String SelectImagem00;
  67. private String imag;
  68. private JComboBox txttipo;
  69. static String tipo;
  70.  
  71. public FormLogin(String tipo) {
  72. this.tipo = tipo;
  73. setTitle("Constru\u00E7\u00F5es Isipal : Gest\u00E3o de Contas");
  74. setIconImage(Toolkit.getDefaultToolkit().getImage(FormLogin.class.getResource("/Imagens/isi32.png")));
  75. setBounds(100,80,900,650);
  76. getContentPane().setLayout(null);
  77.  
  78. JPanel PainelPrincipal = new JPanel();
  79. PainelPrincipal.setBackground(new Color(210, 105, 30));
  80. PainelPrincipal.setBounds(0, 0, 884, 611);
  81. getContentPane().add(PainelPrincipal);
  82. PainelPrincipal.setLayout(null);
  83.  
  84. JPanel painelpesquisa = new JPanel();
  85. painelpesquisa.setBackground(new Color(255, 127, 80));
  86. painelpesquisa.setBorder(new TitledBorder(new LineBorder(new Color(255, 255, 255), 2, true), "Pesquisa", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(255, 255, 255)));
  87. painelpesquisa.setBounds(10, 145, 589, 82);
  88. PainelPrincipal.add(painelpesquisa);
  89. painelpesquisa.setLayout(null);
  90.  
  91. nifLocaliza = new JTextField();
  92.  
  93. nifLocaliza.setHorizontalAlignment(SwingConstants.LEFT);
  94. nifLocaliza.setBounds(34, 34, 86, 20);
  95. painelpesquisa.add(nifLocaliza);
  96. nifLocaliza.setColumns(10);
  97.  
  98. JLabel lblNif = new JLabel("User:");
  99. lblNif.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  100. lblNif.setForeground(UIManager.getColor("Button.highlight"));
  101. lblNif.setBounds(9, 37, 46, 14);
  102. painelpesquisa.add(lblNif);
  103.  
  104. JButton primeiro = new JButton("Primeiro");
  105. primeiro.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  106. primeiro.setBackground(new Color(255, 160, 122));
  107. primeiro.setForeground(new Color(255, 250, 240));
  108. primeiro.setBounds(222, 32, 85, 23);
  109. painelpesquisa.add(primeiro);
  110.  
  111. JButton anterior = new JButton("Anterior");
  112. anterior.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  113. anterior.setForeground(new Color(255, 250, 250));
  114. anterior.setBackground(new Color(255, 160, 122));
  115. anterior.setBounds(317, 32, 81, 23);
  116. painelpesquisa.add(anterior);
  117.  
  118. JButton seguinte = new JButton("Seguinte");
  119. seguinte.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  120. seguinte.setForeground(new Color(255, 250, 240));
  121. seguinte.setBackground(new Color(255, 160, 122));
  122. seguinte.setBounds(408, 32, 86, 23);
  123. painelpesquisa.add(seguinte);
  124.  
  125. JButton ultimo = new JButton("\u00DAltimo");
  126. ultimo.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  127. ultimo.setForeground(new Color(245, 255, 250));
  128. ultimo.setBackground(new Color(255, 160, 122));
  129. ultimo.setBounds(504, 32, 75, 23);
  130. painelpesquisa.add(ultimo);
  131.  
  132. JButton pesquisar = new JButton("Pesquisar");
  133. pesquisar.addActionListener(new ActionListener() {
  134. public void actionPerformed(ActionEvent arg0) {
  135. try {
  136. onClickLocalizar();
  137. } catch (NumberFormatException | SQLException | IOException | InterruptedException e) {
  138. // TODO Auto-generated catch block
  139. e.printStackTrace();
  140. }
  141. }
  142. });
  143. pesquisar.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  144. pesquisar.setForeground(new Color(255, 250, 240));
  145. pesquisar.setBackground(new Color(255, 160, 122));
  146. pesquisar.setBounds(130, 32, 86, 23);
  147. painelpesquisa.add(pesquisar);
  148. ultimo.addActionListener(new ActionListener() {
  149. public void actionPerformed(ActionEvent e) {
  150. try {
  151. onClickUltimo();
  152. } catch (SQLException | IOException | InterruptedException e1) {
  153. // TODO Auto-generated catch block
  154. e1.printStackTrace();
  155. }
  156. }
  157. });
  158. seguinte.addActionListener(new ActionListener() {
  159. public void actionPerformed(ActionEvent e) {
  160. try {
  161. onClickProximo();
  162. } catch (SQLException | IOException | InterruptedException e1) {
  163. // TODO Auto-generated catch block
  164. e1.printStackTrace();
  165. }
  166. }
  167. });
  168. anterior.addActionListener(new ActionListener() {
  169. public void actionPerformed(ActionEvent e) {
  170. try {
  171. onClickAnterior();
  172. } catch (SQLException | IOException | InterruptedException e1) {
  173. // TODO Auto-generated catch block
  174. e1.printStackTrace();
  175. }
  176. }
  177. });
  178.  
  179.  
  180. primeiro.addActionListener(new ActionListener() {
  181. public void actionPerformed(ActionEvent arg0) {
  182.  
  183. try {
  184. onClickPrimeiro();
  185. } catch (SQLException | IOException | InterruptedException e) {
  186. // TODO Auto-generated catch block
  187. e.printStackTrace();
  188. }
  189. }
  190. });
  191.  
  192. JPanel painelinformacao = new JPanel();
  193. painelinformacao.setForeground(UIManager.getColor("Button.highlight"));
  194. painelinformacao.setBackground(new Color(255, 127, 80));
  195. painelinformacao.setBorder(new TitledBorder(new LineBorder(new Color(255, 255, 255), 2), "Informa\u00E7\u00E3o", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(255, 255, 255)));
  196. painelinformacao.setBounds(10, 253, 589, 197);
  197. PainelPrincipal.add(painelinformacao);
  198. painelinformacao.setLayout(null);
  199.  
  200. JLabel user = new JLabel("User:");
  201. user.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  202. user.setForeground(UIManager.getColor("Button.highlight"));
  203. user.setBackground(SystemColor.textInactiveText);
  204. user.setBounds(10, 35, 46, 14);
  205. painelinformacao.add(user);
  206.  
  207. JLabel pw = new JLabel("Password:");
  208. pw.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  209. pw.setForeground(UIManager.getColor("Button.highlight"));
  210. pw.setBounds(10, 60, 130, 14);
  211. painelinformacao.add(pw);
  212.  
  213. JLabel tipo1 = new JLabel("Tipo:");
  214. tipo1.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  215. tipo1.setForeground(UIManager.getColor("Button.light"));
  216. tipo1.setToolTipText("");
  217. tipo1.setBounds(10, 85, 46, 14);
  218. painelinformacao.add(tipo1);
  219.  
  220. JLabel email = new JLabel("Email:");
  221. email.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 11));
  222. email.setForeground(UIManager.getColor("Button.highlight"));
  223. email.setBounds(10, 110, 35, 14);
  224. painelinformacao.add(email);
  225.  
  226. nomee = new JTextField();
  227. nomee.setBounds(47, 32, 174, 20);
  228. painelinformacao.add(nomee);
  229. nomee.setColumns(10);
  230.  
  231. dadospw = new JTextField();
  232. dadospw.setColumns(10);
  233. dadospw.setBounds(57, 57, 164, 20);
  234. painelinformacao.add(dadospw);
  235.  
  236. dadosemail = new JTextField();
  237. dadosemail.setColumns(10);
  238. dadosemail.setBounds(47, 107, 174, 20);
  239. painelinformacao.add(dadosemail);
  240.  
  241. JButton button = new JButton("Limpar");
  242. button.addActionListener(new ActionListener() {
  243. public void actionPerformed(ActionEvent arg0) {
  244. limparcampos();
  245. }
  246. });
  247. button.setForeground(new Color(255, 250, 240));
  248. button.setFont(new Font("Dialog", Font.PLAIN, 11));
  249. button.setBackground(new Color(255, 160, 122));
  250. button.setBounds(498, 152, 81, 33);
  251. painelinformacao.add(button);
  252.  
  253. txttipo = new JComboBox();
  254. txttipo.setModel(new DefaultComboBoxModel(new String[] {"Selecione...", "Admin", "User"}));
  255. txttipo.setBounds(47, 83, 174, 20);
  256. painelinformacao.add(txttipo);
  257.  
  258. painelacoes = new JPanel();
  259. painelacoes.setBackground(new Color(255, 127, 80));
  260. painelacoes.setBorder(new TitledBorder(new LineBorder(new Color(255, 255, 255), 2), "A\u00E7\u00F5es", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(255, 255, 255)));
  261. painelacoes.setBounds(641, 253, 211, 197);
  262. PainelPrincipal.add(painelacoes);
  263.  
  264. JButton guardar = new JButton("Guardar");
  265. guardar.setFont(new Font("Dialog", Font.PLAIN, 13));
  266. guardar.setBackground(new Color(255, 160, 122));
  267. guardar.setForeground(new Color(255, 250, 240));
  268.  
  269. guardar.addActionListener(new ActionListener() {
  270. public void actionPerformed(ActionEvent arg0) {
  271.  
  272. try {
  273. onClickGuardar();
  274. } catch (NumberFormatException | SQLException | IOException | InterruptedException | ParseException e) {
  275. // TODO Auto-generated catch block
  276. e.printStackTrace();
  277. }
  278.  
  279. }
  280. });
  281. painelacoes.setLayout(new GridLayout(0, 1, 10, 0));
  282.  
  283. JButton btnNovo = new JButton("Novo");
  284. btnNovo.setFont(new Font("Dialog", Font.PLAIN, 13));
  285. btnNovo.setBackground(new Color(255, 160, 122));
  286. btnNovo.setForeground(new Color(255, 250, 240));
  287. btnNovo.addActionListener(new ActionListener() {
  288. public void actionPerformed(ActionEvent e) {
  289. }
  290. });
  291. btnNovo.setForeground(Color.WHITE);
  292. btnNovo.setFont(new Font("Dialog", Font.PLAIN, 13));
  293. painelacoes.add(btnNovo);
  294. painelacoes.add(guardar);
  295.  
  296. JButton eliminar = new JButton("Eliminar");
  297. eliminar.setFont(new Font("Dialog", Font.PLAIN, 13));
  298. eliminar.setBackground(new Color(255, 160, 122));
  299. eliminar.setForeground(new Color(255, 250, 240));
  300. eliminar.addActionListener(new ActionListener() {
  301. public void actionPerformed(ActionEvent arg0) {
  302. try {
  303. onClickRemover();
  304. } catch (SQLException | IOException | InterruptedException e) {
  305. // TODO Auto-generated catch block
  306. e.printStackTrace();
  307. }
  308. }
  309. });
  310. painelacoes.add(eliminar);
  311.  
  312.  
  313. JButton atualizar = new JButton("Atualizar");
  314. atualizar.setFont(new Font("Dialog", Font.PLAIN, 13));
  315. atualizar.setBackground(new Color(255, 160, 122));
  316. atualizar.setForeground(new Color(255, 250, 240));
  317. atualizar.addActionListener(new ActionListener() {
  318. public void actionPerformed(ActionEvent arg0) {
  319. try {
  320. onClickAlterar();
  321. } catch (NumberFormatException | SQLException | IOException | InterruptedException | ParseException e) {
  322. // TODO Auto-generated catch block
  323. e.printStackTrace();
  324. }
  325. }
  326. });
  327. painelacoes.add(atualizar);
  328.  
  329. JPanel CAbecalho = new JPanel();
  330. CAbecalho.setBackground(new Color(255, 127, 80));
  331. CAbecalho.setBounds(10, 11, 842, 112);
  332. PainelPrincipal.add(CAbecalho);
  333. CAbecalho.setLayout(null);
  334.  
  335. painelrelogio = new JPanel();
  336. painelrelogio.setBackground(new Color(255, 127, 80));
  337. painelrelogio.setBounds(503, 11, 310, 80);
  338. CAbecalho.add(painelrelogio);
  339. painelrelogio.setLayout(null);
  340.  
  341. JLabel lblMenu = new JLabel("Zona");
  342. lblMenu.setForeground(new Color(255, 250, 250));
  343. lblMenu.setFont(new Font("DIN Next LT Pro Black", Font.PLAIN, 30));
  344. lblMenu.setHorizontalAlignment(SwingConstants.CENTER);
  345. lblMenu.setBounds(320, 0, 103, 53);
  346. CAbecalho.add(lblMenu);
  347.  
  348. JLabel lblCliente = new JLabel("Conta");
  349. lblCliente.setHorizontalAlignment(SwingConstants.CENTER);
  350. lblCliente.setForeground(new Color(255, 250, 250));
  351. lblCliente.setFont(new Font("DIN Next LT Pro Black", Font.PLAIN, 47));
  352. lblCliente.setBounds(351, 32, 160, 80);
  353. CAbecalho.add(lblCliente);
  354.  
  355. JLabel label_2 = new JLabel("");
  356. label_2.setIcon(new ImageIcon(FormLogin.class.getResource("/Imagens/LOGO-3.png")));
  357. label_2.setHorizontalAlignment(SwingConstants.CENTER);
  358. label_2.setBounds(20, 11, 310, 101);
  359. CAbecalho.add(label_2);
  360.  
  361. JPanel menuuu = new JPanel();
  362. menuuu.setBackground(new Color(255, 160, 122));
  363. menuuu.setBounds(641, 480, 211, 83);
  364. PainelPrincipal.add(menuuu);
  365. menuuu.setLayout(null);
  366.  
  367. JButton menu = new JButton("Menu");
  368. menu.setForeground(new Color(255, 250, 240));
  369. menu.setFont(new Font("DIN Next LT Pro Black", Font.PLAIN, 30));
  370. menu.addActionListener(new ActionListener() {
  371. public void actionPerformed(ActionEvent e) {
  372. dispose();
  373. Principal janela = new Principal(tipo);
  374. janela.setVisible(true);
  375. JDClock relogio = new JDClock(new Dimension(300, 75), 5, 10, new Color(255,127,80), Color.WHITE, new Color(255,127,80));
  376. relogio.setLocation(5, 5);
  377. janela.painelrelogio.add(relogio);
  378. }
  379. });
  380. menu.setFocusPainted(false);
  381. menu.setContentAreaFilled(false);
  382. menu.setBounds(0, 0, 211, 83);
  383. menuuu.add(menu);
  384.  
  385. JPanel panel = new JPanel();
  386. panel.setLayout(null);
  387. panel.setBackground(new Color(255, 160, 122));
  388. panel.setBounds(10, 481, 589, 82);
  389. PainelPrincipal.add(panel);
  390.  
  391. JLabel label = new JLabel("2017/2018 \u00A9 Fernando Almeida");
  392. label.setHorizontalAlignment(SwingConstants.CENTER);
  393. label.setForeground(Color.WHITE);
  394. label.setFont(new Font("Nirmala UI Semilight", Font.PLAIN, 17));
  395. label.setBounds(244, 15, 253, 51);
  396. panel.add(label);
  397.  
  398. JLabel label_1 = new JLabel("");
  399. label_1.setIcon(new ImageIcon(FormLogin.class.getResource("/Imagens/isi32.png")));
  400. label_1.setBounds(525, 27, 32, 32);
  401. panel.add(label_1);
  402.  
  403. JButton button_1 = new JButton("");
  404. button_1.addActionListener(new ActionListener() {
  405. public void actionPerformed(ActionEvent e) {
  406. try {
  407. java.awt.Desktop.getDesktop().browse(new java.net.URI("http://www.aesampaio.pt/"));
  408. } catch (IOException | URISyntaxException e1) {
  409. // TODO Auto-generated catch block
  410. e1.printStackTrace();
  411. }
  412. }
  413. });
  414. button_1.setIcon(new ImageIcon(FormLogin.class.getResource("/Imagens/Escola2.png")));
  415. button_1.setFocusPainted(false);
  416. button_1.setBorder(null);
  417. button_1.setBackground((Color) null);
  418. button_1.setBounds(172, 15, 54, 51);
  419. panel.add(button_1);
  420.  
  421. JButton button_2 = new JButton("");
  422. button_2.addActionListener(new ActionListener() {
  423. public void actionPerformed(ActionEvent e) {
  424. try {
  425. java.awt.Desktop.getDesktop().browse(new java.net.URI("http://www.twitter.com/"));
  426. } catch (IOException | URISyntaxException e1) {
  427. // TODO Auto-generated catch block
  428. e1.printStackTrace();
  429. }
  430. }
  431. });
  432. button_2.setIcon(new ImageIcon(FormLogin.class.getResource("/Imagens/TwitterB.png")));
  433. button_2.setFocusPainted(false);
  434. button_2.setBorder(null);
  435. button_2.setBackground((Color) null);
  436. button_2.setBounds(88, 15, 54, 51);
  437. panel.add(button_2);
  438.  
  439. JButton button_3 = new JButton("");
  440. button_3.addActionListener(new ActionListener() {
  441. public void actionPerformed(ActionEvent e) {
  442. try {
  443. java.awt.Desktop.getDesktop().browse(new java.net.URI("http://www.facebook.com/"));
  444. } catch (IOException | URISyntaxException e1) {
  445. // TODO Auto-generated catch block
  446. e1.printStackTrace();
  447. }
  448. }
  449. });
  450. button_3.setIcon(new ImageIcon(FormLogin.class.getResource("/Imagens/FacebookB.png")));
  451. button_3.setFocusPainted(false);
  452. button_3.setBorder(null);
  453. button_3.setBackground((Color) null);
  454. button_3.setBounds(10, 15, 54, 51);
  455. panel.add(button_3);
  456.  
  457. JPanel panel_1 = new JPanel();
  458. panel_1.setLayout(null);
  459. panel_1.setBackground(new Color(255, 160, 122));
  460. panel_1.setBounds(641, 145, 211, 83);
  461. PainelPrincipal.add(panel_1);
  462.  
  463. JButton btnListagens = new JButton("Listagens");
  464. btnListagens.addActionListener(new ActionListener() {
  465. public void actionPerformed(ActionEvent e) {
  466. }
  467. });
  468. btnListagens.setForeground(new Color(255, 250, 240));
  469. btnListagens.setFont(new Font("DIN Next LT Pro Black", Font.PLAIN, 30));
  470. btnListagens.setFocusPainted(false);
  471. btnListagens.setContentAreaFilled(false);
  472. btnListagens.setBounds(0, 0, 211, 83);
  473. panel_1.add(btnListagens);
  474. // TODO Auto-generated constructor stub
  475. }
  476.  
  477. protected void onClickLocalizar() throws NumberFormatException, SQLException, IOException, InterruptedException {
  478. // TODO Auto-generated method stub
  479.  
  480. if(nifLocaliza.getText()=="") {
  481. nifLocaliza.requestFocus();
  482. }else {
  483. loginOO log = op.obtemUserLogin(String.valueOf(nifLocaliza.getText()));
  484. idlogin=log.getIdlogin();
  485. nomee.setText(log.getUser());
  486. dadospw.setText(log.getPw());
  487. txttipo.setSelectedItem(String.valueOf(log.getTipo()));
  488. dadosemail.setText(String.valueOf(log.getEmail()));
  489. }
  490.  
  491. }
  492.  
  493. void getValores(int index) throws SQLException, IOException, InterruptedException {
  494. loginList= op.obtemlogin();
  495. if (index <= loginList.size()-1) {
  496. loginOO log = loginList.get(index);
  497. idlogin=log.getIdlogin();
  498. nomee.setText(log.getUser());
  499. dadospw.setText(log.getPw());
  500. txttipo.setSelectedItem(String.valueOf(log.getTipo()));
  501. dadosemail.setText(String.valueOf(log.getEmail()));
  502.  
  503. }
  504. }
  505.  
  506. private void onClickGuardar() throws NumberFormatException, SQLException, IOException, InterruptedException, ParseException {
  507. op.guardarlogin(nomee.getText(), dadospw.getText(), String.valueOf(txttipo.getSelectedItem()), dadosemail.getText());
  508. JOptionPane.showMessageDialog(this, "Novo login inserido com sucesso");
  509. limparcampos();
  510. }
  511.  
  512. private void onClickAlterar() throws NumberFormatException, SQLException, IOException, InterruptedException, ParseException {
  513. op.alterarlogin(nomee.getText(), dadospw.getText(), String.valueOf(txttipo.getSelectedItem()), dadosemail.getText(), idlogin);
  514. JOptionPane.showMessageDialog(this, "Login atualizado com sucesso");
  515. limparcampos();
  516. }
  517. private void onClickRemover() throws SQLException, IOException, InterruptedException {
  518. op.apagarclientes(idlogin);
  519. JOptionPane.showMessageDialog(this, "Login removido com sucesso");
  520. limparcampos();
  521. }
  522. private void onClickPrimeiro() throws SQLException, IOException, InterruptedException {
  523. nifLocaliza.setText("");
  524. registoAtual = 0;
  525. getValores(registoAtual);
  526. nifLocaliza.setText("");
  527. }
  528.  
  529. private void onClickUltimo() throws SQLException, IOException, InterruptedException {
  530. nifLocaliza.setText("");
  531. loginList= new operacaocrud().obtemlogin();
  532. registoAtual = loginList.size() - 1;
  533. getValores(registoAtual);
  534. nifLocaliza.setText("");
  535. }
  536. private void onClickProximo() throws SQLException, IOException, InterruptedException {
  537. loginList= new operacaocrud().obtemlogin();
  538. if (registoAtual != loginList.size() - 1) {
  539. getValores(++registoAtual);
  540. }
  541. nifLocaliza.setText("");
  542. }
  543.  
  544. private void onClickAnterior() throws SQLException, IOException, InterruptedException {
  545. nifLocaliza.setText("");
  546. if (registoAtual != 0) {
  547. getValores(--registoAtual);
  548. }
  549. nifLocaliza.setText("");
  550. }
  551.  
  552. private void limparcampos() {
  553. nomee.setText("");
  554. dadospw.setText("");
  555. dadosemail.setText("");
  556. nifLocaliza.setText("");
  557. txttipo.setSelectedIndex(0);
  558.  
  559. }
  560.  
  561. void redimencionaImagem(JButton label, String directoria, String nomeFoto,int comprimento, int altura){
  562. label.setIcon(new ImageIcon(new ImageIcon(FormProdutos.class.getResource("/Imagens/"+directoria+"/"+nomeFoto)).getImage().getScaledInstance(comprimento, altura, Image.SCALE_DEFAULT)));
  563. }
  564.  
  565. void redimencionaImagemLabel(JLabel label, String directoria, String nomeFoto,int comprimento, int altura){
  566. label.setIcon(new ImageIcon(new ImageIcon(FormProdutos.class.getResource("/Imagens/"+directoria+"/"+nomeFoto)).getImage().getScaledInstance(comprimento, altura, Image.SCALE_DEFAULT)));
  567. }
  568.  
  569. /*void guardarclientes() throws NumberFormatException, SQLException, IOException, InterruptedException, ParseException {
  570. op.guardarclientes(nomee.getText(), dadosdatanascimento.getText(), Integer.parseInt(dadostelefone.getText()), Integer.parseInt(dadostelemovel.getText()), dadosmorada.getText(), dadoslocalidade.getText(), dadoscodigopostal.getText(), Integer.parseInt(dadosnif.getText()), dadosemail.getText(), dadosnacionalidade.getText(), dadosfoto.getText());
  571.  
  572. }
  573. */
  574.  
  575. public static void main(String[] args) {
  576. // TODO Auto-generated method stub
  577. FormLogin janela = new FormLogin(tipo);
  578. janela.setVisible(true);
  579. JDClock relogio = new JDClock(new Dimension(300, 75), 5, 10, new Color(255,127,80), Color.WHITE, new Color(255,127,80));
  580. relogio.setLocation(5, 5);
  581. janela.painelrelogio.add(relogio);
  582.  
  583. }
  584. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement