-
linking contents frm a file to another file that i'm werkin on.....
hi..... i really need ur expertise.... i'm a newbie to tis......
Qn: how do u get a whole bunch of contents from a file... let's say ProteinViewer.java into a file that i'm werkin on (MenuMgr.java). Bt i dun wan everything from that file....
The idea of my work is to call out the contents from 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.
plz plz help me....... i'm in desperate situations here!!
if you want to see the code i would gladly show it to u...
-
How are you storing the "content" of your ProteinViewer class?
Can you expose that content to "outsiders"? Such as myProteinViewer.getInfo( int choice) which could be called by the MenuMgr class?
If you are storing your content in a file on a disk, can't you access that content directly in read-only mode?
-
hmmm....... i nt sure wat u mean..... nvm...
i'll put up my coding fer a clearer picture...
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.theOuterframe,
"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 }
}
}
};
.
.
.
.
.
}
Last edited by remy; 11-28-2005 at 08:39 PM.
-
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[i][5];
double d = Double.valueOf(string).doubleValue();
if(d<2.4){
System.out.println("wee Depth: " + PDBReader.input[i][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;
}
.
.
.
.
.
}
The portion in bold is what i want to call into MenuMgr.
Hope this is clearer.....
-
oh ya... when i mean display the contents of the proteinviewer.... i dun really mean the words of it.... the contents of my proteinviewer creates a rotatable atom. I wan to display the rotatable atom.
-
so you are adding a "TransformGroup" object into your MenuMgr? Then declare the TransformGroup object's instance, and define it by the copy constructor implemented when you a return object from the current instance of your ProteinViewer class.
TransformGroup myTG = myProteinViewer.getSpaceFillDisplay(colorBy, label, bounds);
-
hmm..... could u show me hw u do it if possible? coz i dun exactly noe wat u mean.... i'm new u see.... it would be a great help...... thx u........
-
 Originally Posted by nspils
so you are adding a "TransformGroup" object into your MenuMgr? Then declare the TransformGroup object's instance, and define it by the copy constructor implemented when you a return object from the current instance of your ProteinViewer class.
TransformGroup myTG = myProteinViewer.getSpaceFillDisplay(colorBy, label, bounds);
ok.... i see ur pt...... bt there still an error tat appears.....
error:
MenuMgr.java:254: non-static method getSpaceFillDisplay(int,int,javax.media.j3d.BoundingSphere) cannot be referenced from a static context
-
Your code must create an instance of the ProteinViewer class, and then you invoke that instance's .getSpaceFillDisplay() method ... or else make the method "static".
Similar Threads
-
Replies: 5
Last Post: 05-27-2008, 11:17 AM
-
By B.Horvath in forum XML
Replies: 2
Last Post: 09-30-2005, 04:36 PM
-
Replies: 2
Last Post: 12-11-2001, 07:26 PM
-
By Kerry in forum VB Classic
Replies: 0
Last Post: 07-17-2001, 02:13 PM
-
Replies: 3
Last Post: 05-31-2000, 10:30 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks