-
Notifications
You must be signed in to change notification settings - Fork 0
/
Base.java
executable file
·53 lines (48 loc) · 1.91 KB
/
Base.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import javax.swing.*;
import java.awt.*;
import java.sql.ResultSet;
abstract class Base extends JPanel {
// Абстрактный класс, описывающий общее поведения для всех страниц приложения
JFrame frame;
public Base(JFrame frame){
this.setLayout(null);
this.frame = frame;
settingNameLabel();
settingMenuButton();
settingAdminButton();
}
protected JLabel name = new JLabel("Древний Рим");
protected JButton menu_but = new JButton("Меню");
protected JButton admin_but = new JButton("Администратор");
protected void settingNameLabel(){
// Стилизация надписи "Древний Рим"
this.add(name);
name.setBounds(30, 30, 100, 25);
name.setForeground(Color.WHITE);
}
protected void settingAdminButton(){
// базовая стилизация кнопки "Администратор"
this.add(admin_but);
Dimension admin_size = new Dimension(170, 40);
admin_but.setBounds(450, 20, admin_size.width, admin_size.height);
admin_but.setForeground(Color.WHITE);
}
protected void settingMenuButton(){
// Базовая стилизация кнопки "Меню"
this.add(menu_but);
Dimension menu_size = new Dimension(130, 40);
menu_but.setBounds(250, 20, menu_size.width, menu_size.height);
menu_but.setForeground(Color.WHITE);
}
protected ResultSet getData(String query){
// Получение данных при помощи SQL
SqlConnection sqlConn = new SqlConnection();
ResultSet rs = sqlConn.getData(query);
return rs;
}
public void paintComponent(Graphics g){
// background для панели меню
g.setColor(Color.decode("#DC143C"));
g.fillRect(0, 0, 800, 80);
}
}