Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VendingMachine_Robert_Sharp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
robert.sharp
VendingMachine_Robert_Sharp
Commits
b5bd852d
Commit
b5bd852d
authored
Jan 08, 2020
by
robert.sharp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finalised the quantity selector.
parent
c24c9af2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
temp.java
src/main/java/temp.java
+7
-2
No files found.
src/main/java/temp.java
View file @
b5bd852d
...
...
@@ -94,7 +94,7 @@ public class temp extends javax.swing.JFrame {
quantLabelchange
.
setText
(
"Selected quantity:"
);
quantBox
.
setModel
(
new
javax
.
swing
.
DefaultComboBoxModel
<>(
new
String
[]
{
"1"
,
"2"
,
"3"
,
"4"
,
"5"
}));
quantBox
.
setModel
(
new
javax
.
swing
.
DefaultComboBoxModel
<>(
new
String
[]
{
"
Select a value"
,
"
1"
,
"2"
,
"3"
,
"4"
,
"5"
}));
quantBox
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
quantBoxActionPerformed
(
evt
);
...
...
@@ -306,7 +306,12 @@ public class temp extends javax.swing.JFrame {
private
void
quantBoxActionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
// TODO add your handling code here:
findItem
();
quant
=
Double
.
parseDouble
(
quantBox
.
getSelectedItem
().
toString
())
/
2
;
if
(
quantBox
.
getSelectedItem
().
toString
()==
"Select a value"
){
error
.
setText
(
"Please select an quantity;"
);
}
else
{
quant
=
Double
.
parseDouble
(
quantBox
.
getSelectedItem
().
toString
())
/
2
;
}
//find the slected item and convet it into a double
quantLabelchange
.
setText
(
"Selected quantity: "
+(
quant
*
2
));
//update the display to show the quanity of item
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment