Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VendingMachine_Thomas_Barraclough_Resit
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
thomas.barraclough
VendingMachine_Thomas_Barraclough_Resit
Commits
96e2943e
Commit
96e2943e
authored
Jan 13, 2020
by
Tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upload
parents
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
175 additions
and
0 deletions
+175
-0
.classpath
.classpath
+6
-0
.gitignore
.gitignore
+1
-0
.project
.project
+17
-0
org.eclipse.jdt.core.prefs
.settings/org.eclipse.jdt.core.prefs
+11
-0
VendingMachineClass.java
src/VendingMachineClass.java
+140
-0
No files found.
.classpath
0 → 100644
View file @
96e2943e
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"
/>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
.gitignore
0 → 100644
View file @
96e2943e
/bin/
.project
0 → 100644
View file @
96e2943e
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
VendingMachine_Thomas_Barraclough
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jdt.core.javanature
</nature>
</natures>
</projectDescription>
.settings/org.eclipse.jdt.core.prefs
0 → 100644
View file @
96e2943e
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
src/VendingMachineClass.java
0 → 100644
View file @
96e2943e
public
class
VendingMachineClass
extends
javax
.
swing
.
JFrame
{
public
VendingMachineClass
()
{
initComponents
();
}
private
void
initComponents
()
{
//setting up a bunch of string variables, these are all for the items.
String
chocolate
=
"Chocolate"
;
String
water
=
"Water"
;
String
hot_drink
=
"Hot Drink"
;
String
snack
=
"Snack"
;
String
sweet
=
"Sweet"
;
jComboBox1
=
new
javax
.
swing
.
JComboBox
<>();
jScrollPane1
=
new
javax
.
swing
.
JScrollPane
();
jTextArea1
=
new
javax
.
swing
.
JTextArea
();
jTextField1
=
new
javax
.
swing
.
JTextField
();
jLabel1
=
new
javax
.
swing
.
JLabel
();
jTextField2
=
new
javax
.
swing
.
JTextField
();
jButton1
=
new
javax
.
swing
.
JButton
();
jTextField3
=
new
javax
.
swing
.
JTextField
();
jButton2
=
new
javax
.
swing
.
JButton
();
jButton3
=
new
javax
.
swing
.
JButton
();
setDefaultCloseOperation
(
javax
.
swing
.
WindowConstants
.
EXIT_ON_CLOSE
);
jComboBox1
.
setModel
(
new
javax
.
swing
.
DefaultComboBoxModel
<>(
new
String
[]
{
chocolate
,
water
,
hot_drink
,
snack
,
sweet
}));
jTextArea1
.
setColumns
(
20
);
jTextArea1
.
setRows
(
5
);
jScrollPane1
.
setViewportView
(
jTextArea1
);
jLabel1
.
setText
(
"Selected Item"
);
jButton1
.
setText
(
"Money Out"
);
jButton2
.
setText
(
"Money In"
);
jButton3
.
setText
(
"Add"
);
javax
.
swing
.
GroupLayout
layout
=
new
javax
.
swing
.
GroupLayout
(
getContentPane
());
getContentPane
().
setLayout
(
layout
);
layout
.
setHorizontalGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addContainerGap
()
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
,
false
)
.
addComponent
(
jScrollPane1
)
.
addComponent
(
jComboBox1
,
0
,
javax
.
swing
.
GroupLayout
.
DEFAULT_SIZE
,
Short
.
MAX_VALUE
))
.
addGap
(
69
,
69
,
69
)
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addComponent
(
jTextField1
)
.
addComponent
(
jTextField2
)
.
addComponent
(
jTextField3
)
.
addComponent
(
jButton3
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addComponent
(
jLabel1
)
.
addComponent
(
jButton1
)
.
addComponent
(
jButton2
))
.
addGap
(
0
,
48
,
Short
.
MAX_VALUE
)))
.
addContainerGap
())
);
layout
.
setVerticalGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addContainerGap
()
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
TRAILING
,
false
)
.
addComponent
(
jComboBox1
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
50
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addComponent
(
jLabel1
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
,
javax
.
swing
.
GroupLayout
.
DEFAULT_SIZE
,
Short
.
MAX_VALUE
)
.
addComponent
(
jTextField1
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
30
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)))
.
addComponent
(
jButton3
)
.
addGap
(
18
,
18
,
18
)
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addComponent
(
jScrollPane1
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addGap
(
0
,
41
,
Short
.
MAX_VALUE
)
.
addComponent
(
jButton2
)
.
addGap
(
18
,
18
,
18
)
.
addComponent
(
jTextField3
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
35
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addGap
(
18
,
18
,
18
)
.
addComponent
(
jButton1
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addComponent
(
jTextField2
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
34
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)))
.
addContainerGap
())
);
pack
();
}
public
static
void
main
(
String
args
[])
{
try
{
for
(
javax
.
swing
.
UIManager
.
LookAndFeelInfo
info
:
javax
.
swing
.
UIManager
.
getInstalledLookAndFeels
())
{
if
(
"Nimbus"
.
equals
(
info
.
getName
()))
{
javax
.
swing
.
UIManager
.
setLookAndFeel
(
info
.
getClassName
());
break
;
}
}
}
catch
(
ClassNotFoundException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
VendingMachineClass
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
InstantiationException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
VendingMachineClass
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
IllegalAccessException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
VendingMachineClass
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
javax
.
swing
.
UnsupportedLookAndFeelException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
VendingMachineClass
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
java
.
awt
.
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
new
VendingMachineClass
().
setVisible
(
true
);
}
});
}
private
javax
.
swing
.
JButton
jButton1
;
private
javax
.
swing
.
JButton
jButton2
;
private
javax
.
swing
.
JButton
jButton3
;
private
javax
.
swing
.
JComboBox
<
String
>
jComboBox1
;
private
javax
.
swing
.
JLabel
jLabel1
;
private
javax
.
swing
.
JScrollPane
jScrollPane1
;
private
javax
.
swing
.
JTextArea
jTextArea1
;
private
javax
.
swing
.
JTextField
jTextField1
;
private
javax
.
swing
.
JTextField
jTextField2
;
private
javax
.
swing
.
JTextField
jTextField3
;
}
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