Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. package Test;
  2.  
  3. import java.awt.EventQueue;
  4.  
  5. import javax.swing.JFrame;
  6. import javax.swing.JTextField;
  7. import java.awt.BorderLayout;
  8. import javax.swing.SwingConstants;
  9. import javax.swing.JLabel;
  10. import javax.swing.JComboBox;
  11. import java.awt.Font;
  12. import javax.swing.JPanel;
  13. import javax.swing.border.BevelBorder;
  14. import java.awt.Color;
  15. import javax.swing.JButton;
  16. import javax.swing.UIManager;
  17. import java.awt.SystemColor;
  18. import java.awt.event.ActionListener;
  19. import java.awt.event.ActionEvent;
  20.  
  21. public class GUI {
  22.  
  23. private JFrame frame;
  24. private JTextField textFieldCountN;
  25. private JTextField textFieldCountMoves;
  26.  
  27. /**
  28. * Launch the application.
  29. */
  30. public static void main(String[] args) {
  31. EventQueue.invokeLater(new Runnable() {
  32. public void run() {
  33. try {
  34. GUI window = new GUI();
  35. window.frame.setVisible(true);
  36. } catch (Exception e) {
  37. e.printStackTrace();
  38. }
  39. }
  40. });
  41. }
  42.  
  43. /**
  44. * Create the application.
  45. */
  46. public GUI() {
  47. initialize();
  48. }
  49.  
  50. /**
  51. * Initialize the contents of the frame.
  52. */
  53. private void initialize() {
  54. frame = new JFrame();
  55. frame.getContentPane().setBackground(new Color(255, 245, 238));
  56. frame.setBounds(100, 100, 750, 423);
  57. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  58. frame.getContentPane().setLayout(null);
  59.  
  60. textFieldCountN = new JTextField();
  61. textFieldCountN.setBounds(32, 12, 56, 20);
  62. frame.getContentPane().add(textFieldCountN);
  63. textFieldCountN.setColumns(10);
  64.  
  65. JLabel labelCountN = new JLabel("N:");
  66. labelCountN.setFont(new Font("Times New Roman", Font.PLAIN, 14));
  67. labelCountN.setBounds(10, 14, 46, 14);
  68. frame.getContentPane().add(labelCountN);
  69.  
  70. JLabel labelCountMoves = new JLabel("Количество ходов:");
  71. labelCountMoves.setFont(new Font("Times New Roman", Font.PLAIN, 14));
  72. labelCountMoves.setBounds(111, 14, 128, 14);
  73. frame.getContentPane().add(labelCountMoves);
  74.  
  75. textFieldCountMoves = new JTextField();
  76. textFieldCountMoves.setBounds(249, 12, 56, 20);
  77. frame.getContentPane().add(textFieldCountMoves);
  78. textFieldCountMoves.setColumns(10);
  79.  
  80. JComboBox comboBoxHeuristic = new JComboBox();
  81. comboBoxHeuristic.setForeground(new Color(0, 0, 0));
  82. comboBoxHeuristic.setBackground(new Color(240, 255, 240));
  83. comboBoxHeuristic.setFont(new Font("Times New Roman", Font.PLAIN, 14));
  84. comboBoxHeuristic.setBounds(538, 11, 186, 20);
  85. frame.getContentPane().add(comboBoxHeuristic);
  86. comboBoxHeuristic.addItem("Хэмминг");
  87. comboBoxHeuristic.addItem("Манхеттен без лин.конф.");
  88. comboBoxHeuristic.addItem("Манхеттен с лин.конф.");
  89. comboBoxHeuristic.addItem("Эвклид");
  90.  
  91. JLabel labelHeuristic = new JLabel("Эвристика:");
  92. labelHeuristic.setFont(new Font("Times New Roman", Font.PLAIN, 14));
  93. labelHeuristic.setBounds(453, 14, 75, 14);
  94. //labelHeuristic.setEditable(true);
  95.  
  96. frame.getContentPane().add(labelHeuristic);
  97.  
  98. JPanel panelAssembly = new JPanel();
  99. panelAssembly.setBackground(new Color(255, 255, 255));
  100. panelAssembly.setBorder(new BevelBorder(BevelBorder.LOWERED, new Color(255, 0, 0), SystemColor.menu, null, null));
  101. panelAssembly.setBounds(10, 69, 714, 304);
  102. ///////////////////////////
  103. Assembly panel = new Assembly(4, 14);
  104. panel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
  105. panel.setBounds(10, 69, 714, 304);
  106. frame.getContentPane().add(panel);
  107. //////////////////////////
  108. frame.getContentPane().add(panelAssembly);
  109.  
  110.  
  111.  
  112.  
  113. JButton buttonAssembly = new JButton("Собрать");
  114. buttonAssembly.setFont(new Font("Times New Roman", Font.PLAIN, 14));
  115. buttonAssembly.setBounds(596, 42, 128, 23);
  116. frame.getContentPane().add(buttonAssembly);
  117.  
  118. JButton buttonGenerate = new JButton("Сгенерировать");
  119. buttonGenerate.setFont(new Font("Times New Roman", Font.PLAIN, 14));
  120. buttonGenerate.setBounds(453, 42, 128, 23);
  121. frame.getContentPane().add(buttonGenerate);
  122.  
  123. JButton button = new JButton("New button");
  124. button.addActionListener(new ActionListener() {
  125. public void actionPerformed(ActionEvent arg0) {
  126. panel.repaint();
  127. //panelAssembly.add(panel);
  128. }
  129. });
  130. button.setBounds(234, 39, 89, 23);
  131. frame.getContentPane().add(button);
  132.  
  133.  
  134. }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement