-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
104 lines (85 loc) · 3.14 KB
/
Main.java
File metadata and controls
104 lines (85 loc) · 3.14 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package HotelDemo;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import HotelDemo.BackgroundPaneldemo;
import java.io.File;
import javax.imageio.ImageIO;
import java.io.IOException;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Button;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Main extends JFrame {
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Main frame = new Main();
frame.setVisible(true);
frame.setSize(1400,1200);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public Main() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(00, 00, 1327, 1107);
BackgroundPaneldemo contentPane = new BackgroundPaneldemo("C:\\Users\\randa\\second_year_B29\\DataBaseDemo\\src\\HotelDemo\\wbg.png");
contentPane.setForeground(new Color(255, 255, 255));
contentPane.setBackground(new Color(255, 255, 255));
contentPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("Taj Restaurant");
lblNewLabel.setToolTipText("welcome...!!");
lblNewLabel.setForeground(new Color(255, 255, 255));
lblNewLabel.setFont(new Font("Times New Roman", Font.ITALIC, 45));
lblNewLabel.setBounds(485, 153, 538, 77);
contentPane.add(lblNewLabel);
JLabel lblNewLabel1 = new JLabel("Find the best restaurants, cafes and bars in India");
lblNewLabel1.setForeground(new Color(255, 255, 255));
lblNewLabel1.setFont(new Font("Times New Roman", Font.ITALIC, 30));
lblNewLabel1.setBounds(357, 276, 767, 41);
contentPane.add(lblNewLabel1);
JButton button = new JButton("Next");
button.setBackground(new Color(128, 64, 64));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
HomeDemo ld=new HomeDemo();
ld.setVisible(true);
ld.setSize(1400,1200);
}
});
button.setFont(new Font("Times New Roman", Font.ITALIC, 30));
button.setBounds(989, 588, 234, 60);
button.setForeground(new Color(255, 255, 255));
button.setForeground(new Color(255, 255, 255));
contentPane.add(button);
}
}
class BackgroundPaneldemo extends JPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
private Image backgroundImage;
public BackgroundPaneldemo(String imagePath) {
try {
backgroundImage = ImageIO.read(new File(imagePath));
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(backgroundImage, 0, 0, getWidth(), getHeight(), null);
}
}