public void actionPerformed(ActionEvent e) {
/*
* Create a string containing the current action command and display
* it in the top panel's label.
*/
String actionCommand = e.getActionCommand();
label.setText("Action: " + actionCommand);
if (actionCommand.equals("comboBoxChanged") && (switching == false)) {
comboWasChanged(e);
}
if (actionCommand.equals("<") || actionCommand.equals(">")) {
unitButtonPressed(e);
checkUnitVsTarget(targetDimension);
}
if (actionCommand.equals("^") || actionCommand.equals("v")) {
exponentButtonPressed(e);
checkUnitVsTarget(targetDimension);
}
if (actionCommand.equals("Submit")) {
int usize = unitsVector.size();
Unit[] allUnits = new Unit[usize];
double[] allExponents = new double[usize];
for (int i = 0; i < usize; i++) {
allUnits[i] = UnitFilter.stringToUnit(unitsVector
.elementAt(i).toString());
allExponents[i] = Double.parseDouble((exponentVector
.elementAt(i).toString()));
}
currentCompoundUnit = new CompoundUnit(allUnits, allExponents);
System.exit(0);
}
}
UnitGraphics.java 文件源码
java
阅读 32
收藏 0
点赞 0
评论 0
项目:etomica
作者:
评论列表
文章目录