-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0688be2
Showing
104 changed files
with
3,074 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="lib" path="lib/jxl.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.xls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Chemistry Lab</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/com/qxbytes/chemlab/DetailedItem.java=UTF-8 | ||
encoding//src/com/qxbytes/chemlab/PicturePane.java=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.qxbytes.chemlab; | ||
|
||
import java.awt.Color; | ||
import java.awt.GridLayout; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
|
||
import javax.swing.JButton; | ||
import javax.swing.JLabel; | ||
import javax.swing.JPanel; | ||
/** | ||
* | ||
* @author QxBytes | ||
* | ||
*/ | ||
public class AnalyzePane extends JPanel { | ||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
public AnalyzePane() { | ||
super(); | ||
setLayout(new GridLayout(1,0)); | ||
add(new JLabel("Sort & Analyze")); | ||
JButton eng = new JButton("Electronegativity"); | ||
eng.addActionListener(new ActionListener() { | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
SelectionPane.getInpane().sort(new electronegativityComparator()); | ||
new SortPane(SelectionPane.getInpane(),"Electronegativity- Least to Greatest"); | ||
} | ||
|
||
}); | ||
add(eng); | ||
JButton size = new JButton("Atomic Radius"); | ||
size.addActionListener(new ActionListener() { | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent arg0) { | ||
SelectionPane.getInpane().sort(new sizeComparator()); | ||
new SortPane(SelectionPane.getInpane(),"Size- Smallest to Largest"); | ||
} | ||
|
||
}); | ||
add(size); | ||
JButton alpha = new JButton("Alphabetize"); | ||
alpha.addActionListener(new ActionListener() { | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
SelectionPane.getInpane().sort(new lexographicComparator()); | ||
new SortPane(SelectionPane.getInpane(),"Alphabetize- a-z"); | ||
} | ||
|
||
}); | ||
add(alpha); | ||
JButton sort = new JButton("Num. Sort"); | ||
sort.addActionListener(new ActionListener() { | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
SelectionPane.getInpane().sort(new numberComparator()); | ||
new SortPane(SelectionPane.getInpane(),"Atom. Num- Low-High"); | ||
} | ||
|
||
}); | ||
add(sort); | ||
JButton anlz = new JButton("Analyze"); | ||
anlz.setBackground(Color.GREEN); | ||
anlz.addActionListener(new ActionListener() { | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
double totalmass = 0; | ||
int totalatoms = 0; | ||
for (int i = 0 ; i < SelectionPane.getInpane().size() ;i++) { | ||
for (int x = 0 ; x < SelectionPane.getInpane().get(i).getAbscount() ; x++) { | ||
totalmass += SelectionPane.getInpane().get(i).getWeight(); | ||
totalatoms+=1; | ||
} | ||
} | ||
new ConversionPane(totalatoms, totalmass, "Convert"); | ||
|
||
} | ||
|
||
}); | ||
add(anlz); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.qxbytes.chemlab; | ||
|
||
public class ChemIO { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.qxbytes.chemlab; | ||
|
||
import java.util.Comparator; | ||
/** | ||
* | ||
* @author QxBytes | ||
* | ||
*/ | ||
public class Comparators { | ||
|
||
} | ||
class electronegativityComparator implements Comparator<Element> { | ||
@Override | ||
public int compare(Element o1, Element o2) { | ||
//Distance from fluorine | ||
// sqrt((y2-y1)^2 + (x2-x1)^2) | ||
int d1x = Math.abs(17-o1.getGroup()); | ||
int d1y = Math.abs(2 -o1.getPeriod()); | ||
int distance = d1x + d1y; | ||
|
||
int d2x = Math.abs(17-o2.getGroup()); | ||
int d2y = Math.abs(2 -o1.getPeriod()); | ||
int distance2 = d2x + d2y; | ||
|
||
return distance2-distance; | ||
} | ||
|
||
} | ||
class sizeComparator implements Comparator<Element> { | ||
|
||
@Override | ||
public int compare(Element o1, Element o2) { | ||
if (o1.getPeriod() > o2.getPeriod()) { | ||
return 1; | ||
} else if (o1.getGroup() > o2.getGroup()){ | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
|
||
} | ||
class lexographicComparator implements Comparator<Element> { | ||
|
||
@Override | ||
public int compare(Element o1, Element o2) { | ||
return o1.getName().compareTo(o2.getName()); | ||
} | ||
|
||
} | ||
class numberComparator implements Comparator<Element> { | ||
|
||
@Override | ||
public int compare(Element o1, Element o2) { | ||
|
||
return o1.getNum()-o2.getNum(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
package com.qxbytes.chemlab; | ||
|
||
import java.awt.GridLayout; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
|
||
import javax.imageio.ImageIO; | ||
import javax.swing.JEditorPane; | ||
import javax.swing.JFrame; | ||
import javax.swing.JLabel; | ||
import javax.swing.JOptionPane; | ||
import javax.swing.JPanel; | ||
import javax.swing.JTextField; | ||
/** | ||
* | ||
* @author QxBytes | ||
* | ||
*/ | ||
public class ConversionPane { | ||
public ConversionPane(int atoms, double mass, String name) { | ||
JFrame frame = new JFrame(SelectionPane.getFrame().getTitle().substring(10).replaceAll("1", "")); | ||
//atoms, particles, moles, molecular mass, grams | ||
frame.setSize(300, 400); | ||
frame.setLocationRelativeTo(null); | ||
|
||
JPanel root = new JPanel(new GridLayout(6,2)); | ||
frame.setLayout(new GridLayout(2,1)); | ||
|
||
JPanel database = new JPanel(new GridLayout(0,1)); | ||
|
||
root.add(new JLabel("Atoms: ")); | ||
JTextField atom = new JTextField("0"); | ||
root.add(atom); | ||
root.add(new JLabel("Particles: ")); | ||
JTextField part = new JTextField("0"); | ||
root.add(part); | ||
root.add(new JLabel("Mole: ")); | ||
JTextField mole = new JTextField("0"); | ||
root.add(mole); | ||
root.add(new JLabel("Mole/Grams: ")); | ||
JTextField gmol = new JTextField(mass+""); | ||
root.add(gmol); | ||
root.add(new JLabel("Grams: ")); | ||
JTextField gram = new JTextField("0"); | ||
root.add(gram); | ||
root.add(new JLabel("Atoms/Particle: ")); | ||
JTextField aprt = new JTextField(atoms+""); | ||
root.add(aprt); | ||
|
||
atom.addActionListener(new calculateListener(atom,part,mole,gmol,gram,aprt,0)); | ||
part.addActionListener(new calculateListener(atom,part,mole,gmol,gram,aprt,1)); | ||
mole.addActionListener(new calculateListener(atom,part,mole,gmol,gram,aprt,2)); | ||
gram.addActionListener(new calculateListener(atom,part,mole,gmol,gram,aprt,3)); | ||
|
||
frame.add(root); | ||
|
||
try { | ||
frame.setIconImage(ImageIO.read(PeriodicTable.class.getResourceAsStream("icon.png"))); | ||
} catch (Exception qq) { | ||
|
||
} | ||
|
||
JEditorPane jep = new JEditorPane(); | ||
jep.setEditable(false); | ||
|
||
try { | ||
WebButton compound = new WebButton("Check Compounds Database","https://pubchem.ncbi.nlm.nih.gov/compound/"); | ||
WebButton substance = new WebButton("Check Substances Databse","https://pubchem.ncbi.nlm.nih.gov/substance/"); | ||
WebButton wiki = new WebButton("Check Wikipedia","https://en.wikipedia.org/wiki/"); | ||
|
||
database.add(compound); | ||
database.add(substance); | ||
database.add(wiki); | ||
|
||
frame.add(database); | ||
} catch (Exception e) { | ||
|
||
} | ||
frame.setVisible(true); | ||
} | ||
} | ||
class calculateListener implements ActionListener { | ||
JTextField atom, part, mole, gmol, gram, aprt; | ||
int num; | ||
int atoms; | ||
double avgNum = 6.022 * Math.pow(10, 23); | ||
public calculateListener(JTextField atm, JTextField par, JTextField mol, JTextField gmo, JTextField gra, JTextField apr, int num) { | ||
atom = atm; | ||
part = par; | ||
mole = mol; | ||
gmol = gmo; | ||
gram = gra; | ||
aprt = apr; | ||
//function | ||
this.num = num; | ||
//total atoms | ||
} | ||
@Override | ||
public void actionPerformed(ActionEvent arg0) { | ||
try { | ||
|
||
double atm = Double.parseDouble(atom.getText()); | ||
double par = Double.parseDouble(part.getText()); | ||
double mol = Double.parseDouble(mole.getText()); | ||
double gmo = Double.parseDouble(gmol.getText()); | ||
double gra = Double.parseDouble(gram.getText()); | ||
double apr = Double.parseDouble(aprt.getText()); | ||
switch (num) { | ||
case 0://given: Atoms | ||
par = atm / apr; | ||
mol = par / avgNum; | ||
gra = mol * gmo; | ||
break; | ||
case 1://given: Particles | ||
atm = par * apr; | ||
mol = par / avgNum; | ||
gra = mol * gmo; | ||
break; | ||
case 2://given: Moles | ||
par = avgNum * mol; | ||
atm = par * apr; | ||
gra = mol * gmo; | ||
break; | ||
case 3://given: Grams (OK) | ||
mol = gra / gmo; | ||
par = mol * avgNum; | ||
atm = par * apr; | ||
break; | ||
} | ||
|
||
atom.setText(atm+""); | ||
part.setText(par+""); | ||
mole.setText(mol+""); | ||
gram.setText(gra+""); | ||
} catch (Exception e) { | ||
JOptionPane.showMessageDialog(null, "Enter a number\nMake sure no fields are blank.", "Error", JOptionPane.INFORMATION_MESSAGE); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.qxbytes.chemlab; | ||
|
||
import java.awt.Toolkit; | ||
/** | ||
* Display Constants | ||
* @author QxBytes | ||
* | ||
*/ | ||
public class DC { | ||
public static int WIDTH = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(); | ||
public static int HEIGHT = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight(); | ||
|
||
public static boolean EXTDMODE = true; | ||
|
||
public static int NORMWIDTHPT = DC.WIDTH; | ||
public static int NORMHEIGHTPT = (int)(DC.HEIGHT*.7); | ||
public static int NORMWIDTHSL = DC.WIDTH; | ||
public static int NORMHEIGHTSL = 200; | ||
public static int NORMYSL = (int)(DC.HEIGHT*.7); | ||
|
||
public static int EXTDWIDTHPT = (int)(DC.WIDTH)-250; | ||
public static int EXTDHEIGHTPT = DC.HEIGHT-100; | ||
public static int EXTDWIDTHSL = 250; | ||
public static int EXTDHEIGHTSL = DC.HEIGHT-100; | ||
public static int EXTDXSL = (int)(DC.WIDTH-250); | ||
|
||
public static int PW = EXTDWIDTHPT; | ||
public static int PH = EXTDHEIGHTPT; | ||
public static int SW = EXTDWIDTHSL; | ||
public static int SH = EXTDHEIGHTSL; | ||
public static int SY = 0; | ||
public static int SX = EXTDXSL; | ||
|
||
// public static int PW = NORMWIDTHPT; | ||
// public static int PH = NORMHEIGHTPT; | ||
// public static int SW = NORMWIDTHSL; | ||
// public static int SH = NORMHEIGHTSL; | ||
// public static int SY = NORMYSL; | ||
// public static int SX = 0; | ||
|
||
} |
Oops, something went wrong.