help..... i need help!!!!
hihi......... i'm new to java....
i've have a major problem in my hands.......
it would be really great if any1 could help.....
i have to 2 files...... 1 call MenuMgr.java and the other ProteinViewer.java
My problem is i have to call out the contents rom ProteinViewer.java into the JButton in the MenuMgr.java. So that when i click on the button, the dialog will ask "plz input a number" and aft puttin in a num and pressing enter, it will display the contents of the ProteinViewer.
btw...... the contents of my proteinviewer creates a rotatable atom. I wan to display the rotatable atom image.
[634 byte] By [
remy85a] at [2007-10-2 6:25:31]

this is my code.......
MenuMgr:
class MenuMgr extends ProteinViewer {
protected static Action depthAction;
.
.
.
.
depthAction = new AbstractAction("Depth") {
public void actionPerformed(ActionEvent e) {
if (fileOpened == false) {
String result;
result = JOptionPane.showInputDialog(ViewerMain.theOuterfra me,
"Please enter a number.","Atom Depth", JOptionPane.OK_CANCEL_OPTION);
if(result != null) {
//This is where i must call the contents of the proteinviewer file }
}
}
};
.
.
.
.
.
}
ProteinViewer:
public class ProteinViewer extends Java3DPanel implements
RotationChangeListener {
.
.
.
.
.
public TransformGroup getSpaceFillDisplay(int colorBy, int label,
BoundingSphere bounds) throws StructureException {
// create a new transform group
TransformGroup objRoot = new TransformGroup();
// loop through the chains, groups, and atoms.
Appearance appearance = new Appearance();
// give them appearance, get the atom color from the CONFIG
// class
for (int i = 0; i < PDBReader.originalMatrix.size(); i++) {
String string = PDBReader.input[5];
double d = Double.valueOf(string).doubleValue();
if(d<2.4){
System.out.println("wee Depth: " + PDBReader.input[5]);
double x, y, z;
// get x, y, z coordiantes from the pdb file and multiply it
// against a scale factor
x = ((Matrix3d) (PDBReader.originalMatrix.get(i))).m00;
y = ((Matrix3d) (PDBReader.originalMatrix.get(i))).m11;
z = ((Matrix3d) (PDBReader.originalMatrix.get(i))).m22;
String atomName = PDBReader.atomList.get(i).toString();
String atomno = PDBReader.atomnolist.get(i).toString();
//System.out.println("~~ atomName: " +atomName);
//System.out.println("~~ atomno: " +atomno);
double radius = CONFIG.getAtomRadius(atomName);
if (colorBy == CPK_COLOR) {
appearance = CONFIG.getAppearanceByAtom(atomName);
} else if (colorBy == CHARGES_COLOR) {
appearance = CONFIG.getAppearanceByCharge(atomName);
} else if (colorBy == DISTANCE_COLOR) {
appearance = CONFIG.getAppearanceByDistance(z);
}
Sphere atomSphere;
atomSphere = new Sphere((float) radius, Sphere.GENERATE_NORMALS,
appearance);
//The Transform3D object is represented internally as a
//4 x 4 double-precision floating-point matrix.
Transform3D atomXform = new Transform3D();
TransformGroup atomGroup = new TransformGroup(atomXform);
atomXform.set(new Vector3d(x, y, z));
atomGroup.setTransform(atomXform);
atomGroup.addChild(atomSphere);
objRoot.addChild(atomGroup);
if (label == LABEL) {
String codeName = PDBReader.atomList.get(i).toString();
codeName += i;
System.out.println("codeName " + codeName);
TransformGroup labelGroup = putLabel(codeName, x, y, z, bounds,
0.4);
objRoot.addChild(labelGroup);
}
}//(treshold)
}
// return the transform group
return objRoot;
}
.
.
.
.
.
}
i hope some1 here can help me.......
First when you post codes please post them in code tags
For your first question
this is my code.......
MenuMgr:
//Make your class implement ActionListener
class MenuMgr extends ProteinViewer implements ActionListener{
//this is not needed
//protected static Action depthAction;
public void actionPerformed(ActionEvent e) {
if (fileOpened == false) {
String result;
result = JOptionPane.showInputDialog(ViewerMain.theOuterfra me,
"Please enter a number.","Atom Depth", JOptionPane.OK_CANCEL_OPTION);
if(result != null) {
//This is where i must call the contents of the proteinviewer file }
}
}.
.
.
}
Thse add the ProteinViewer as the actionListener of the button
LRMKa at 2007-7-16 13:27:20 >
