-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpanelDlSuccess.java
114 lines (102 loc) · 4.12 KB
/
panelDlSuccess.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
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
105
106
107
108
109
110
111
112
113
114
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
public class panelDlSuccess extends JPanel{
JLabel lblGreat;
JLabel lblSuccessfulMsg ;
JLabel lblContinueMsg ;
JButton btnYes ;
JButton btnNo ;
public panelDlSuccess() {
if (vkClient.fromServer.equalsIgnoreCase(vkClient.errorMessage[0]) || vkClient.fromServer.equalsIgnoreCase(vkClient.errorMessage[1]) || vkClient.fromServer.equalsIgnoreCase(vkClient.errorMessage[2])){
JOptionPane.showMessageDialog(null, vkClient.fromServer, "Server message", JOptionPane.INFORMATION_MESSAGE);
System.exit(1);
}
lblGreat = new JLabel();
lblGreat.setText("Great ! ");
lblGreat.setFont(new Font("Avenir Next", 0, 50));
lblSuccessfulMsg = new JLabel();
lblSuccessfulMsg.setText("You have successfully downloaded.");
lblSuccessfulMsg.setFont(new Font("Avenir Next", 0, 20));
lblContinueMsg = new JLabel();
lblContinueMsg.setText("Do you want to continue ? ");
lblContinueMsg.setFont(new Font("Avenir Next", 0, 20));
btnYes = new JButton();
btnYes.setText("YES");
btnYes.setFont(new Font("Avenir Next", 1, 14));
btnYes.setCursor(new Cursor(Cursor.HAND_CURSOR));
btnYes.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent eventBtnYes)
{btnYesActionPerformed(eventBtnYes);}
});
btnNo = new JButton();
btnNo.setText("NO");
btnNo.setFont(new Font("Avenir Next", 1, 14));
btnNo.setCursor(new Cursor(Cursor.HAND_CURSOR));
btnNo.addActionListener(
new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent eventBtnNo)
{btnNoActionPerformed(eventBtnNo);}
});
add(lblGreat);
add(lblSuccessfulMsg);
add(lblContinueMsg);
add(btnYes);
add(btnNo);
GroupLayout glDlSuccess = new GroupLayout(this);
glDlSuccess.setAutoCreateContainerGaps(true);
glDlSuccess.setHorizontalGroup(
glDlSuccess.createSequentialGroup()
.addGap(206,206,206)
.addGroup(
glDlSuccess.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(
glDlSuccess.createSequentialGroup()
.addGap(100,100,100)
.addComponent(lblGreat))
.addGroup(
glDlSuccess.createSequentialGroup()
.addGap(20,20,20)
.addComponent(lblSuccessfulMsg))
.addGroup(
glDlSuccess.createSequentialGroup()
.addGap(60,60,60)
.addComponent(lblContinueMsg))
.addGroup(
glDlSuccess.createSequentialGroup()
.addGap(60,60,60)
.addComponent(btnYes, GroupLayout.PREFERRED_SIZE, 100,GroupLayout.PREFERRED_SIZE)
.addGap(10,10,10)
.addComponent(btnNo, GroupLayout.PREFERRED_SIZE, 100,GroupLayout.PREFERRED_SIZE)
))
); //end of setHorizontalGroup
glDlSuccess.setVerticalGroup(
glDlSuccess.createSequentialGroup()
.addGap(90, 90, 90)
.addComponent(lblGreat)
.addGap(40, 40, 40)
.addComponent(lblSuccessfulMsg)
.addGap(60, 60, 60)
.addComponent(lblContinueMsg)
.addGap(30, 30, 30)
.addGroup(
glDlSuccess.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(btnYes, GroupLayout.PREFERRED_SIZE, 40,GroupLayout.PREFERRED_SIZE)
.addComponent(btnNo, GroupLayout.PREFERRED_SIZE, 40,GroupLayout.PREFERRED_SIZE)
)); //end of setVerticalGroup
setLayout(glDlSuccess);
setVisible(true);
setBackground(Color.decode("#FFFFFF"));
} //end of panelDlSuccess's constructor
private void btnYesActionPerformed(java.awt.event.ActionEvent eventBtnYes){
//Write the code for Yes button. Perform action proceed to panelResources.
vkClient.sendUserInput(1,4);
}
private void btnNoActionPerformed(java.awt.event.ActionEvent eventBtnNo){
vkClient.sendUserInput(0,4);
ImageIcon bye = new ImageIcon(panelDlSuccess.class.getResource("/bye.png"));
JOptionPane.showMessageDialog(null, vkClient.fromServer, "Server message", JOptionPane.INFORMATION_MESSAGE,bye);
System.exit(0);
}
}