-
Notifications
You must be signed in to change notification settings - Fork 2
/
EnterOtherOptions.java
executable file
·135 lines (105 loc) · 4.38 KB
/
EnterOtherOptions.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* EnterOtherOptions.java
*
*/
/**
*
* @author arunprasath shankar
*/
public class EnterOtherOptions extends WizardPanel {
private int quality;
private String comment,password;
/** Creates new form EnterOtherOptions */
public EnterOtherOptions(String display) {
super(display);
initComponents();
setFirstFocusable(passwordField);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
passwordPanel = new javax.swing.JPanel();
passwordLabel = new javax.swing.JLabel();
passwordField = new javax.swing.JPasswordField();
commentPanel = new javax.swing.JPanel();
commentLabel = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
commentTextArea = new javax.swing.JTextArea();
qualityPanel = new javax.swing.JPanel();
qualityLabel = new javax.swing.JLabel();
qualitySlider = new javax.swing.JSlider();
setLayout(new java.awt.BorderLayout());
passwordPanel.setLayout(new javax.swing.BoxLayout(passwordPanel, javax.swing.BoxLayout.X_AXIS));
passwordLabel.setText(" Password ");
passwordPanel.add(passwordLabel);
passwordPanel.add(passwordField);
add(passwordPanel, java.awt.BorderLayout.NORTH);
commentPanel.setLayout(new javax.swing.BoxLayout(commentPanel, javax.swing.BoxLayout.X_AXIS));
commentLabel.setText(" Comment ");
commentLabel.setMaximumSize(new java.awt.Dimension(58, 16));
commentLabel.setMinimumSize(new java.awt.Dimension(58, 16));
commentPanel.add(commentLabel);
jScrollPane1.setViewportView(commentTextArea);
commentPanel.add(jScrollPane1);
add(commentPanel, java.awt.BorderLayout.CENTER);
qualityPanel.setLayout(new javax.swing.BoxLayout(qualityPanel, javax.swing.BoxLayout.X_AXIS));
qualityLabel.setText(" Quality ");
qualityLabel.setMaximumSize(new java.awt.Dimension(58, 16));
qualityLabel.setMinimumSize(new java.awt.Dimension(58, 16));
qualityPanel.add(qualityLabel);
qualitySlider.setMajorTickSpacing(10);
qualitySlider.setMinorTickSpacing(1);
qualitySlider.setPaintLabels(true);
qualitySlider.setPaintTicks(true);
qualitySlider.setSnapToTicks(true);
qualitySlider.setValue(80);
qualityPanel.add(qualitySlider);
add(qualityPanel, java.awt.BorderLayout.SOUTH);
}//GEN-END:initComponents
public boolean doValidation() {
password = new String(passwordField.getPassword());
quality = qualitySlider.getValue();
comment = commentTextArea.getText();
if( password.trim().length() == 0 ){
javax.swing.JOptionPane.showMessageDialog(this,"Enter a password/phrase");
passwordField.requestFocus();
return false;
}else if( quality < 40 ){
javax.swing.JOptionPane.showMessageDialog(this,"Warning! Lower quality values will distort the image");
}
return true;
}
/** Getter for property comment.
* @return Value of property comment.
*/
public java.lang.String getComment() {
return comment;
}
/** Getter for property password.
* @return Value of property password.
*/
public java.lang.String getPassword() {
return password;
}
/** Getter for property quality.
* @return Value of property quality.
*/
public int getQuality() {
return quality;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel qualityLabel;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPanel passwordPanel;
private javax.swing.JPanel commentPanel;
private javax.swing.JPasswordField passwordField;
private javax.swing.JTextArea commentTextArea;
private javax.swing.JLabel passwordLabel;
private javax.swing.JLabel commentLabel;
private javax.swing.JPanel qualityPanel;
private javax.swing.JSlider qualitySlider;
// End of variables declaration//GEN-END:variables
}