directory structure change, organize by class number as opposed to mod number
Signed-off-by: Amrit Panesar <apanesar@4195tech.com>
This commit is contained in:
1 parent
2a3d6fc042
commit
8683384387
480 files changed
+7
No files matched your search
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="Final" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project Final.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Final-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
========================
|
||||
BUILD OUTPUT DESCRIPTION
|
||||
========================
|
||||
|
||||
When you build an Java application project that has a main class, the IDE
|
||||
automatically copies all of the JAR
|
||||
files on the projects classpath to your projects dist/lib folder. The IDE
|
||||
also adds each of the JAR files to the Class-Path element in the application
|
||||
JAR files manifest file (MANIFEST.MF).
|
||||
|
||||
To run the project from the command line, go to the dist folder and
|
||||
type the following:
|
||||
|
||||
java -jar "Final.jar"
|
||||
|
||||
To distribute this project, zip up the dist folder (including the lib folder)
|
||||
and distribute the ZIP file.
|
||||
|
||||
Notes:
|
||||
|
||||
* If two JAR files on the project classpath have the same name, only the first
|
||||
JAR file is copied to the lib folder.
|
||||
* Only JAR files are copied to the lib folder.
|
||||
If the classpath contains other types of files or folders, these files (folders)
|
||||
are not copied.
|
||||
* If a library on the projects classpath also has a Class-Path element
|
||||
specified in the manifest,the content of the Class-Path element has to be on
|
||||
the projects runtime path.
|
||||
* To set a main class in a standard Java project, right-click the project node
|
||||
in the Projects window and choose Properties. Then click Run and enter the
|
||||
class name in the Main Class field. Alternatively, you can manually type the
|
||||
class name in the manifest Main-Class element.
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=ea3a74df
|
||||
build.xml.script.CRC32=331d2308
|
||||
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=ea3a74df
|
||||
nbproject/build-impl.xml.script.CRC32=e27e7850
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Documents and Settings\\77260\\Application Data\\NetBeans\\7.2\\build.properties
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -0,0 +1,71 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Final.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=pkgfinal.Final
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Final</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package pkgfinal;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class Final extends JPanel implements Runnable {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
private static int count = 2;
|
||||
|
||||
private Thread runThread;
|
||||
|
||||
private JTextField symbolTF;
|
||||
private JTextField symbolALRM;
|
||||
private JPanel innerStackP = new JPanel();
|
||||
public Final() {
|
||||
symbolTF = new JTextField();
|
||||
symbolTF.setEditable(false);
|
||||
symbolTF.setFont(new Font("Monospaced", Font.BOLD, 26));
|
||||
symbolTF.setHorizontalAlignment(JTextField.CENTER);
|
||||
|
||||
final JButton suspendB = new JButton("Suspend");
|
||||
final JButton resumeB = new JButton("Resume");
|
||||
|
||||
suspendB.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
suspendNow();
|
||||
}
|
||||
});
|
||||
|
||||
resumeB.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
resumeNow();
|
||||
}
|
||||
});
|
||||
symbolALRM = new JTextField();
|
||||
symbolALRM.setText("ALARM");
|
||||
symbolALRM.setEditable(false);
|
||||
symbolALRM.setFont(new Font("Monospaced", Font.BOLD, 26));
|
||||
symbolALRM.setForeground(Color.red);
|
||||
symbolALRM.setHorizontalAlignment(JTextField.CENTER);
|
||||
|
||||
innerStackP.setLayout(new GridLayout(0, 1, 3, 3));
|
||||
innerStackP.add(symbolTF);
|
||||
innerStackP.add(suspendB);
|
||||
innerStackP.add(resumeB);
|
||||
|
||||
this.setLayout(new FlowLayout(FlowLayout.CENTER));
|
||||
this.add(innerStackP);
|
||||
}
|
||||
|
||||
private void suspendNow() {
|
||||
if (runThread != null) { // avoid NullPointerException
|
||||
runThread.suspend();
|
||||
}
|
||||
}
|
||||
|
||||
private void resumeNow() {
|
||||
if (runThread != null) { // avoid NullPointerException
|
||||
runThread.resume();
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
// Store this for the suspendNow() and
|
||||
// resumeNow() methods to use.
|
||||
runThread = Thread.currentThread();
|
||||
|
||||
while (true) {
|
||||
// each time through, show the next symbol
|
||||
symbolTF.setText(""+count);
|
||||
Thread.sleep(1000);
|
||||
if (count <= 0)
|
||||
{
|
||||
innerStackP.add(symbolALRM);
|
||||
Thread.sleep(500);
|
||||
innerStackP.updateUI();
|
||||
suspendNow();
|
||||
innerStackP.remove(symbolALRM);
|
||||
Thread.sleep(500);
|
||||
innerStackP.updateUI();
|
||||
count = 60;
|
||||
}
|
||||
count--;
|
||||
}
|
||||
} catch (InterruptedException x) {
|
||||
// ignore
|
||||
} finally {
|
||||
// make sure that the reference to it is also lost.
|
||||
runThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Final vsr = new Final();
|
||||
Thread t = new Thread(vsr);
|
||||
t.start();
|
||||
|
||||
JFrame f = new JFrame();
|
||||
f.setContentPane(vsr);
|
||||
f.setSize(320, 200);
|
||||
f.setVisible(true);
|
||||
f.addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="Project1" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project Project1.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Project1-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
========================
|
||||
BUILD OUTPUT DESCRIPTION
|
||||
========================
|
||||
|
||||
When you build an Java application project that has a main class, the IDE
|
||||
automatically copies all of the JAR
|
||||
files on the projects classpath to your projects dist/lib folder. The IDE
|
||||
also adds each of the JAR files to the Class-Path element in the application
|
||||
JAR files manifest file (MANIFEST.MF).
|
||||
|
||||
To run the project from the command line, go to the dist folder and
|
||||
type the following:
|
||||
|
||||
java -jar "Project1.jar"
|
||||
|
||||
To distribute this project, zip up the dist folder (including the lib folder)
|
||||
and distribute the ZIP file.
|
||||
|
||||
Notes:
|
||||
|
||||
* If two JAR files on the project classpath have the same name, only the first
|
||||
JAR file is copied to the lib folder.
|
||||
* Only JAR files are copied to the lib folder.
|
||||
If the classpath contains other types of files or folders, these files (folders)
|
||||
are not copied.
|
||||
* If a library on the projects classpath also has a Class-Path element
|
||||
specified in the manifest,the content of the Class-Path element has to be on
|
||||
the projects runtime path.
|
||||
* To set a main class in a standard Java project, right-click the project node
|
||||
in the Projects window and choose Properties. Then click Run and enter the
|
||||
class name in the Main Class field. Alternatively, you can manually type the
|
||||
class name in the manifest Main-Class element.
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=28915d98
|
||||
build.xml.script.CRC32=1e1a9662
|
||||
build.xml.stylesheet.CRC32=28e38971@1.43.1.45
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=28915d98
|
||||
nbproject/build-impl.xml.script.CRC32=778c6a17
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Documents and Settings\\77260\\Application Data\\NetBeans\\7.2\\build.properties
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -0,0 +1,71 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Project1.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=project1.Project1
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Project1</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,80 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 1 *
|
||||
* Class Name: Inventory *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 1.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar
|
||||
*/
|
||||
public class Inventory {
|
||||
public int iItemID;
|
||||
public String sItemName;
|
||||
public int iInStore;
|
||||
public double dManuPrice;
|
||||
public double dSellPrice;
|
||||
|
||||
public Inventory() {
|
||||
}
|
||||
|
||||
public Inventory(int iItemID, String sItemName, int iInStore, double dManuPrice, double dSellPrice) {
|
||||
this.iItemID = iItemID;
|
||||
this.sItemName = sItemName;
|
||||
this.iInStore = iInStore;
|
||||
this.dManuPrice = dManuPrice;
|
||||
this.dSellPrice = dSellPrice;
|
||||
}
|
||||
|
||||
public double getdManuPrice() {
|
||||
return dManuPrice;
|
||||
}
|
||||
|
||||
public void setdManuPrice(double dManuPrice) {
|
||||
this.dManuPrice = dManuPrice;
|
||||
}
|
||||
|
||||
public double getdSellPrice() {
|
||||
return dSellPrice;
|
||||
}
|
||||
|
||||
public void setdSellPrice(double dSellPrice) {
|
||||
this.dSellPrice = dSellPrice;
|
||||
}
|
||||
|
||||
public int getiInStore() {
|
||||
return iInStore;
|
||||
}
|
||||
|
||||
public void setiInStore(int iInStore) {
|
||||
this.iInStore = iInStore;
|
||||
}
|
||||
|
||||
public int getiItemID() {
|
||||
return iItemID;
|
||||
}
|
||||
|
||||
public void setiItemID(int iItemID) {
|
||||
this.iItemID = iItemID;
|
||||
}
|
||||
|
||||
public String getsItemName() {
|
||||
return sItemName;
|
||||
}
|
||||
|
||||
public void setsItemName(String sItemName) {
|
||||
this.sItemName = sItemName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return ""+this.getiInStore();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 1 *
|
||||
* Class Name: Project1 *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 2.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project1;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar
|
||||
*/
|
||||
public class Project1 {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
/* ItemID itemName pInStore manufPrice sellingPrice
|
||||
* 12 Circular saw 150 $ 45.00 $ 125.00
|
||||
* 235 Cooking range 50 $ 450.00 $ 850.00
|
||||
* 301 Table saw 100 $ 125.00 $ 300.00
|
||||
* 302 Stapler 300 $ 18.00 $ 49.00
|
||||
* 303 Lawn tractor 5 $ 300.00 $ 650.00
|
||||
|
||||
*/
|
||||
public static ArrayList<Inventory> al = init();
|
||||
public static void main(String[] args) {
|
||||
// initalize - lets prime the pump.
|
||||
while(true)
|
||||
{
|
||||
int iSelect = menu();
|
||||
doThing(iSelect);
|
||||
}
|
||||
}
|
||||
public static ArrayList<Inventory> init()
|
||||
{
|
||||
ArrayList<Inventory> al = new ArrayList<Inventory>(5);
|
||||
al.add(0, new Inventory(12,"Circular saw", 150, 45.00, 125.00));
|
||||
al.add(1, new Inventory(235,"Cooking range", 50, 450.00, 850.00));
|
||||
al.add(2, new Inventory(301,"Table saw", 100, 125.00, 300.00));
|
||||
al.add(3, new Inventory(302,"Stapler\t", 300, 18.00, 49.00));
|
||||
al.add(4, new Inventory(303,"Lawn tractor", 5, 300.00, 650.00));
|
||||
return al;
|
||||
}
|
||||
public static int menu()
|
||||
{
|
||||
String menu =
|
||||
"-------------------------------Inventory Menu-------------------------------\n"+
|
||||
"1) Check Item Inventory \n"+
|
||||
"2) Sell Item \n"+
|
||||
"3) Item Stock Report \n"+
|
||||
"4) Exit \n"+
|
||||
" Please enter your selection. Numbers 1-4 are accepted.";
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(menu);
|
||||
System.out.print(":");
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
if (iOut < 0 && iOut > 4)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
return iOut;
|
||||
}
|
||||
public static void doThing(int iSel) {
|
||||
switch (iSel)
|
||||
{
|
||||
case 1:
|
||||
checkStock();
|
||||
break;
|
||||
case 2:
|
||||
sellItem();
|
||||
break;
|
||||
case 3:
|
||||
generateReport();
|
||||
break;
|
||||
case 4:
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static int getItemID() {
|
||||
String sPrompt = "Please enter the ID of the item you wish to query.";
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(sPrompt);
|
||||
System.out.print(":");
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, try again?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
iOut = -999;
|
||||
}
|
||||
else {
|
||||
iOut = getItemID();
|
||||
}
|
||||
}
|
||||
return iOut;
|
||||
|
||||
}
|
||||
public static int getStock(int iID) {
|
||||
for (int i=0;i<al.size();i++)
|
||||
{
|
||||
Inventory item = al.get(i);
|
||||
if(item.getiItemID() == iID) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -999;
|
||||
}
|
||||
public static int checkStock(){
|
||||
int iID = getItemID();
|
||||
if (iID == -999) {
|
||||
return -999;
|
||||
}
|
||||
int iArrayID = getStock(iID);
|
||||
if(iArrayID == -999) {
|
||||
System.out.println("Item not found.");
|
||||
} else {
|
||||
Inventory inv = al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
String sDesc = inv.getsItemName();
|
||||
System.out.println("Item ID - "+iID+" ("+sDesc+") Currently has "
|
||||
+iStock+" items in stock.");
|
||||
return iArrayID;
|
||||
}
|
||||
return -999;
|
||||
}
|
||||
|
||||
private static void sellItem() {
|
||||
int iArrayID = checkStock();
|
||||
if (iArrayID != -999) {
|
||||
doPurchase(iArrayID);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateReport() {
|
||||
int iItemCount = 0;
|
||||
double dWorth = 0.00;
|
||||
System.out.println("Item ID\tItem Name\tStock\tMFG Price\tSale Price");
|
||||
for (int i=0;i<al.size();i++)
|
||||
{
|
||||
Inventory item = al.get(i);
|
||||
System.out.println(item.getiItemID()+"\t"+item.getsItemName()+"\t"+
|
||||
item.getiInStore()+"\t$"+item.getdManuPrice()+"\t\t$"+item.getdSellPrice());
|
||||
iItemCount += item.getiInStore();
|
||||
dWorth += (item.getiInStore()*item.getdManuPrice());
|
||||
}
|
||||
System.out.println("There are currently "+iItemCount+" items in store.");
|
||||
System.out.println("The total worh of the store is: $"+dWorth);
|
||||
}
|
||||
|
||||
private static void exit() {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static void doPurchase(int iArrayID) {
|
||||
Inventory inv = al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
String sDesc = inv.getsItemName();
|
||||
System.out.println("The selling price is currently: $"+inv.getdSellPrice()+"\n"+
|
||||
"How many would you like to purchase?");
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.print(":");
|
||||
String input = console.next();
|
||||
int iOut = -999;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, try again?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Your order has been canceled.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iOut <= 0)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid ammount, try again?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Your order has been canceled.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iOut > inv.getiInStore())
|
||||
{
|
||||
System.out.println("We're sorry. We don't have that many in stock, try again?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Input accepted. Your order for "+
|
||||
iOut+" "+sDesc+" will be placed. Confirm your order?");
|
||||
System.out.print("([Y]es/[N]o):");
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
System.out.println("Thank you! Your order has been recieved.\n"
|
||||
+ "You will be billed $"+(inv.getdSellPrice()*iOut));
|
||||
removeStock(iArrayID,iOut);
|
||||
return;
|
||||
}
|
||||
}
|
||||
System.out.println("Your order has been canceled.");
|
||||
}
|
||||
|
||||
private static void removeStock(int iArrayID, int iOut) {
|
||||
Inventory inv = al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
iStock -= iOut;
|
||||
inv.setiInStore(iStock);
|
||||
al.set(iArrayID, inv);
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="Project2" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project Project2.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Project2-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=30a5c9f2
|
||||
build.xml.script.CRC32=e6a77667
|
||||
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=30a5c9f2
|
||||
nbproject/build-impl.xml.script.CRC32=d29c886b
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Documents and Settings\\77260\\Application Data\\NetBeans\\7.2\\build.properties
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -0,0 +1,71 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Project2.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=project2.Project2
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Project2</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,50 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: CashCustomer *
|
||||
* Author: Amrit Panesar <apanesar@coleman.edu> *
|
||||
* Created On: Nov 21, 2012 *
|
||||
* Hours: X.XX Hours *
|
||||
* Purpose: TODO: Write purpose here. *
|
||||
******************************************************************************/
|
||||
|
||||
package project2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class CashCustomer extends Customer {
|
||||
/**
|
||||
*Overrides Customer.java 's Discount percent.
|
||||
*/
|
||||
private double CustomerModifierPercent = 0.02;
|
||||
private Customer customer;
|
||||
|
||||
public CashCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
System.out.println("You are a cash customer, you get a 2% discount!");
|
||||
}
|
||||
|
||||
public double getCustomerModifierPercent() {
|
||||
return CustomerModifierPercent;
|
||||
}
|
||||
|
||||
public void setCustomerModifierPercent(double CustomerModifierPercent) {
|
||||
this.CustomerModifierPercent = CustomerModifierPercent;
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double doTotal(double dPrice)
|
||||
{
|
||||
return dPrice-(dPrice*(this.CustomerModifierPercent));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: CreditCustomer *
|
||||
* Author: Amrit Panesar <apanesar@coleman.edu> *
|
||||
* Created On: Nov 21, 2012 *
|
||||
* Hours: X.XX Hours *
|
||||
* Purpose: TODO: Write purpose here. *
|
||||
******************************************************************************/
|
||||
|
||||
package project2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class CreditCustomer extends Customer{
|
||||
private Customer customer;
|
||||
/**
|
||||
*Overrides Customer.java 's Discount percent.
|
||||
*/
|
||||
private double CustomerModifierPercent = +1.02;
|
||||
|
||||
public CreditCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
System.out.println("You are a credit customer, you are subject to a 2% markup");
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public double getCustomerModifierPercent() {
|
||||
return CustomerModifierPercent;
|
||||
}
|
||||
|
||||
public void setCustomerModifierPercent(double CustomerModifierPercent) {
|
||||
this.CustomerModifierPercent = CustomerModifierPercent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double doTotal(double dPrice)
|
||||
{
|
||||
return dPrice*(this.CustomerModifierPercent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: Customer *
|
||||
* Author: Amrit Panesar <apanesar@coleman.edu> *
|
||||
* Created On: Nov 21, 2012 *
|
||||
* Hours: X.XX Hours *
|
||||
* Purpose: TODO: Write purpose here. *
|
||||
******************************************************************************/
|
||||
|
||||
package project2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class Customer {
|
||||
protected int CustomerID;
|
||||
protected String CustomerName;
|
||||
protected String CustomerAddress1;
|
||||
protected String CustomerAddress2;
|
||||
protected String CustomerCity;
|
||||
protected String CustomerState;
|
||||
protected String CustomerZip;
|
||||
protected int CustomerPaymentType; // Customer.CASH, Customer.CREDIT
|
||||
|
||||
public static final int CASH = 0;
|
||||
public static final int CREDIT = 1;
|
||||
|
||||
/**
|
||||
* If extending this class, CustomerModifierPercent should be overridden.
|
||||
*/
|
||||
protected double CustomerModifierPercent = 0;
|
||||
|
||||
public Customer() {
|
||||
}
|
||||
|
||||
public Customer(int CustomerID, String CustomerName, String CustomerAddress1, String CustomerAddress2, String CustomerCity, String CustomerState, String CustomerZip) {
|
||||
this.CustomerID = CustomerID;
|
||||
this.CustomerName = CustomerName;
|
||||
this.CustomerAddress1 = CustomerAddress1;
|
||||
this.CustomerAddress2 = CustomerAddress2;
|
||||
this.CustomerCity = CustomerCity;
|
||||
this.CustomerState = CustomerState;
|
||||
this.CustomerZip = CustomerZip;
|
||||
}
|
||||
|
||||
public int getCustomerID() {
|
||||
return CustomerID;
|
||||
}
|
||||
|
||||
public void setCustomerID(int CustomerID) {
|
||||
this.CustomerID = CustomerID;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return CustomerName;
|
||||
}
|
||||
|
||||
public void setCustomerName(String CustomerName) {
|
||||
this.CustomerName = CustomerName;
|
||||
}
|
||||
|
||||
public String getCustomerAddress1() {
|
||||
return CustomerAddress1;
|
||||
}
|
||||
|
||||
public void setCustomerAddress1(String CustomerAddress1) {
|
||||
this.CustomerAddress1 = CustomerAddress1;
|
||||
}
|
||||
|
||||
public String getCustomerAddress2() {
|
||||
return CustomerAddress2;
|
||||
}
|
||||
|
||||
public void setCustomerAddress2(String CustomerAddress2) {
|
||||
this.CustomerAddress2 = CustomerAddress2;
|
||||
}
|
||||
|
||||
public String getCustomerCity() {
|
||||
return CustomerCity;
|
||||
}
|
||||
|
||||
public void setCustomerCity(String CustomerCity) {
|
||||
this.CustomerCity = CustomerCity;
|
||||
}
|
||||
|
||||
public String getCustomerState() {
|
||||
return CustomerState;
|
||||
}
|
||||
|
||||
public void setCustomerState(String CustomerState) {
|
||||
this.CustomerState = CustomerState;
|
||||
}
|
||||
|
||||
public String getCustomerZip() {
|
||||
return CustomerZip;
|
||||
}
|
||||
|
||||
public void setCustomerZip(String CustomerZip) {
|
||||
this.CustomerZip = CustomerZip;
|
||||
}
|
||||
|
||||
public int getCustomerPaymentType() {
|
||||
return CustomerPaymentType;
|
||||
}
|
||||
|
||||
public void setCustomerPaymentType(int CustomerPaymentType) {
|
||||
this.CustomerPaymentType = CustomerPaymentType;
|
||||
}
|
||||
|
||||
public double doTotal(double dPrice)
|
||||
{
|
||||
return -9.99;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: CustomerHandler *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 2.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project2;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class CustomerHandler {
|
||||
public static void invoke()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
int iSelect = menu();
|
||||
int iThing = doThing(iSelect);
|
||||
if (iThing == -999) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int menu()
|
||||
{
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(Project2.md.get(MenuHandler.CUSTOMER_MENU_ID));
|
||||
System.out.print(MenuHandler.PROMPT);
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
if (iOut < 0 && iOut > 4)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
return iOut;
|
||||
}
|
||||
private static int doThing(int iSel) {
|
||||
switch (iSel)
|
||||
{
|
||||
case 1:
|
||||
AddCustomer();
|
||||
break;
|
||||
case 2:
|
||||
DeleteCustomer();
|
||||
break;
|
||||
case 3:
|
||||
ReportHandler.RunCustomerReport();
|
||||
break;
|
||||
case 4:
|
||||
return -999;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void AddCustomer() {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
private static void DeleteCustomer() {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
static Customer findCustomer() {
|
||||
String sPrompt = "Please enter either the ID or the name of the customer you wish to query.";
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(sPrompt);
|
||||
System.out.print(MenuHandler.PROMPT);
|
||||
String input = console.next();
|
||||
boolean isID;
|
||||
try
|
||||
{
|
||||
Integer.parseInt(input);
|
||||
isID = true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
isID = false;
|
||||
}
|
||||
if (isID)
|
||||
{
|
||||
for (int i=0;i<Project2.cu.size();i++)
|
||||
{
|
||||
Customer cust = Project2.cu.get(i);
|
||||
if (cust.getCustomerID() == Integer.parseInt(input))
|
||||
{
|
||||
return cust;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0;i<Project2.cu.size();i++)
|
||||
{
|
||||
Customer cust = Project2.cu.get(i);
|
||||
if (cust.getCustomerName().equals(input))
|
||||
{
|
||||
return cust;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: Inventory *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 1.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar
|
||||
*/
|
||||
public class Inventory {
|
||||
public int iItemID;
|
||||
public String sItemName;
|
||||
public int iInStore;
|
||||
public double dManuPrice;
|
||||
public double dSellPrice;
|
||||
|
||||
public Inventory() {
|
||||
}
|
||||
|
||||
public Inventory(int iItemID, String sItemName, int iInStore, double dManuPrice, double dSellPrice) {
|
||||
this.iItemID = iItemID;
|
||||
this.sItemName = sItemName;
|
||||
this.iInStore = iInStore;
|
||||
this.dManuPrice = dManuPrice;
|
||||
this.dSellPrice = dSellPrice;
|
||||
}
|
||||
|
||||
public double getdManuPrice() {
|
||||
return dManuPrice;
|
||||
}
|
||||
|
||||
public void setdManuPrice(double dManuPrice) {
|
||||
this.dManuPrice = dManuPrice;
|
||||
}
|
||||
|
||||
public double getdSellPrice() {
|
||||
return dSellPrice;
|
||||
}
|
||||
|
||||
public void setdSellPrice(double dSellPrice) {
|
||||
this.dSellPrice = dSellPrice;
|
||||
}
|
||||
|
||||
public int getiInStore() {
|
||||
return iInStore;
|
||||
}
|
||||
|
||||
public void setiInStore(int iInStore) {
|
||||
this.iInStore = iInStore;
|
||||
}
|
||||
|
||||
public int getiItemID() {
|
||||
return iItemID;
|
||||
}
|
||||
|
||||
public void setiItemID(int iItemID) {
|
||||
this.iItemID = iItemID;
|
||||
}
|
||||
|
||||
public String getsItemName() {
|
||||
return sItemName;
|
||||
}
|
||||
|
||||
public void setsItemName(String sItemName) {
|
||||
this.sItemName = sItemName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return ""+this.getiInStore();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: InventoryHandler *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 2.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project2;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class InventoryHandler {
|
||||
public static void invoke()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
int iSelect = menu();
|
||||
int iThing = doThing(iSelect);
|
||||
if (iThing == -999) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int menu()
|
||||
{
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(Project2.md.get(MenuHandler.INVENTORY_MENU_ID));
|
||||
System.out.print(MenuHandler.PROMPT);
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
if (iOut < 0 && iOut > 5)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
return iOut;
|
||||
}
|
||||
|
||||
private static int doThing(int iSel)
|
||||
{
|
||||
switch (iSel)
|
||||
{
|
||||
case 1:
|
||||
AddInventory();
|
||||
break;
|
||||
case 2:
|
||||
DeleteInventory();
|
||||
break;
|
||||
case 3:
|
||||
EditInventory();
|
||||
break;
|
||||
case 4:
|
||||
ReportHandler.RunInventoryReport();
|
||||
break;
|
||||
case 5:
|
||||
return -999;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void AddInventory() {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
private static void DeleteInventory() {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
private static void EditInventory() {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
protected static int getItemID()
|
||||
{
|
||||
String sPrompt = "Please enter the ID of the item you wish to query.";
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(sPrompt);
|
||||
System.out.print(MenuHandler.PROMPT);
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, try again?");
|
||||
System.out.print("([Y]es/[N]o)"+MenuHandler.PROMPT);
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
iOut = -999;
|
||||
}
|
||||
else {
|
||||
iOut = getItemID();
|
||||
}
|
||||
}
|
||||
return iOut;
|
||||
}
|
||||
|
||||
protected static int getStock(int iID)
|
||||
{
|
||||
for (int i=0;i<Project2.al.size();i++)
|
||||
{
|
||||
Inventory item = Project2.al.get(i);
|
||||
if(item.getiItemID() == iID) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -999;
|
||||
}
|
||||
|
||||
protected static int checkStock()
|
||||
{
|
||||
int iID = getItemID();
|
||||
if (iID == -999) {
|
||||
return -999;
|
||||
}
|
||||
int iArrayID = getStock(iID);
|
||||
if(iArrayID == -999) {
|
||||
System.out.println("Item not found.");
|
||||
} else {
|
||||
Inventory inv = Project2.al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
String sDesc = inv.getsItemName();
|
||||
System.out.println("Item ID - "+iID+" ("+sDesc+") Currently has "
|
||||
+iStock+" items in stock.");
|
||||
return iArrayID;
|
||||
}
|
||||
return -999;
|
||||
}
|
||||
|
||||
protected static void removeStock(int iArrayID, int iOut)
|
||||
{
|
||||
Inventory inv = Project2.al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
iStock -= iOut;
|
||||
inv.setiInStore(iStock);
|
||||
Project2.al.set(iArrayID, inv);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: MenuDialog *
|
||||
* Author: Amrit Panesar <apanesar@coleman.edu> *
|
||||
* Created On: Nov 21, 2012 *
|
||||
* Hours: X.XX Hours *
|
||||
* Purpose: TODO: Write purpose here. *
|
||||
******************************************************************************/
|
||||
|
||||
package project2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class MenuDialog {
|
||||
private int index;
|
||||
private String title;
|
||||
private String menu;
|
||||
|
||||
public MenuDialog() {
|
||||
}
|
||||
|
||||
public MenuDialog(int index, String title, String menu) {
|
||||
this.index = index;
|
||||
this.title = title;
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getMenu() {
|
||||
return menu;
|
||||
}
|
||||
|
||||
public void setMenu(String menu) {
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.menu;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: MenuHandler *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 2.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class MenuHandler {
|
||||
|
||||
protected static ArrayList<MenuDialog> menu_dialog_init() {
|
||||
ArrayList<MenuDialog> md = new ArrayList<MenuDialog>(1);
|
||||
md.add(0, new MenuDialog(0, "Main Menu",
|
||||
"---------------------------------Main Menu----------------------------------\n"+
|
||||
"1) Customer Actions \n"+
|
||||
"2) Order Actions \n"+
|
||||
"3) Inventory Actions \n"+
|
||||
"4) Report Actions \n"+
|
||||
"5) Exit \n"+
|
||||
" Please enter your selection. Numbers 1-5 are accepted."));
|
||||
md.add(1, new MenuDialog(1, "Customer Manipulation Menu",
|
||||
"-------------------------Customer Manipulation Menu-------------------------\n"+
|
||||
"1) Add Customer \n"+
|
||||
"2) Delete Customer \n"+
|
||||
"3) Run Customer Report \n"+
|
||||
"4) Back to Main Menu \n"+
|
||||
" Please enter your selection. Numbers 1-4 are accepted."));
|
||||
md.add(2, new MenuDialog(2, "Order Manipulation Menu",
|
||||
"---------------------------Order Manipulation Menu--------------------------\n"+
|
||||
"1) New Order \n"+
|
||||
"2) Remove Order \n"+
|
||||
"3) Run Order Report \n"+
|
||||
"4) Back to Main Menu \n"+
|
||||
" Please enter your selection. Numbers 1-4 are accepted."));
|
||||
md.add(3, new MenuDialog(2, "Inventory Manipulation Menu",
|
||||
"------------------------Inventory Manipulation Menu-------------------------\n"+
|
||||
"1) Add Items to Inventory \n"+
|
||||
"2) Delete Items From Inventory \n"+
|
||||
"3) Edit Inventory Quantities \n"+
|
||||
"4) Run Inventory Report \n"+
|
||||
"5) Back to Main Menu \n"+
|
||||
" Please enter your selection. Numbers 1-5 are accepted."));
|
||||
md.add(4, new MenuDialog(2, "Report Display Menu",
|
||||
"-----------------------------Report Display Menu----------------------------\n"+
|
||||
"1) Run Customer Report \n"+
|
||||
"2) Run Order Report \n"+
|
||||
"3) Run Inventory Report \n"+
|
||||
"4) Back to Main Menu \n"+
|
||||
" Please enter your selection. Numbers 1-4 are accepted."));
|
||||
return md;
|
||||
}
|
||||
/* ItemID itemName pInStore manufPrice sellingPrice
|
||||
* 12 Circular saw 150 $ 45.00 $ 125.00
|
||||
* 235 Cooking range 50 $ 450.00 $ 850.00
|
||||
* 301 Table saw 100 $ 125.00 $ 300.00
|
||||
* 302 Stapler 300 $ 18.00 $ 49.00
|
||||
* 303 Lawn tractor 5 $ 300.00 $ 650.00
|
||||
*/
|
||||
protected static ArrayList<Inventory> inventory_init()
|
||||
{
|
||||
ArrayList<Inventory> al = new ArrayList<Inventory>(5);
|
||||
al.add(0, new Inventory(12,"Circular saw", 150, 45.00, 125.00));
|
||||
al.add(1, new Inventory(235,"Cooking range", 50, 450.00, 850.00));
|
||||
al.add(2, new Inventory(301,"Table saw", 100, 125.00, 300.00));
|
||||
al.add(3, new Inventory(302,"Stapler\t", 300, 18.00, 49.00));
|
||||
al.add(4, new Inventory(303,"Lawn tractor", 5, 300.00, 650.00));
|
||||
return al;
|
||||
}
|
||||
|
||||
protected static ArrayList<Customer> customer_init() {
|
||||
ArrayList<Customer> cu = new ArrayList<Customer>(5);
|
||||
cu.add(0,new Customer(0, "Kermit Thefrog", "8888 Balboa Avenue", "", "San Diego", "CA", "92123"));
|
||||
return cu;
|
||||
}
|
||||
static ArrayList<Order> order_init() {
|
||||
ArrayList<Order> or = new ArrayList<Order>(5);
|
||||
return or;
|
||||
}
|
||||
|
||||
public final static int MAIN_MENU_ID = 0;
|
||||
public final static int CUSTOMER_MENU_ID = 1;
|
||||
public final static int ORDER_MENU_ID = 2;
|
||||
public final static int INVENTORY_MENU_ID = 3;
|
||||
public final static int REPORT_MENU_ID = 4;
|
||||
public final static String PROMPT = ":";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/******************************************************************************
|
||||
* Project: Project2 *
|
||||
* Class Name: Order *
|
||||
* Author: Amrit Panesar <apanesar@coleman.edu> *
|
||||
* Created On: Nov 21, 2012 *
|
||||
* Hours: X.XX Hours *
|
||||
* Purpose: TODO: Write purpose here. *
|
||||
******************************************************************************/
|
||||
|
||||
package project2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class Order {
|
||||
private Customer customer;
|
||||
private Inventory item;
|
||||
private int quantity;
|
||||
private double total;
|
||||
|
||||
public Order() {
|
||||
}
|
||||
|
||||
public double getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(double total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Order(Customer customer, Inventory item, int quantity, double total) {
|
||||
this.customer = customer;
|
||||
this.item = item;
|
||||
this.quantity = quantity;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public Inventory getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(Inventory item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public double computePrice() {
|
||||
return (this.quantity * this.item.getdManuPrice());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: OrderHandler *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 2.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project2;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class OrderHandler {
|
||||
public static void invoke()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
int iSelect = menu();
|
||||
int iThing = doThing(iSelect);
|
||||
if (iThing == -999) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int menu()
|
||||
{
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(Project2.md.get(MenuHandler.ORDER_MENU_ID));
|
||||
System.out.print(MenuHandler.PROMPT);
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
if (iOut < 0 && iOut > 4)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
return iOut;
|
||||
}
|
||||
private static int doThing(int iSel) {
|
||||
switch (iSel)
|
||||
{
|
||||
case 1:
|
||||
AddOrder();
|
||||
break;
|
||||
case 2:
|
||||
DeleteOrder();
|
||||
break;
|
||||
case 3:
|
||||
ReportHandler.RunOrderReport();
|
||||
break;
|
||||
case 4:
|
||||
return -999;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void AddOrder() {
|
||||
Order ord = new Order();
|
||||
Customer cust = CustomerHandler.findCustomer();
|
||||
if (cust == null)
|
||||
{
|
||||
Scanner console = new Scanner(System.in);
|
||||
String input;
|
||||
System.out.println("We're sorry. We were unable to find that customer, try again?");
|
||||
System.out.print("([Y]es/[N]o)"+MenuHandler.PROMPT);
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
AddOrder();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Your order has been canceled.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Welcome back "+ cust.getCustomerName()+"!");
|
||||
}
|
||||
int iArrayID = InventoryHandler.checkStock();
|
||||
if (iArrayID != -999) {
|
||||
doPurchase(iArrayID, cust, ord);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DeleteOrder() {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
private static void doPurchase(int iArrayID, Customer cust, Order ord) {
|
||||
Inventory inv = Project2.al.get(iArrayID);
|
||||
int iStock = inv.getiInStore();
|
||||
String sDesc = inv.getsItemName();
|
||||
System.out.println("The selling price is currently: $"+inv.getdSellPrice()+"\n"+
|
||||
"How many would you like to purchase?");
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.print(MenuHandler.PROMPT);
|
||||
String input = console.next();
|
||||
int iOut = -999;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, try again?");
|
||||
System.out.print("([Y]es/[N]o)"+MenuHandler.PROMPT);
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID, cust, ord);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Your order has been canceled.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iOut <= 0)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid ammount, try again?");
|
||||
System.out.print("([Y]es/[N]o)"+MenuHandler.PROMPT);
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID, cust, ord);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Your order has been canceled.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (iOut > inv.getiInStore())
|
||||
{
|
||||
System.out.println("We're sorry. We don't have that many in stock, try again?");
|
||||
System.out.print("([Y]es/[N]o)"+MenuHandler.PROMPT);
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
doPurchase(iArrayID, cust, ord);
|
||||
}
|
||||
} else {
|
||||
System.out.printf("Input accepted. Your order for "+
|
||||
iOut+" "+sDesc+" will be placed. Your Subtotal today is: %.2f"
|
||||
+"\nWill that be Cash or Credit?\n", (inv.getdSellPrice()*iOut));
|
||||
System.out.print("([C]ash/C[r]edit)"+MenuHandler.PROMPT);
|
||||
input = console.next();
|
||||
char cIn = input.toLowerCase().charAt(0);
|
||||
switch (cIn)
|
||||
{
|
||||
case 'c':
|
||||
cust.setCustomerPaymentType(Customer.CASH);
|
||||
break;
|
||||
case 'r':
|
||||
cust.setCustomerPaymentType(Customer.CREDIT);
|
||||
break;
|
||||
}
|
||||
Customer newcust = cashOrCredit(cust);
|
||||
System.out.printf("Input accepted. Your order for "+
|
||||
iOut+" "+sDesc+" will be placed. Your GrandTotal today is: %.2f"
|
||||
+"\nPlace order?\n", newcust.doTotal(inv.getdSellPrice()*iOut));
|
||||
System.out.print("([Y]es/[N]o)"+MenuHandler.PROMPT);
|
||||
input = console.next();
|
||||
cIn = input.toLowerCase().charAt(0);
|
||||
if (cIn == 'y') {
|
||||
System.out.printf("Thank you! Your order has been recieved.\n"
|
||||
+ "You will be billed $%.2f\n",newcust.doTotal(inv.getdSellPrice()*iOut));
|
||||
Project2.or.add(new Order(newcust,inv,iOut,newcust.doTotal(inv.getdSellPrice()*iOut)));
|
||||
InventoryHandler.removeStock(iArrayID,iOut);
|
||||
return;
|
||||
}
|
||||
}
|
||||
System.out.println("Your order has been canceled.");
|
||||
}
|
||||
|
||||
private static Customer cashOrCredit(Customer cu) {
|
||||
switch(cu.getCustomerPaymentType())
|
||||
{
|
||||
case Customer.CASH:
|
||||
return new CashCustomer(cu);
|
||||
case Customer.CREDIT:
|
||||
return new CreditCustomer(cu);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: Project2 *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 2.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project2;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar
|
||||
*/
|
||||
public class Project2 {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
protected static ArrayList<MenuDialog> md = MenuHandler.menu_dialog_init();
|
||||
|
||||
protected static ArrayList<Inventory> al = MenuHandler.inventory_init();
|
||||
protected static ArrayList<Customer> cu = MenuHandler.customer_init();
|
||||
protected static ArrayList<Order> or = MenuHandler.order_init();
|
||||
|
||||
public static void main(String[] args) { // main()
|
||||
while(true)
|
||||
{
|
||||
int iSelect = menu();
|
||||
doThing(iSelect);
|
||||
}
|
||||
}
|
||||
|
||||
public static int menu()
|
||||
{
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(md.get(MenuHandler.MAIN_MENU_ID));
|
||||
System.out.print(MenuHandler.PROMPT);
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
if (iOut < 0 && iOut > 5)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
return iOut;
|
||||
}
|
||||
|
||||
private static void doThing(int iSel) {
|
||||
switch (iSel)
|
||||
{
|
||||
case 1:
|
||||
CustomerHandler.invoke();
|
||||
break;
|
||||
case 2:
|
||||
OrderHandler.invoke();
|
||||
break;
|
||||
case 3:
|
||||
InventoryHandler.invoke();
|
||||
break;
|
||||
case 4:
|
||||
ReportHandler.invoke();
|
||||
break;
|
||||
case 5:
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void exit() {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/******************************************************************************
|
||||
* Project: Project 2 *
|
||||
* Class Name: ReportHandler *
|
||||
* Author: Amrit Panesar -ASP ,o/ *
|
||||
* Last Edited: 10/17/2012 *
|
||||
* Hours: 2.00 Hours *
|
||||
* Purpose: To demonstrate the retention and knowledge of the previous *
|
||||
* mods concepts. *
|
||||
*****************************************************************************/
|
||||
package project2;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class ReportHandler {
|
||||
public static void invoke()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
int iSelect = menu();
|
||||
int iThing = doThing(iSelect);
|
||||
if (iThing == -999) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int menu()
|
||||
{
|
||||
Scanner console = new Scanner(System.in);
|
||||
System.out.println(Project2.md.get(MenuHandler.REPORT_MENU_ID));
|
||||
System.out.print(MenuHandler.PROMPT);
|
||||
String input = console.next();
|
||||
int iOut = 0;
|
||||
try
|
||||
{
|
||||
iOut = Integer.parseInt(input);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
if (iOut < 0 && iOut > 4)
|
||||
{
|
||||
System.out.println("We're sorry. That was an invalid input, please try again.");
|
||||
iOut = menu();
|
||||
}
|
||||
return iOut;
|
||||
}
|
||||
private static int doThing(int iSel) {
|
||||
switch (iSel)
|
||||
{
|
||||
case 1:
|
||||
RunCustomerReport();
|
||||
break;
|
||||
case 2:
|
||||
RunOrderReport();
|
||||
break;
|
||||
case 3:
|
||||
RunInventoryReport();
|
||||
break;
|
||||
case 4:
|
||||
return -999;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected static void RunInventoryReport() {
|
||||
int iItemCount = 0;
|
||||
double dWorth = 0.00;
|
||||
System.out.println("Item ID\tItem Name\tStock\tMFG Price\tSale Price");
|
||||
for (int i=0;i<Project2.al.size();i++)
|
||||
{
|
||||
Inventory item = Project2.al.get(i);
|
||||
System.out.println(item.getiItemID()+"\t"+item.getsItemName()+"\t"+
|
||||
item.getiInStore()+"\t$"+item.getdManuPrice()+"\t\t$"+item.getdSellPrice());
|
||||
iItemCount += item.getiInStore();
|
||||
dWorth += (item.getiInStore()*item.getdManuPrice());
|
||||
}
|
||||
System.out.println("There are currently "+iItemCount+" items in store.");
|
||||
System.out.println("The total worh of the store is: $"+dWorth);
|
||||
}
|
||||
|
||||
protected static void RunOrderReport() {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
protected static void RunCustomerReport() {
|
||||
System.out.println("ID\tName\t\tAddress1\tAddress2\tCity\tState\tZip");
|
||||
for (int i=0;i<Project2.cu.size();i++)
|
||||
{
|
||||
Customer cust = Project2.cu.get(i);
|
||||
System.out.printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
|
||||
cust.getCustomerID(), cust.getCustomerName(),
|
||||
cust.getCustomerAddress1(), cust.getCustomerAddress2(),
|
||||
cust.getCustomerCity(), cust.getCustomerState(),
|
||||
cust.getCustomerZip());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="Project3" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project Project3.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Project3-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=19528819
|
||||
build.xml.script.CRC32=b133d664
|
||||
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=19528819
|
||||
nbproject/build-impl.xml.script.CRC32=9c8db322
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
Whitespace-only changes.
@@ -0,0 +1,6 @@
|
||||
compile.on.save=true
|
||||
do.depend=false
|
||||
do.jar=true
|
||||
javac.debug=true
|
||||
javadoc.preview=true
|
||||
user.properties.file=C:\\Documents and Settings\\77260\\Application Data\\NetBeans\\7.2\\build.properties
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -0,0 +1,84 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
application.title=Project3
|
||||
application.vendor=77260
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Project3.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
includes=**
|
||||
jar.archive.disabled=${jnlp.enabled}
|
||||
jar.compress=false
|
||||
jar.index=${jnlp.enabled}
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
jnlp.codebase.type=no.codebase
|
||||
jnlp.descriptor=application
|
||||
jnlp.enabled=false
|
||||
jnlp.mixed.code=default
|
||||
jnlp.offline-allowed=false
|
||||
jnlp.signed=false
|
||||
jnlp.signing=
|
||||
jnlp.signing.alias=
|
||||
jnlp.signing.keystore=
|
||||
main.class=project3.gui
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Project3</name>
|
||||
<explicit-platform explicit-source-supported="true"/>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class CashCustomer extends Customer {
|
||||
/**
|
||||
*Overrides Customer.java 's Discount percent.
|
||||
*/
|
||||
private double CustomerModifierPercent = 0.02;
|
||||
private Customer customer;
|
||||
|
||||
public CashCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
System.out.println("You are a cash customer, you get a 2% discount!");
|
||||
}
|
||||
|
||||
public double getCustomerModifierPercent() {
|
||||
return CustomerModifierPercent;
|
||||
}
|
||||
|
||||
public void setCustomerModifierPercent(double CustomerModifierPercent) {
|
||||
this.CustomerModifierPercent = CustomerModifierPercent;
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double doTotal(double dPrice)
|
||||
{
|
||||
return dPrice-(dPrice*(this.CustomerModifierPercent));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class CreditCustomer extends Customer{
|
||||
private Customer customer;
|
||||
/**
|
||||
*Overrides Customer.java 's Discount percent.
|
||||
*/
|
||||
private double CustomerModifierPercent = +1.02;
|
||||
|
||||
public CreditCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
System.out.println("You are a credit customer, you are subject to a 2% markup");
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public double getCustomerModifierPercent() {
|
||||
return CustomerModifierPercent;
|
||||
}
|
||||
|
||||
public void setCustomerModifierPercent(double CustomerModifierPercent) {
|
||||
this.CustomerModifierPercent = CustomerModifierPercent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double doTotal(double dPrice)
|
||||
{
|
||||
return dPrice*(this.CustomerModifierPercent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class Customer {
|
||||
protected int CustomerID;
|
||||
protected String CustomerName;
|
||||
protected String CustomerAddress1;
|
||||
protected String CustomerAddress2;
|
||||
protected String CustomerCity;
|
||||
protected String CustomerState;
|
||||
protected String CustomerZip;
|
||||
protected int CustomerPaymentType; // Customer.CASH, Customer.CREDIT
|
||||
|
||||
public static final int CASH = 0;
|
||||
public static final int CREDIT = 1;
|
||||
|
||||
/**
|
||||
* If extending this class, CustomerModifierPercent should be overridden.
|
||||
*/
|
||||
protected double CustomerModifierPercent = 0;
|
||||
|
||||
public Customer() {
|
||||
}
|
||||
|
||||
public Customer(int CustomerID, String CustomerName, String CustomerAddress1, String CustomerAddress2, String CustomerCity, String CustomerState, String CustomerZip) {
|
||||
this.CustomerID = CustomerID;
|
||||
this.CustomerName = CustomerName;
|
||||
this.CustomerAddress1 = CustomerAddress1;
|
||||
this.CustomerAddress2 = CustomerAddress2;
|
||||
this.CustomerCity = CustomerCity;
|
||||
this.CustomerState = CustomerState;
|
||||
this.CustomerZip = CustomerZip;
|
||||
}
|
||||
|
||||
public int getCustomerID() {
|
||||
return CustomerID;
|
||||
}
|
||||
|
||||
public void setCustomerID(int CustomerID) {
|
||||
this.CustomerID = CustomerID;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return CustomerName;
|
||||
}
|
||||
|
||||
public void setCustomerName(String CustomerName) {
|
||||
this.CustomerName = CustomerName;
|
||||
}
|
||||
|
||||
public String getCustomerAddress1() {
|
||||
return CustomerAddress1;
|
||||
}
|
||||
|
||||
public void setCustomerAddress1(String CustomerAddress1) {
|
||||
this.CustomerAddress1 = CustomerAddress1;
|
||||
}
|
||||
|
||||
public String getCustomerAddress2() {
|
||||
return CustomerAddress2;
|
||||
}
|
||||
|
||||
public void setCustomerAddress2(String CustomerAddress2) {
|
||||
this.CustomerAddress2 = CustomerAddress2;
|
||||
}
|
||||
|
||||
public String getCustomerCity() {
|
||||
return CustomerCity;
|
||||
}
|
||||
|
||||
public void setCustomerCity(String CustomerCity) {
|
||||
this.CustomerCity = CustomerCity;
|
||||
}
|
||||
|
||||
public String getCustomerState() {
|
||||
return CustomerState;
|
||||
}
|
||||
|
||||
public void setCustomerState(String CustomerState) {
|
||||
this.CustomerState = CustomerState;
|
||||
}
|
||||
|
||||
public String getCustomerZip() {
|
||||
return CustomerZip;
|
||||
}
|
||||
|
||||
public void setCustomerZip(String CustomerZip) {
|
||||
this.CustomerZip = CustomerZip;
|
||||
}
|
||||
|
||||
public int getCustomerPaymentType() {
|
||||
return CustomerPaymentType;
|
||||
}
|
||||
|
||||
public void setCustomerPaymentType(int CustomerPaymentType) {
|
||||
this.CustomerPaymentType = CustomerPaymentType;
|
||||
}
|
||||
|
||||
public double doTotal(double dPrice)
|
||||
{
|
||||
return -9.99;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class Inventory {
|
||||
public int iItemID;
|
||||
public String sItemName;
|
||||
public int iInStore;
|
||||
public double dManuPrice;
|
||||
public double dSellPrice;
|
||||
|
||||
public Inventory() {
|
||||
}
|
||||
|
||||
public Inventory(int iItemID, String sItemName, int iInStore, double dManuPrice, double dSellPrice) {
|
||||
this.iItemID = iItemID;
|
||||
this.sItemName = sItemName;
|
||||
this.iInStore = iInStore;
|
||||
this.dManuPrice = dManuPrice;
|
||||
this.dSellPrice = dSellPrice;
|
||||
}
|
||||
|
||||
public double getdManuPrice() {
|
||||
return dManuPrice;
|
||||
}
|
||||
|
||||
public void setdManuPrice(double dManuPrice) {
|
||||
this.dManuPrice = dManuPrice;
|
||||
}
|
||||
|
||||
public double getdSellPrice() {
|
||||
return dSellPrice;
|
||||
}
|
||||
|
||||
public void setdSellPrice(double dSellPrice) {
|
||||
this.dSellPrice = dSellPrice;
|
||||
}
|
||||
|
||||
public int getiInStore() {
|
||||
return iInStore;
|
||||
}
|
||||
|
||||
public void setiInStore(int iInStore) {
|
||||
this.iInStore = iInStore;
|
||||
}
|
||||
|
||||
public int getiItemID() {
|
||||
return iItemID;
|
||||
}
|
||||
|
||||
public void setiItemID(int iItemID) {
|
||||
this.iItemID = iItemID;
|
||||
}
|
||||
|
||||
public String getsItemName() {
|
||||
return sItemName;
|
||||
}
|
||||
|
||||
public void setsItemName(String sItemName) {
|
||||
this.sItemName = sItemName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return ""+this.getiInStore();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class Order {
|
||||
private Customer customer;
|
||||
private Inventory item;
|
||||
private int quantity;
|
||||
private double total;
|
||||
|
||||
public Order() {
|
||||
}
|
||||
|
||||
public double getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(double total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Order(Customer customer, Inventory item, int quantity, double total)
|
||||
throws InsufcientQuantityException {
|
||||
this.customer = customer;
|
||||
this.item = item;
|
||||
if (item.getiInStore() > quantity)
|
||||
{
|
||||
throw new InsufcientQuantityException();
|
||||
}
|
||||
else {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public Inventory getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(Inventory item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public double computePrice() {
|
||||
return (this.quantity * this.item.getdManuPrice());
|
||||
}
|
||||
|
||||
private static class InsufcientQuantityException extends Exception {
|
||||
|
||||
public InsufcientQuantityException() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,917 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class gui extends javax.swing.JFrame {
|
||||
|
||||
public static boolean jpanel2_set = false;
|
||||
public static boolean jpanel3_set = false;
|
||||
/**
|
||||
* Creates new form gui
|
||||
*/
|
||||
public gui() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jTabbedPane1 = new javax.swing.JTabbedPane();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
jLabel15 = new javax.swing.JLabel();
|
||||
customer_stateL = new javax.swing.JLabel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
customer_address2L = new javax.swing.JLabel();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jLabel9 = new javax.swing.JLabel();
|
||||
customer_zipL = new javax.swing.JLabel();
|
||||
customer_idL = new javax.swing.JLabel();
|
||||
jLabel13 = new javax.swing.JLabel();
|
||||
customer_nameL = new javax.swing.JLabel();
|
||||
jLabel11 = new javax.swing.JLabel();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
customer_address1L = new javax.swing.JLabel();
|
||||
customer_cityL = new javax.swing.JLabel();
|
||||
jPanel8 = new javax.swing.JPanel();
|
||||
jScrollPane3 = new javax.swing.JScrollPane();
|
||||
customer_id_list = new javax.swing.JList();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jScrollPane4 = new javax.swing.JScrollPane();
|
||||
customer_name_list = new javax.swing.JList();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jLabel10 = new javax.swing.JLabel();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
lblItemID = new javax.swing.JLabel();
|
||||
lblItemPriceD = new javax.swing.JLabel();
|
||||
lblItemNameD = new javax.swing.JLabel();
|
||||
lblItemStock = new javax.swing.JLabel();
|
||||
lblItemIDD = new javax.swing.JLabel();
|
||||
lblItemStockD = new javax.swing.JLabel();
|
||||
lblItemPrice = new javax.swing.JLabel();
|
||||
lblItemName = new javax.swing.JLabel();
|
||||
jPanel6 = new javax.swing.JPanel();
|
||||
lblInventoryItems = new javax.swing.JLabel();
|
||||
lblByID = new javax.swing.JLabel();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
item_by_name = new javax.swing.JList();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
item_by_id = new javax.swing.JList();
|
||||
lblByName = new javax.swing.JLabel();
|
||||
jLabel18 = new javax.swing.JLabel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel7 = new javax.swing.JPanel();
|
||||
jLabel12 = new javax.swing.JLabel();
|
||||
jLabel17 = new javax.swing.JLabel();
|
||||
order_customerID = new javax.swing.JLabel();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
order_customerName = new javax.swing.JLabel();
|
||||
order_itemID = new javax.swing.JLabel();
|
||||
jLabel19 = new javax.swing.JLabel();
|
||||
order_itemName = new javax.swing.JLabel();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
order_itemStock = new javax.swing.JLabel();
|
||||
order_itemQty = new javax.swing.JTextField();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jLabel14 = new javax.swing.JLabel();
|
||||
jPanel9 = new javax.swing.JPanel();
|
||||
jLabel22 = new javax.swing.JLabel();
|
||||
order_city = new javax.swing.JLabel();
|
||||
jLabel21 = new javax.swing.JLabel();
|
||||
jLabel29 = new javax.swing.JLabel();
|
||||
order_zip = new javax.swing.JLabel();
|
||||
order_state = new javax.swing.JLabel();
|
||||
order_address1 = new javax.swing.JLabel();
|
||||
jLabel16 = new javax.swing.JLabel();
|
||||
order_address2 = new javax.swing.JLabel();
|
||||
jLabel23 = new javax.swing.JLabel();
|
||||
jLabel20 = new javax.swing.JLabel();
|
||||
jComboBox1 = new javax.swing.JComboBox();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jMenuBar1 = new javax.swing.JMenuBar();
|
||||
jMenu1 = new javax.swing.JMenu();
|
||||
jMenuItem1 = new javax.swing.JMenuItem();
|
||||
jMenu2 = new javax.swing.JMenu();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setTitle("Customer Information Control System");
|
||||
|
||||
jTabbedPane1.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
|
||||
|
||||
jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
||||
jLabel15.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel15.setText("Zip:");
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel3.setText("Name:");
|
||||
|
||||
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel5.setText("Customer ID:");
|
||||
|
||||
jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel9.setText("Address 2:");
|
||||
|
||||
jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel13.setText("State:");
|
||||
|
||||
jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel11.setText("City:");
|
||||
|
||||
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel7.setText("Address 1:");
|
||||
|
||||
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
|
||||
jPanel5.setLayout(jPanel5Layout);
|
||||
jPanel5Layout.setHorizontalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addGap(25, 25, 25)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel13)
|
||||
.addComponent(jLabel11)
|
||||
.addComponent(jLabel15))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(customer_cityL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(customer_stateL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(customer_zipL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addGap(12, 12, 12)
|
||||
.addComponent(jLabel5)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(customer_idL, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE))
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel9)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addComponent(jLabel7))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(customer_nameL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(customer_address1L, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(customer_address2L, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel5Layout.setVerticalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(customer_idL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(11, 11, 11)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel3)
|
||||
.addComponent(customer_nameL, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(customer_address1L, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(11, 11, 11)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(customer_address2L, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(customer_cityL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel13)
|
||||
.addComponent(customer_stateL, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addComponent(jLabel15)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(customer_zipL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel8.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
||||
customer_id_list.setModel(new javax.swing.AbstractListModel() {
|
||||
String[] strings = main.customer_get('a');
|
||||
public int getSize() { return strings.length; }
|
||||
public Object getElementAt(int i) { return strings[i]; }
|
||||
});
|
||||
customer_id_list.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
|
||||
customer_id_listValueChanged(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane3.setViewportView(customer_id_list);
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel1.setText("Customer Name:");
|
||||
|
||||
customer_name_list.setModel(new javax.swing.AbstractListModel() {
|
||||
String[] strings = main.customer_get('b');
|
||||
public int getSize() { return strings.length; }
|
||||
public Object getElementAt(int i) { return strings[i]; }
|
||||
});
|
||||
customer_name_list.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
|
||||
customer_name_listValueChanged(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane4.setViewportView(customer_name_list);
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel2.setText("Customer ID:");
|
||||
|
||||
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
|
||||
jPanel8.setLayout(jPanel8Layout);
|
||||
jPanel8Layout.setHorizontalGroup(
|
||||
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel8Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel8Layout.setVerticalGroup(
|
||||
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel8Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jLabel2))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel10.setText("Customer Information:");
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel10)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(jLabel10)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(21, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Customers", jPanel1);
|
||||
|
||||
jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
||||
lblItemID.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblItemID.setText("Item ID:");
|
||||
|
||||
lblItemStock.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblItemStock.setText("Item Stock:");
|
||||
|
||||
lblItemPrice.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblItemPrice.setText("Item Price:");
|
||||
|
||||
lblItemName.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblItemName.setText("Item Name:");
|
||||
|
||||
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
||||
jPanel4.setLayout(jPanel4Layout);
|
||||
jPanel4Layout.setHorizontalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblItemPrice, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblItemStock, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblItemID, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblItemName, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblItemStockD, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(lblItemIDD, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
|
||||
.addComponent(lblItemPriceD, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGap(0, 62, Short.MAX_VALUE))
|
||||
.addComponent(lblItemNameD, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel4Layout.setVerticalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(lblItemName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblItemNameD, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(11, 11, 11)
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(lblItemIDD, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblItemID, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblItemPrice)
|
||||
.addComponent(lblItemPriceD, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addComponent(lblItemStock)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(lblItemStockD, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
||||
lblInventoryItems.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblInventoryItems.setText("Inventory Items:");
|
||||
|
||||
lblByID.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblByID.setText("By ID");
|
||||
|
||||
item_by_name.setModel(new javax.swing.AbstractListModel() {
|
||||
String[] strings = main.item_get('b');
|
||||
public int getSize() { return strings.length; }
|
||||
public Object getElementAt(int i) { return strings[i]; }
|
||||
});
|
||||
item_by_name.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
|
||||
item_by_nameValueChanged(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane2.setViewportView(item_by_name);
|
||||
|
||||
item_by_id.setModel(new javax.swing.AbstractListModel() {
|
||||
String[] strings = main.item_get('a');
|
||||
public int getSize() { return strings.length; }
|
||||
public Object getElementAt(int i) { return strings[i]; }
|
||||
});
|
||||
item_by_id.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
|
||||
item_by_idValueChanged(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane1.setViewportView(item_by_id);
|
||||
|
||||
lblByName.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblByName.setText("By Name");
|
||||
|
||||
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
|
||||
jPanel6.setLayout(jPanel6Layout);
|
||||
jPanel6Layout.setHorizontalGroup(
|
||||
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(lblByID, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblByName)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addGap(19, 19, 19)
|
||||
.addComponent(lblInventoryItems)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel6Layout.setVerticalGroup(
|
||||
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblInventoryItems)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblByName)
|
||||
.addComponent(lblByID, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jLabel18.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel18.setText("Inventory Information:");
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(25, 25, 25)
|
||||
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel18)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(53, 53, 53))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel18)
|
||||
.addGap(12, 12, 12)
|
||||
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
/*
|
||||
jTabbedPane1.addTab("Inventory", jPanel2);
|
||||
*/
|
||||
jPanel7.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
||||
jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel12.setText("Item Quantity:");
|
||||
|
||||
jLabel17.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel17.setText("Customer Name:");
|
||||
|
||||
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel4.setText("Item Name:");
|
||||
|
||||
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel8.setText("Item ID:");
|
||||
|
||||
jLabel19.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel19.setText("Customer ID:");
|
||||
|
||||
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel6.setText("Item Stock:");
|
||||
|
||||
order_itemQty.setText("0");
|
||||
order_itemQty.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
order_itemQtyActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
|
||||
jPanel7.setLayout(jPanel7Layout);
|
||||
jPanel7Layout.setHorizontalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel12)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel17)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addComponent(jLabel19)
|
||||
.addGap(2, 2, 2))
|
||||
.addComponent(jLabel8))
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(order_itemName, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_customerID, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_itemID, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_itemStock, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_customerName, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_itemQty, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel7Layout.setVerticalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_customerName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel19)
|
||||
.addComponent(order_customerID, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_itemName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel8)
|
||||
.addComponent(order_itemID, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(order_itemStock, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel12)
|
||||
.addComponent(order_itemQty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(14, 14, 14))
|
||||
);
|
||||
|
||||
jButton1.setText("Submit");
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel14.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel14.setText("Order Summery:");
|
||||
|
||||
jPanel9.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
|
||||
jLabel22.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel22.setText("City:");
|
||||
|
||||
jLabel21.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel21.setText("Address 2:");
|
||||
|
||||
jLabel29.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel29.setText("Zip Code:");
|
||||
|
||||
jLabel16.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel16.setText("Address 1:");
|
||||
|
||||
jLabel23.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel23.setText("State:");
|
||||
|
||||
jLabel20.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel20.setText("Payment Type:");
|
||||
|
||||
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Cash", "Credit" }));
|
||||
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jComboBox1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
|
||||
jPanel9.setLayout(jPanel9Layout);
|
||||
jPanel9Layout.setHorizontalGroup(
|
||||
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addComponent(jLabel20)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jComboBox1, 0, 97, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout.createSequentialGroup()
|
||||
.addGap(13, 13, 13)
|
||||
.addComponent(jLabel29)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel21)
|
||||
.addComponent(jLabel22)
|
||||
.addComponent(jLabel16)
|
||||
.addComponent(jLabel23))))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(order_address2, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
|
||||
.addComponent(order_state, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_city, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_address1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_zip, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel9Layout.setVerticalGroup(
|
||||
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_address1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_address2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_city, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(11, 11, 11)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(order_state, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel29)
|
||||
.addComponent(order_zip, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel20)
|
||||
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jButton2.setText("Reset");
|
||||
|
||||
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
|
||||
jPanel3.setLayout(jPanel3Layout);
|
||||
jPanel3Layout.setHorizontalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(jButton2)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jButton1))
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addComponent(jLabel14)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel3Layout.setVerticalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addGap(7, 7, 7)
|
||||
.addComponent(jLabel14)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(35, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jButton2)
|
||||
.addComponent(jButton1))
|
||||
.addContainerGap())
|
||||
);
|
||||
/*
|
||||
jTabbedPane1.addTab("Order", jPanel3);
|
||||
*/
|
||||
jMenu1.setText("File");
|
||||
|
||||
jMenuItem1.setText("Close");
|
||||
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jMenuItem1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jMenu1.add(jMenuItem1);
|
||||
|
||||
jMenuBar1.add(jMenu1);
|
||||
|
||||
jMenu2.setText("Edit");
|
||||
jMenuBar1.add(jMenu2);
|
||||
|
||||
setJMenuBar(jMenuBar1);
|
||||
|
||||
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()
|
||||
.addComponent(jTabbedPane1))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
System.exit(0);
|
||||
}//GEN-LAST:event_jMenuItem1ActionPerformed
|
||||
|
||||
private void customer_name_listValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_customer_name_listValueChanged
|
||||
// TODO add your handling code here:
|
||||
customer_id_list.setSelectedIndex(customer_name_list.getSelectedIndex());
|
||||
customer_idL.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerID());
|
||||
customer_nameL.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerName());
|
||||
customer_address1L.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerAddress1());
|
||||
customer_address2L.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerAddress2());
|
||||
customer_cityL.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerCity());
|
||||
customer_stateL.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerState());
|
||||
customer_zipL.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerZip());
|
||||
|
||||
order_customerID.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerID());
|
||||
order_customerName.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerName());
|
||||
order_address1.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerAddress1());
|
||||
order_address2.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerAddress2());
|
||||
order_city.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerCity());
|
||||
order_state.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerState());
|
||||
order_zip.setText(""+main.cu.get(customer_name_list.getSelectedIndex()).getCustomerZip());
|
||||
if (!jpanel2_set) {
|
||||
jTabbedPane1.addTab("Inventory", jPanel2);
|
||||
jpanel2_set = true;
|
||||
}
|
||||
jTabbedPane1.setSelectedComponent(jPanel2);
|
||||
}//GEN-LAST:event_customer_name_listValueChanged
|
||||
|
||||
private void customer_id_listValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_customer_id_listValueChanged
|
||||
// TODO add your handling code here:
|
||||
customer_name_list.setSelectedIndex(customer_id_list.getSelectedIndex());
|
||||
}//GEN-LAST:event_customer_id_listValueChanged
|
||||
|
||||
private void order_itemQtyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_order_itemQtyActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_order_itemQtyActionPerformed
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void item_by_idValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_item_by_idValueChanged
|
||||
// TODO add your handling code here:
|
||||
item_by_name.setSelectedIndex(item_by_id.getSelectedIndex());
|
||||
lblItemNameD.setText(""+main.al.get(item_by_id.getSelectedIndex()).getsItemName());
|
||||
lblItemIDD.setText(""+main.al.get(item_by_id.getSelectedIndex()).getiItemID());
|
||||
lblItemPriceD.setText(""+main.al.get(item_by_id.getSelectedIndex()).getdSellPrice());
|
||||
lblItemStockD.setText(""+main.al.get(item_by_id.getSelectedIndex()).getiInStore());
|
||||
|
||||
order_itemID.setText(""+main.al.get(item_by_id.getSelectedIndex()).getiItemID());
|
||||
order_itemName.setText(""+main.al.get(item_by_id.getSelectedIndex()).getsItemName());
|
||||
order_itemStock.setText(""+main.al.get(item_by_id.getSelectedIndex()).getiInStore());
|
||||
if (!jpanel3_set) {
|
||||
jTabbedPane1.addTab("Order", jPanel3);
|
||||
jpanel2_set = true;
|
||||
}
|
||||
jTabbedPane1.setSelectedComponent(jPanel3);
|
||||
}//GEN-LAST:event_item_by_idValueChanged
|
||||
|
||||
private void item_by_nameValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_item_by_nameValueChanged
|
||||
// TODO add your handling code here:
|
||||
item_by_id.setSelectedIndex(item_by_name.getSelectedIndex());
|
||||
}//GEN-LAST:event_item_by_nameValueChanged
|
||||
|
||||
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_jComboBox1ActionPerformed
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
/*
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
} */
|
||||
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
|
||||
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(gui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new gui().setVisible(true);
|
||||
}
|
||||
});
|
||||
//customer_id_list.setListData(new String[]{"omg", "lol", "wut"});
|
||||
}
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel customer_address1L;
|
||||
private javax.swing.JLabel customer_address2L;
|
||||
private javax.swing.JLabel customer_cityL;
|
||||
private javax.swing.JLabel customer_idL;
|
||||
private static javax.swing.JList customer_id_list;
|
||||
private javax.swing.JLabel customer_nameL;
|
||||
private static javax.swing.JList customer_name_list;
|
||||
private javax.swing.JLabel customer_stateL;
|
||||
private javax.swing.JLabel customer_zipL;
|
||||
private javax.swing.JList item_by_id;
|
||||
private javax.swing.JList item_by_name;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JComboBox jComboBox1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel10;
|
||||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel12;
|
||||
private javax.swing.JLabel jLabel13;
|
||||
private javax.swing.JLabel jLabel14;
|
||||
private javax.swing.JLabel jLabel15;
|
||||
private javax.swing.JLabel jLabel16;
|
||||
private javax.swing.JLabel jLabel17;
|
||||
private javax.swing.JLabel jLabel18;
|
||||
private javax.swing.JLabel jLabel19;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel20;
|
||||
private javax.swing.JLabel jLabel21;
|
||||
private javax.swing.JLabel jLabel22;
|
||||
private javax.swing.JLabel jLabel23;
|
||||
private javax.swing.JLabel jLabel29;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private javax.swing.JMenu jMenu1;
|
||||
private javax.swing.JMenu jMenu2;
|
||||
private javax.swing.JMenuBar jMenuBar1;
|
||||
private javax.swing.JMenuItem jMenuItem1;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JPanel jPanel5;
|
||||
private javax.swing.JPanel jPanel6;
|
||||
private javax.swing.JPanel jPanel7;
|
||||
private javax.swing.JPanel jPanel8;
|
||||
private javax.swing.JPanel jPanel9;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JScrollPane jScrollPane3;
|
||||
private javax.swing.JScrollPane jScrollPane4;
|
||||
private javax.swing.JTabbedPane jTabbedPane1;
|
||||
private javax.swing.JLabel lblByID;
|
||||
private javax.swing.JLabel lblByName;
|
||||
private javax.swing.JLabel lblInventoryItems;
|
||||
private javax.swing.JLabel lblItemID;
|
||||
private javax.swing.JLabel lblItemIDD;
|
||||
private javax.swing.JLabel lblItemName;
|
||||
private javax.swing.JLabel lblItemNameD;
|
||||
private javax.swing.JLabel lblItemPrice;
|
||||
private javax.swing.JLabel lblItemPriceD;
|
||||
private javax.swing.JLabel lblItemStock;
|
||||
private javax.swing.JLabel lblItemStockD;
|
||||
private javax.swing.JLabel order_address1;
|
||||
private javax.swing.JLabel order_address2;
|
||||
private javax.swing.JLabel order_city;
|
||||
private javax.swing.JLabel order_customerID;
|
||||
private javax.swing.JLabel order_customerName;
|
||||
private javax.swing.JLabel order_itemID;
|
||||
private javax.swing.JLabel order_itemName;
|
||||
private javax.swing.JTextField order_itemQty;
|
||||
private javax.swing.JLabel order_itemStock;
|
||||
private javax.swing.JLabel order_state;
|
||||
private javax.swing.JLabel order_zip;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class main {
|
||||
|
||||
protected static ArrayList<Inventory> al = inventory_init();
|
||||
protected static ArrayList<Customer> cu = customer_init();
|
||||
protected static ArrayList<Order> or = order_init();
|
||||
|
||||
protected static ArrayList<Inventory> inventory_init()
|
||||
{
|
||||
ArrayList<Inventory> al = new ArrayList<Inventory>(5);
|
||||
al.add(0, new Inventory(12,"Circular saw", 150, 45.00, 125.00));
|
||||
al.add(1, new Inventory(235,"Cooking range", 50, 450.00, 850.00));
|
||||
al.add(2, new Inventory(301,"Table saw", 100, 125.00, 300.00));
|
||||
al.add(3, new Inventory(302,"Stapler\t", 300, 18.00, 49.00));
|
||||
al.add(4, new Inventory(303,"Lawn tractor", 5, 300.00, 650.00));
|
||||
return al;
|
||||
}
|
||||
|
||||
protected static ArrayList<Customer> customer_init() {
|
||||
ArrayList<Customer> cu = new ArrayList<Customer>(5);
|
||||
cu.add(0,new Customer(0, "Kermit Thefrog", "8888 Balboa Avenue", "", "San Diego", "CA", "92123"));
|
||||
return cu;
|
||||
}
|
||||
|
||||
protected static String[] customer_get(char type) {
|
||||
String[] ret = new String[cu.size()];
|
||||
int count = 0;
|
||||
switch(type) {
|
||||
case 'a':
|
||||
for(Customer x:cu) {
|
||||
ret[count] = ""+x.CustomerID;
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
for(Customer x:cu){
|
||||
ret[count] = ""+x.getCustomerName();
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected static String[] item_get(char type) {
|
||||
String[] ret = new String[al.size()];
|
||||
int count = 0;
|
||||
switch(type) {
|
||||
case 'a':
|
||||
for(Inventory x:al) {
|
||||
ret[count] = ""+x.getiItemID();
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
for(Inventory x:al){
|
||||
ret[count] = ""+x.getsItemName();
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected static ArrayList<Order> order_init() {
|
||||
ArrayList<Order> or = new ArrayList<Order>(5);
|
||||
return or;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="Project4" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project Project4.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="Project4-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=00cce126
|
||||
build.xml.script.CRC32=ccadb02c
|
||||
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=00cce126
|
||||
nbproject/build-impl.xml.script.CRC32=43cc4ad2
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Documents and Settings\\77260\\Application Data\\NetBeans\\7.2\\build.properties
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -0,0 +1,72 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/Project4.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${libs.beans-binding.classpath}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=project4.Project4
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>Project4</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project4;
|
||||
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class Project4 {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SwingSuspendResume vsr = new SwingSuspendResume();
|
||||
Thread t = new Thread(vsr);
|
||||
t.start();
|
||||
|
||||
JFrame f = new JFrame();
|
||||
f.setContentPane(vsr);
|
||||
f.setSize(320, 200);
|
||||
f.setVisible(true);
|
||||
f.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project4;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class SwingSuspendResume extends JPanel implements Runnable {
|
||||
|
||||
private static final String[] symbolList = { "|", "/", "-", "\\", "|", "/",
|
||||
"-", "\\" };
|
||||
|
||||
private Thread runThread;
|
||||
|
||||
private JTextField symbolTF;
|
||||
|
||||
public SwingSuspendResume() {
|
||||
symbolTF = new JTextField();
|
||||
symbolTF.setEditable(false);
|
||||
symbolTF.setFont(new Font("Monospaced", Font.BOLD, 26));
|
||||
symbolTF.setHorizontalAlignment(JTextField.CENTER);
|
||||
|
||||
final JButton suspendB = new JButton("Suspend");
|
||||
final JButton resumeB = new JButton("Resume");
|
||||
final JSlider jSlider1 = new javax.swing.JSlider();
|
||||
final JButton jButton1 = new JButton("Reverse");
|
||||
|
||||
suspendB.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
suspendNow();
|
||||
}
|
||||
});
|
||||
|
||||
resumeB.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
resumeNow();
|
||||
}
|
||||
});
|
||||
|
||||
jSlider1.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent ce)
|
||||
{
|
||||
changeval(jSlider1.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
jButton1.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
toggle();
|
||||
}
|
||||
});
|
||||
|
||||
JPanel innerStackP = new JPanel();
|
||||
innerStackP.setLayout(new GridLayout(0, 1, 4, 4));
|
||||
innerStackP.add(symbolTF);
|
||||
innerStackP.add(suspendB);
|
||||
innerStackP.add(resumeB);
|
||||
innerStackP.add(jSlider1);
|
||||
innerStackP.add(jButton1);
|
||||
|
||||
this.setLayout(new FlowLayout(FlowLayout.CENTER));
|
||||
this.add(innerStackP);
|
||||
}
|
||||
|
||||
private void changeval(int value) {
|
||||
sleepcount = (value *2);
|
||||
//System.out.println(value);
|
||||
}
|
||||
private void toggle() {
|
||||
if (toggle)
|
||||
{
|
||||
toggle = false;
|
||||
} else {
|
||||
toggle = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void suspendNow() {
|
||||
if (runThread != null) { // avoid NullPointerException
|
||||
runThread.suspend();
|
||||
}
|
||||
}
|
||||
|
||||
private void resumeNow() {
|
||||
if (runThread != null) { // avoid NullPointerException
|
||||
runThread.resume();
|
||||
}
|
||||
}
|
||||
|
||||
public int sleepcount = 200;
|
||||
public boolean toggle = false;
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// Store this for the suspendNow() and
|
||||
// resumeNow() methods to use.
|
||||
runThread = Thread.currentThread();
|
||||
int count = 0;
|
||||
|
||||
while (true) {
|
||||
// each time through, show the next symbol
|
||||
symbolTF.setText(symbolList[count % symbolList.length]);
|
||||
Thread.sleep(sleepcount);
|
||||
if (toggle)
|
||||
{
|
||||
if (count == 0)
|
||||
{ count = 2147483647; }
|
||||
count--;
|
||||
} else {
|
||||
if (count == 2147483647)
|
||||
{ count = 0; }
|
||||
count++;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException x) {
|
||||
// ignore
|
||||
} finally {
|
||||
// make sure that the reference to it is also lost.
|
||||
runThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SwingSuspendResume vsr = new SwingSuspendResume();
|
||||
Thread t = new Thread(vsr);
|
||||
t.start();
|
||||
|
||||
JFrame f = new JFrame();
|
||||
f.setContentPane(vsr);
|
||||
f.setSize(320, 200);
|
||||
f.setVisible(true);
|
||||
f.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="54" max="-2" attributes="0"/>
|
||||
<Component id="jSlider1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="146" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="63" max="-2" attributes="0"/>
|
||||
<Component id="jSlider1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="212" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JSlider" name="jSlider1">
|
||||
<BindingProperties>
|
||||
<BindingProperty name="value" source="jSlider1" sourcePath="${value}" target="jSlider1" targetPath="value" updateStrategy="0" immediately="false">
|
||||
<BindingParameter name="IGNORE_ADJUSTING" value="N"/>
|
||||
</BindingProperty>
|
||||
</BindingProperties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package project4;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 77260
|
||||
*/
|
||||
public class test extends javax.swing.JFrame {
|
||||
|
||||
/**
|
||||
* Creates new form test
|
||||
*/
|
||||
public test() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
|
||||
|
||||
jSlider1 = new javax.swing.JSlider();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jSlider1, org.jdesktop.beansbinding.ELProperty.create("${value}"), jSlider1, org.jdesktop.beansbinding.BeanProperty.create("value"));
|
||||
bindingGroup.addBinding(binding);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(54, 54, 54)
|
||||
.addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(146, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(63, 63, 63)
|
||||
.addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(212, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
bindingGroup.bind();
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
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(test.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(test.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(test.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(test.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new test().setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JSlider jSlider1;
|
||||
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
12,Circular saw ,125
|
||||
235,Cooking range ,850
|
||||
301,Table saw ,300
|
||||
302,Stapler ,49
|
||||
303,Lawn Tractor ,650
|
||||
400,Pencils (gross) ,29.95
|
||||
999,Pens(gross) ,39.95
|
||||
|
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="btree" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project btree.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="btree-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
========================
|
||||
BUILD OUTPUT DESCRIPTION
|
||||
========================
|
||||
|
||||
When you build an Java application project that has a main class, the IDE
|
||||
automatically copies all of the JAR
|
||||
files on the projects classpath to your projects dist/lib folder. The IDE
|
||||
also adds each of the JAR files to the Class-Path element in the application
|
||||
JAR files manifest file (MANIFEST.MF).
|
||||
|
||||
To run the project from the command line, go to the dist folder and
|
||||
type the following:
|
||||
|
||||
java -jar "btree.jar"
|
||||
|
||||
To distribute this project, zip up the dist folder (including the lib folder)
|
||||
and distribute the ZIP file.
|
||||
|
||||
Notes:
|
||||
|
||||
* If two JAR files on the project classpath have the same name, only the first
|
||||
JAR file is copied to the lib folder.
|
||||
* Only JAR files are copied to the lib folder.
|
||||
If the classpath contains other types of files or folders, these files (folders)
|
||||
are not copied.
|
||||
* If a library on the projects classpath also has a Class-Path element
|
||||
specified in the manifest,the content of the Class-Path element has to be on
|
||||
the projects runtime path.
|
||||
* To set a main class in a standard Java project, right-click the project node
|
||||
in the Projects window and choose Properties. Then click Run and enter the
|
||||
class name in the Main Class field. Alternatively, you can manually type the
|
||||
class name in the manifest Main-Class element.
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=dd7311e0
|
||||
build.xml.script.CRC32=b7790081
|
||||
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=dd7311e0
|
||||
nbproject/build-impl.xml.script.CRC32=0f79c8dc
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Users\\Amrit\\AppData\\Roaming\\NetBeans\\7.2.1\\build.properties
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -0,0 +1,71 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/btree.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.7
|
||||
javac.target=1.7
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=btree.Btree
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>btree</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,120 @@
|
||||
/******************************************************************************
|
||||
* Project: btree *
|
||||
* Class Name: Btree *
|
||||
* Author: Amrit Panesar <apanesar@coleman.edu> *
|
||||
* Created On: Nov 7, 2012 *
|
||||
* Hours: X.XX Hours *
|
||||
* Purpose: TODO: Write purpose here. *
|
||||
******************************************************************************/
|
||||
|
||||
package btree;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Scanner;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class Btree {
|
||||
|
||||
/**
|
||||
* @param argv the command line ARGument Vector
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
int argc = args.length;
|
||||
Scanner inFile = null;
|
||||
try {
|
||||
inFile = new Scanner(new FileReader("Product.csv"));
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(Btree.class.getName()).log(Level.SEVERE, null, ex);
|
||||
System.out.print("File not found, please make product.csv");
|
||||
System.exit(0);
|
||||
}
|
||||
int count = -999;
|
||||
int arrfield = 0;
|
||||
while(inFile.hasNext())
|
||||
{
|
||||
String thisrowstring = inFile.nextLine();
|
||||
String[] thisrow = thisrowstring.split(",");
|
||||
arrfield = thisrow.length;
|
||||
if (count == -999) { count = 0; }
|
||||
count++;
|
||||
}
|
||||
inFile.close();
|
||||
try {
|
||||
inFile = new Scanner(new FileReader("product.csv"));
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(Btree.class.getName()).log(Level.SEVERE, null, ex);
|
||||
System.out.print("File not found, please make product.csv");
|
||||
System.exit(0);
|
||||
}
|
||||
String[][] csv = new String[count][arrfield];
|
||||
Product[] p = new Product[count];
|
||||
//System.out.println("count = "+count);
|
||||
//System.out.println("arrfield = "+arrfield);
|
||||
count = 0;
|
||||
while(inFile.hasNext())
|
||||
{
|
||||
String thisrowstring = inFile.nextLine();
|
||||
String[] thisrow = thisrowstring.split(",");
|
||||
int i = 0;
|
||||
for (String t:thisrow)
|
||||
{
|
||||
csv[count][i] = t;
|
||||
i++;
|
||||
}
|
||||
p[count] = new Product(csv[count]);
|
||||
if(count == 0) {
|
||||
count++;
|
||||
continue;
|
||||
}
|
||||
Product w = p[0];
|
||||
while(true)
|
||||
{
|
||||
if(w.getiProdNumb() <= p[count].getiProdNumb())
|
||||
{
|
||||
if (w.hasLT())
|
||||
{
|
||||
w = w.getpLT();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
w.setpLT(p[count]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (w.hasGT())
|
||||
{
|
||||
w = w.getpGT();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
w.setpGT(p[count]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
System.out.println("Item\tDescription\tPrice");
|
||||
iot(p[0]);
|
||||
}
|
||||
public static void iot(Product theRootNode)
|
||||
{
|
||||
if (theRootNode != null) {
|
||||
iot(theRootNode.getpGT());
|
||||
System.out.println(theRootNode);
|
||||
//System.out.println("\t\\- R Sibling -> "+theRootNode.getpGT());
|
||||
//System.out.println("\t\\- L Sibling -> "+theRootNode.getpLT());
|
||||
iot(theRootNode.getpLT());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
12,Circular saw ,125
|
||||
235,Cooking range ,850
|
||||
301,Table saw ,300
|
||||
302,Stapler ,49
|
||||
303,Lawn Tractor ,650
|
||||
400,Pencils (gross) ,29.95
|
||||
999,Pens(gross) ,39.95
|
||||
|
@@ -0,0 +1,118 @@
|
||||
/******************************************************************************
|
||||
* Project: btree *
|
||||
* Class Name: Product *
|
||||
* Author: Amrit Panesar <apanesar@coleman.edu> *
|
||||
* Created On: Nov 7, 2012 *
|
||||
* Hours: X.XX Hours *
|
||||
* Purpose: TODO: Write purpose here. *
|
||||
******************************************************************************/
|
||||
|
||||
package btree;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class Product {
|
||||
|
||||
private int iProdNumb;
|
||||
private String sDescrpt;
|
||||
private double dPrice;
|
||||
private Product pGT = null;
|
||||
private Product pLT = null;
|
||||
|
||||
public Product(int iProdNumb, String sDescrpt, double dPrice) {
|
||||
this.iProdNumb = iProdNumb;
|
||||
this.sDescrpt = sDescrpt;
|
||||
this.dPrice = dPrice;
|
||||
}
|
||||
|
||||
public Product(String[] arr) {
|
||||
if(arr.length == 3)
|
||||
{
|
||||
this.iProdNumb = Integer.parseInt(arr[0]);
|
||||
this.sDescrpt = arr[1];
|
||||
this.dPrice = Double.parseDouble(arr[2]);
|
||||
}
|
||||
}
|
||||
|
||||
public Product() {
|
||||
}
|
||||
|
||||
public Product getpGT() {
|
||||
return pGT;
|
||||
}
|
||||
|
||||
public void setpGT(Product pGT) {
|
||||
this.pGT = pGT;
|
||||
}
|
||||
|
||||
public Product getpLT() {
|
||||
return pLT;
|
||||
}
|
||||
|
||||
public void setpLT(Product pLT) {
|
||||
this.pLT = pLT;
|
||||
}
|
||||
|
||||
public int getiProdNumb() {
|
||||
return iProdNumb;
|
||||
}
|
||||
|
||||
public void setiProdNumb(int iProdNumb) {
|
||||
this.iProdNumb = iProdNumb;
|
||||
}
|
||||
|
||||
public String getsDescrpt() {
|
||||
return sDescrpt;
|
||||
}
|
||||
|
||||
public void setsDescrpt(String sDescrpt) {
|
||||
this.sDescrpt = sDescrpt;
|
||||
}
|
||||
|
||||
public double getdPrice() {
|
||||
return dPrice;
|
||||
}
|
||||
|
||||
public void setdPrice(double dPrice) {
|
||||
this.dPrice = dPrice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.iProdNumb+"\t"+this.sDescrpt+"\t"+this.dPrice;
|
||||
}
|
||||
|
||||
public boolean hasGT()
|
||||
{
|
||||
if(this.pGT != null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean hasLT()
|
||||
{
|
||||
if(this.pLT != null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasChild()
|
||||
{
|
||||
if(this.pGT != null || this.pLT != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
12,Circular saw ,125
|
||||
235,Cooking range ,850
|
||||
301,Table saw ,300
|
||||
302,Stapler ,49
|
||||
303,Lawn Tractor ,650
|
||||
400,Pencils (gross) ,29.95
|
||||
999,Pens(gross) ,39.95
|
||||
|
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="linkedlist" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project linkedlist.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="linkedlist-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
========================
|
||||
BUILD OUTPUT DESCRIPTION
|
||||
========================
|
||||
|
||||
When you build an Java application project that has a main class, the IDE
|
||||
automatically copies all of the JAR
|
||||
files on the projects classpath to your projects dist/lib folder. The IDE
|
||||
also adds each of the JAR files to the Class-Path element in the application
|
||||
JAR files manifest file (MANIFEST.MF).
|
||||
|
||||
To run the project from the command line, go to the dist folder and
|
||||
type the following:
|
||||
|
||||
java -jar "linkedlist.jar"
|
||||
|
||||
To distribute this project, zip up the dist folder (including the lib folder)
|
||||
and distribute the ZIP file.
|
||||
|
||||
Notes:
|
||||
|
||||
* If two JAR files on the project classpath have the same name, only the first
|
||||
JAR file is copied to the lib folder.
|
||||
* Only JAR files are copied to the lib folder.
|
||||
If the classpath contains other types of files or folders, these files (folders)
|
||||
are not copied.
|
||||
* If a library on the projects classpath also has a Class-Path element
|
||||
specified in the manifest,the content of the Class-Path element has to be on
|
||||
the projects runtime path.
|
||||
* To set a main class in a standard Java project, right-click the project node
|
||||
in the Projects window and choose Properties. Then click Run and enter the
|
||||
class name in the Main Class field. Alternatively, you can manually type the
|
||||
class name in the manifest Main-Class element.
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=eb087925
|
||||
build.xml.script.CRC32=ad128e81
|
||||
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=eb087925
|
||||
nbproject/build-impl.xml.script.CRC32=48e23c93
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
|
||||
@@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Users\\Amrit\\AppData\\Roaming\\NetBeans\\7.2.1\\build.properties
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -0,0 +1,71 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/linkedlist.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=1.7
|
||||
javac.target=1.7
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=linkedlist.Linkedlist
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>linkedlist</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package linkedlist;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.Scanner;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class Linkedlist {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
Scanner inFile = null;
|
||||
try {
|
||||
inFile = new Scanner(new FileReader("Product.csv"));
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(Linkedlist.class.getName()).log(Level.SEVERE, null, ex);
|
||||
System.out.print("File not found, please make product.csv");
|
||||
System.exit(0);
|
||||
}
|
||||
int count = -999;
|
||||
int arrfield = 0;
|
||||
while(inFile.hasNext())
|
||||
{
|
||||
String thisrowstring = inFile.nextLine();
|
||||
String[] thisrow = thisrowstring.split(",");
|
||||
arrfield = thisrow.length;
|
||||
if (count == -999) { count = 0; }
|
||||
count++;
|
||||
}
|
||||
inFile.close();
|
||||
try {
|
||||
inFile = new Scanner(new FileReader("product.csv"));
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(Linkedlist.class.getName()).log(Level.SEVERE, null, ex);
|
||||
System.out.print("File not found, please make product.csv");
|
||||
System.exit(0);
|
||||
}
|
||||
String[][] csv = new String[count][arrfield];
|
||||
Product[] p = new Product[count];
|
||||
//System.out.println("count = "+count);
|
||||
//System.out.println("arrfield = "+arrfield);
|
||||
count = 0;
|
||||
while(inFile.hasNext())
|
||||
{
|
||||
String thisrowstring = inFile.nextLine();
|
||||
String[] thisrow = thisrowstring.split(",");
|
||||
int i = 0;
|
||||
for (String t:thisrow)
|
||||
{
|
||||
csv[count][i] = t;
|
||||
i++;
|
||||
}
|
||||
p[count] = new Product(csv[count]);
|
||||
//System.out.println(p[count].sDescrpt);
|
||||
if (count != 0) { p[count-1].next = p[count]; }
|
||||
//System.out.println(p[count].next);
|
||||
count++;
|
||||
}
|
||||
System.out.println("Item\tDescription\tPrice");
|
||||
Product q = p[0];
|
||||
while(q.hasNext())
|
||||
{
|
||||
System.out.println(q);
|
||||
q=q.next;
|
||||
if(q.hasNext() == false) {
|
||||
System.out.println(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/******************************************************************************
|
||||
* Project: linkedlist *
|
||||
* Class Name: Product *
|
||||
* Author: Amrit Panesar <apanesar@coleman.edu> *
|
||||
* Created On: Nov 5, 2012 *
|
||||
* Hours: X.XX Hours *
|
||||
* Purpose: TODO: Write purpose here. *
|
||||
******************************************************************************/
|
||||
|
||||
package linkedlist;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Amrit Panesar <apanesar@coleman.edu>
|
||||
*/
|
||||
public class Product {
|
||||
public int iProdNumb;
|
||||
public String sDescrpt;
|
||||
public double dPrice;
|
||||
public Product next = null;
|
||||
|
||||
public Product(int iProdNumb, String sDescrpt, double dPrice) {
|
||||
this.iProdNumb = iProdNumb;
|
||||
this.sDescrpt = sDescrpt;
|
||||
this.dPrice = dPrice;
|
||||
}
|
||||
|
||||
public Product(String[] arr) {
|
||||
if(arr.length == 3)
|
||||
{
|
||||
this.iProdNumb = Integer.parseInt(arr[0]);
|
||||
this.sDescrpt = arr[1];
|
||||
this.dPrice = Double.parseDouble(arr[2]);
|
||||
}
|
||||
}
|
||||
|
||||
public Product() {
|
||||
}
|
||||
|
||||
public int getiProdNumb() {
|
||||
return iProdNumb;
|
||||
}
|
||||
|
||||
public void setiProdNumb(int iProdNumb) {
|
||||
this.iProdNumb = iProdNumb;
|
||||
}
|
||||
|
||||
public String getsDescrpt() {
|
||||
return sDescrpt;
|
||||
}
|
||||
|
||||
public void setsDescrpt(String sDescrpt) {
|
||||
this.sDescrpt = sDescrpt;
|
||||
}
|
||||
|
||||
public double getdPrice() {
|
||||
return dPrice;
|
||||
}
|
||||
|
||||
public void setdPrice(double dPrice) {
|
||||
this.dPrice = dPrice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.iProdNumb+"\t"+this.sDescrpt+"\t"+this.dPrice;
|
||||
}
|
||||
|
||||
public boolean hasNext()
|
||||
{
|
||||
if (this.next != null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user