Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

395 changes: 395 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions Barcode_Reader.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../core-3.3.2.jar!/" />
<root url="jar://$MODULE_DIR$/../javase-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../javase-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</orderEntry>
</component>
</module>
6 changes: 6 additions & 0 deletions data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0
testPackage
TestData
TestDataReceived
1234
Step B
Binary file added out/production/Barcode_Reader/BarCode.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Data.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Mainwindow$1.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Mainwindow$2.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Mainwindow$3.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Mainwindow$4.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Mainwindow$5.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Mainwindow$6.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Mainwindow$7.class
Binary file not shown.
Binary file added out/production/Barcode_Reader/Mainwindow.class
Binary file not shown.
59 changes: 59 additions & 0 deletions src/BarCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;


public class BarCode {
private ArrayList<Data> tokens;

public ArrayList<Data> getTokens() {
return tokens;
}

public void setTokens(ArrayList<Data> tokens) {
this.tokens = tokens;
}

BarCode(File input) throws FileNotFoundException{
tokens = new ArrayList<Data>();
loadFromFile(input);
System.out.println("the data already in the list");
}

public void loadFromFile(File inputFile) throws FileNotFoundException{
if(inputFile.canRead()){
Scanner reader = new Scanner(inputFile);
while(reader.hasNext()){
Data temp = new Data();
temp.setGeneratedNumber(Integer.parseInt(reader.nextLine()));
temp.setPackageData(reader.nextLine());
temp.setDataSent(reader.nextLine());
temp.setRecievedData(reader.nextLine());
temp.setIDNumber(Integer.parseInt(reader.nextLine()));
temp.setChoice(reader.nextLine());
tokens.add(temp);
}
System.out.println(1);
reader.close();
}
else{
System.out.println(0);
tokens = null;
}
}
public int FindWithGeneratedCode(int number){
int i = 0;
while(i < tokens.size() ){
if(tokens.get(i).getGeneratedNumber() == number){
return i;
}
i++;
}
return -1;
}

public void addToList(Data temp){
tokens.add(temp);
}
}
46 changes: 46 additions & 0 deletions src/Data.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
public class Data {

private int generatedNumber;
private String packageData;
private String dataSent;
private String recievedData;
private int IDNumber;
private String choice;

public int getGeneratedNumber() {
return generatedNumber;
}
public void setGeneratedNumber(int generatedNumber) {
this.generatedNumber = generatedNumber;
}
public String getPackageData() {
return packageData;
}
public void setPackageData(String packageData) {
this.packageData = packageData;
}
public String getDataSent() {
return dataSent;
}
public void setDataSent(String dataSent) {
this.dataSent = dataSent;
}
public String getRecievedData() {
return recievedData;
}
public void setRecievedData(String recievedData) {
this.recievedData = recievedData;
}
public int getIDNumber() {
return IDNumber;
}
public void setIDNumber(int iDNumber) {
IDNumber = iDNumber;
}
public String getChoice() {
return choice;
}
public void setChoice(String choice) {
this.choice = choice;
}
}
4 changes: 2 additions & 2 deletions src/Mainwindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void actionPerformed(ActionEvent e) {
rdbtnStepB.setBounds(55, 247, 109, 23);
panel_3.add(rdbtnStepB);

rdbtnStepC = new JRadioButton("step B");
rdbtnStepC = new JRadioButton("step C");
rdbtnStepC.setBounds(55, 273, 109, 23);
panel_3.add(rdbtnStepC);

Expand Down Expand Up @@ -224,7 +224,7 @@ public void actionPerformed(ActionEvent e) {
barCodeText.setText("");
} catch (Exception ex) {
// this mean that the input was not a number
System.out.println("wrong entery");
System.out.println("wrong entry");
barCodeText.setText("");
}

Expand Down