Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5.  
  6.  
  7. public class CodeGenerator {
  8.  
  9. private JFrame f;
  10. private JPanel p;
  11. private JPanel p2;
  12. private JPanel p3;
  13. private JButton butt;
  14. private JLabel lab;
  15.  
  16. public CodeGenerator() {
  17. gui();
  18. }
  19.  
  20. public void gui() {
  21. f = new JFrame ("Code generator");
  22. f.setVisible(true);
  23. f.setSize(600,400);
  24. f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  25.  
  26. p = new JPanel();
  27. p.setBackground(Color.WHITE);
  28.  
  29. p2 = new JPanel();
  30. p2.setBackground(Color.DARK_GRAY);
  31.  
  32.  
  33. butt = new JButton("Generate");
  34. butt.addActionListener(new ActionListener() {
  35. public void actionPerformed(ActionEvent e) {
  36.  
  37. CodeAlgorythm codegen = new CodeAlgorythm();
  38. codegen.generateCode();
  39. //The code over here is the code generator
  40. }
  41. });
  42.  
  43. lab = new JLabel("This program is designed to generate random codes
  44. to help you protect your datas.");
  45.  
  46.  
  47. p2.add(butt);
  48.  
  49. p.add(lab);
  50.  
  51. f.add(p,BorderLayout.CENTER);
  52.  
  53. f.add(p2,BorderLayout.SOUTH);
  54. //Up there is all the GUI stuff
  55.  
  56. }
  57.  
  58. public static void main(String[] args) {
  59. // TODO Auto-generated method stub
  60. new CodeGenerator();
  61.  
  62. }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement