Advertisement
Guest User

jframe

a guest
Jul 29th, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. public void doWindow() {
  2.  
  3. JPanel panel1 = new JPanel(); //janela principal
  4. JPanel panel2 = new JPanel(); //janela configurações
  5. panel1.setLayout(new FlowLayout());
  6.  
  7. //janela principal
  8. JFrame mainFrame = new JFrame("Scheduler");
  9. mainFrame.setSize(800, 550);
  10. mainFrame.setLocationRelativeTo(null);
  11. mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  12.  
  13. mainFrame.add(panel1);
  14.  
  15. //Botoes
  16.  
  17. //Botao1
  18. JButton button1 = new JButton("Nova configuração");
  19. panel1.setLayout(null);
  20. button1.setBounds(300,100,200,60);
  21. panel1.add(button1);
  22. mainFrame.setVisible(true);
  23. button1.addActionListener(new ActionListener() {
  24.  
  25. //janela de configuração
  26. public void actionPerformed(ActionEvent e) {
  27. JFrame configFrame = new JFrame("Configurações");
  28. configFrame.setSize(800, 550);
  29. configFrame.setLocationRelativeTo(null);
  30. configFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  31. configFrame.add(panel2);
  32. mainFrame.setVisible(false);
  33. configFrame.setVisible(true);
  34.  
  35. panel2.setLayout(null);
  36.  
  37. //Campo1
  38. JLabel label1 = new JLabel("Nome da application pool");
  39. label1.setBounds(10, 50, 270, 25);
  40. label1.setHorizontalAlignment(JLabel.RIGHT);
  41. panel2.add(label1);
  42.  
  43. //Campo1.1
  44. JTextField field1 = new JTextField();
  45. field1.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
  46. field1.setBorder(BorderFactory.createLoweredSoftBevelBorder());
  47. field1.setEditable(false);
  48. field1.setBounds(350,50,350,25);
  49. field1.setEditable(true);
  50. panel2.add(field1);
  51.  
  52. //Campo2
  53. JLabel label2 = new JLabel("Envio de aviso automático");
  54. label2.setBounds(10, 100, 270, 25);
  55. label2.setHorizontalAlignment(JLabel.RIGHT);
  56. panel2.add(label2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement