Advertisement
sergAccount

Untitled

Jan 23rd, 2021
870
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package javaapplication21;
  7.  
  8. import javax.swing.JFrame;
  9. import javax.swing.JPanel;
  10.  
  11. public class Okno extends JFrame{
  12.     // конструктор класса
  13.     public Okno(){
  14.         // setTitle - задаем заголовок главного окна
  15.         setTitle("Square Test!");
  16.         // setBounds - установим размеры и коорд x, y - расположения окна на экране
  17.         setBounds(10, 10, 800, 600);    
  18.         getContentPane().add(createPanel());
  19.         // для правильного закрытия окна используем
  20.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  21.         setVisible(true); // отображаем окно на экране
  22.     }
  23.     // метод для создания панели (JPanel - используется для вывода графики и элементов управления)
  24.     public JPanel createPanel(){
  25.         JPanel p = new JPanel();
  26.         return p;
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement