Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Test;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JTextField;
- import java.awt.BorderLayout;
- import javax.swing.SwingConstants;
- import javax.swing.JLabel;
- import javax.swing.JComboBox;
- import java.awt.Font;
- import javax.swing.JPanel;
- import javax.swing.border.BevelBorder;
- import java.awt.Color;
- import javax.swing.JButton;
- import javax.swing.UIManager;
- import java.awt.SystemColor;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- public class GUI {
- private JFrame frame;
- private JTextField textFieldCountN;
- private JTextField textFieldCountMoves;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- GUI window = new GUI();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public GUI() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.getContentPane().setBackground(new Color(255, 245, 238));
- frame.setBounds(100, 100, 750, 423);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- textFieldCountN = new JTextField();
- textFieldCountN.setBounds(32, 12, 56, 20);
- frame.getContentPane().add(textFieldCountN);
- textFieldCountN.setColumns(10);
- JLabel labelCountN = new JLabel("N:");
- labelCountN.setFont(new Font("Times New Roman", Font.PLAIN, 14));
- labelCountN.setBounds(10, 14, 46, 14);
- frame.getContentPane().add(labelCountN);
- JLabel labelCountMoves = new JLabel("Количество ходов:");
- labelCountMoves.setFont(new Font("Times New Roman", Font.PLAIN, 14));
- labelCountMoves.setBounds(111, 14, 128, 14);
- frame.getContentPane().add(labelCountMoves);
- textFieldCountMoves = new JTextField();
- textFieldCountMoves.setBounds(249, 12, 56, 20);
- frame.getContentPane().add(textFieldCountMoves);
- textFieldCountMoves.setColumns(10);
- JComboBox comboBoxHeuristic = new JComboBox();
- comboBoxHeuristic.setForeground(new Color(0, 0, 0));
- comboBoxHeuristic.setBackground(new Color(240, 255, 240));
- comboBoxHeuristic.setFont(new Font("Times New Roman", Font.PLAIN, 14));
- comboBoxHeuristic.setBounds(538, 11, 186, 20);
- frame.getContentPane().add(comboBoxHeuristic);
- comboBoxHeuristic.addItem("Хэмминг");
- comboBoxHeuristic.addItem("Манхеттен без лин.конф.");
- comboBoxHeuristic.addItem("Манхеттен с лин.конф.");
- comboBoxHeuristic.addItem("Эвклид");
- JLabel labelHeuristic = new JLabel("Эвристика:");
- labelHeuristic.setFont(new Font("Times New Roman", Font.PLAIN, 14));
- labelHeuristic.setBounds(453, 14, 75, 14);
- //labelHeuristic.setEditable(true);
- frame.getContentPane().add(labelHeuristic);
- JPanel panelAssembly = new JPanel();
- panelAssembly.setBackground(new Color(255, 255, 255));
- panelAssembly.setBorder(new BevelBorder(BevelBorder.LOWERED, new Color(255, 0, 0), SystemColor.menu, null, null));
- panelAssembly.setBounds(10, 69, 714, 304);
- ///////////////////////////
- Assembly panel = new Assembly(4, 14);
- panel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
- panel.setBounds(10, 69, 714, 304);
- frame.getContentPane().add(panel);
- //////////////////////////
- frame.getContentPane().add(panelAssembly);
- JButton buttonAssembly = new JButton("Собрать");
- buttonAssembly.setFont(new Font("Times New Roman", Font.PLAIN, 14));
- buttonAssembly.setBounds(596, 42, 128, 23);
- frame.getContentPane().add(buttonAssembly);
- JButton buttonGenerate = new JButton("Сгенерировать");
- buttonGenerate.setFont(new Font("Times New Roman", Font.PLAIN, 14));
- buttonGenerate.setBounds(453, 42, 128, 23);
- frame.getContentPane().add(buttonGenerate);
- JButton button = new JButton("New button");
- button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- panel.repaint();
- //panelAssembly.add(panel);
- }
- });
- button.setBounds(234, 39, 89, 23);
- frame.getContentPane().add(button);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement