Panel class not adding to main panel...
I have a panel class that has a borderlayout which is to be nested in another panel with a borderlayout. I'm not sure what I'm doing wrong. Here is my code for the problematic classes:
1st: Panel that needs to be added:
public class SizePanel extends JFrame
private JPanel sizePanel;
private JPanel selectedSizePanel;
private JList sizeList;
private JScrollPane scrollPane;
private JTextField selectedSize;
private JLabel sizeLbl;
private String[] sizes = {"Starter", "Standard", "Better", "Best" };
public SizePanel()
setLayout(new BorderLayout());
buildSizePanel();
buildSelectedSizePanel();
add(sizePanel, BorderLayout.CENTER);
add(selectedSizePanel, BorderLayout.SOUTH);
pack();
setVisible(false);
private void buildSizePanel()
sizePanel = new JPanel();
sizeList = new JList(sizes);
sizeList.setSelectionMode(
ListSelectionModel.SINGLE_SELECTION);
sizeList.addListSelectionListener(
new ListListener());
sizeList.setVisibleRowCount(4);
scrollPane = new JScrollPane(sizeList);
sizePanel.add(scrollPane);
private void buildSelectedSizePanel()
selectedSizePanel = new JPanel();
sizeLbl = new JLabel("Price: ");
selectedSize = new JTextField(9);
selectedSize.setEditable(false);
selectedSizePanel.add(sizeLbl);
selectedSizePanel.add(selectedSize);
private class ListListener implements ListSelectionListener
public void valueChanged(ListSelectionEvent e)
String selection = (String) sizeList.getSelectedValue();
selectedSize.setText(selection);
}2nd: My code for adding it to the main panel:
public HouseCalcGUI() {
setTitle("McKeown's Real Estate Program");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new BorderLayout());
greetingPnl = new GreetingPanel();
featuresPnl = new FeaturesPanel();
sizePnl = new SizePanel();
stylePnl = new StylePanel();
buildButtonPanel();
add(greetingPnl, BorderLayout.NORTH);
add(stylePnl, BorderLayout.EAST);
add(featuresPnl, BorderLayout.CENTER);
add(sizePnl, BorderLayout.WEST);
add(buttonPanel, BorderLayout.SOUTH);
pack();
setVisible(true);
}
Hey, guess what I just did...? BANGED MY HEAD AGAINST THE WALL. Your ingeniousness is in the form of my stupidity. Thank you though. Here are your dukes...What I did was take some sample program from my text to make my program.
Similar Messages
-
Why some Vi in LabVIEW Functions panel are not in PDA Functions panel?
why some Vi in LabVIEW Functions panel are not in PDA Functions panel?
such as "MT Generate System Parameters.vi".......can not run on the PDA window and say:"MT Generate System Parameters.vi":subVI is not executable.mathan wrote:
WenBin wrote:
up
could you please explain in bit more detail
Looks like a lame attempt to "bump" the thread.
Adding a (nearly) empty message places the thread back on top of the list, in the false assumption that this would generate more replies.
Well, he's partially correct, because it added the last three posts (which of course have nothing to do with the problem at hand), but it did not increase the "real" answers.
Bumping a thread is disruptive and generally a bad idea, because it adds a lot of noise to the forum. Imagine everybody would do it! There would be so much elbowing for the top spot that all substance would be lost in the chatter.
In the NI forums, bumping a thread is very counterproductive, because blue contributions (from NI) will typically (and hopefully!) wait until the thread is idle for a while.
Overall, it is a bad idea!
LabVIEW Champion . Do more with less code and in less time . -
opening a new file in photoshop cc and the file name is displayed but no white working canvas. you can see it as a layer in the layers panel and if i draw on the grey area i can see int on the layer but not on the main screen.
Graphics card is the problem.
Trying to update drivers now.
Thanks for your help
john -
Creating panels in different files and adding to main frame
I'm trying to write panels in separate files so program is more modular and the files shorter. The panels don't appear in the main window at all. All I get appearing is the title bar. This is the basics of the code I've written:
GuiMain.java
// in main...
guiFrame frame = new guiFrame();
frame.setVisible(true);
frame.pack();
guiFrame.java
// constructor calls method createFrame();
// in createFrame()
northP np = new northP();
Container cp = this.getContentPane();
cp.add(np, BorderLayout.NORTH);
cp.setVisible(true);
northP.java
// extends Component
// constructor calls method createContents()
// in createContents()
JPanel northP = new JPanel();
// contains buttons and labels
Any ideas much appreciated!!I should say that it's not possible for you to trap events from the first popup,and this depends on the basic concept of "popup panel".
When you install a popup panel, all user interaction with existing panels is excluded: all focus it aimed at the popup only, no other user interface event is generated. If you launch another popup from the first one, the second popup prevails over the first one and no event can be generated on the first panel until the second one is closed.
Handling a chain of two popup panels while looping on GetUserEvent can lead to unpredictable situation not so easy to untangle.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
The dreaded "could not find the Main Class, Program will exit", how?
Hello all,
I am trying to run my .jar file and I get this error message.
I want to mention I googled and searched for it, without success: There is so many different explanations!
I tried this:
Adding some lines in a manifest.fm file...
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 10.0-b19 (Sun Microsystems Inc.)
X-COMMENT: Main-Class will be added automatically by build
I have Netbeans 5.5.
Also I noticed my "build.xml" file is empty" and my "manifest.fm" nearly empty. I have also added "project, main class" in the options...
Here is my "build":
{code}<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="BetaCourseworkJava3d_Final" default="default" basedir=".">
<description>Builds, tests, and runs the project BetaCourseworkJava3d_Final.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="BetaCourseworkJava3d_TestsBACKUPSUNDAY05April-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
{code}
my Manifest:
{code}Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 10.0-b19 (Sun Microsystems Inc.)
X-COMMENT: Main-Class will be added automatically by build
{code}
And my whole code (although I have like 4 .JAVA files in my project):
{code}
package courseworkjava3d;
import java.awt.*;
import java.awt.event.*;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.swing.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import javax.media.j3d.PositionPathInterpolator;
import javax.media.j3d.Alpha;
import javax.media.j3d.BoundingSphere;
import com.sun.j3d.utils.applet.MainFrame;
import java.applet.Applet;
import java.awt.event.WindowAdapter;
import javax.swing.Timer;
import com.sun.j3d.utils.image.*;
public class Simple3D extends JFrame implements ActionListener, KeyListener
private TransformGroup objTransxx;
private Button go = new Button("Press to start the Bouncing Ball. Press A and S to move the ball Left and Right once it started!");
private Transform3D transxx = new Transform3D();
private float height=0.0f;
private float sign = 1.0f; // aller vers le haut ou vers le bas
private Timer timer;
private float xloc=-2.25f;
public Simple3D()
setSize(800, 800);
GraphicsConfiguration graphicsConfig = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(graphicsConfig);
getContentPane().add("Center", canvas);
BasicUniverse universe = new BasicUniverse(canvas, 8.0f);
// Rotate the view platform by PI/4 radians about X in the BasicUniverse
TransformGroup viewTransform = universe.getViewPlatformTransform();
Transform3D transform = new Transform3D();
transform.rotX(-Math.PI / 4.0);
Transform3D currentTransform = new Transform3D();
viewTransform.getTransform(currentTransform);
transform.mul(currentTransform);
viewTransform.setTransform(transform);
// Add something to display
BranchGroup scene = createCubeGraph();
universe.addBranchGraph(scene);
/* //ultra important! comment theses lines otherwise it bugs!
//Merde
setLayout(new BorderLayout());
GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();
Canvas3D c = new Canvas3D(config); */
add("Center", canvas);
//i messed up te code, i replaced canvas c by "canvas" as i already had one!
canvas.addKeyListener(this);
timer = new Timer(75,this);
//timer.start();
Panel p =new Panel();
p.add(go);
add("North",p);
go.addActionListener(this);
go.addKeyListener(this);
// Cr�er une sc�ne simple et l�ajouetr � l�univers
//BranchGroup scene2 = createCubeGraph();
//SimpleUniverse u = new SimpleUniverse(c);
//u.getViewingPlatform().setNominalViewingTransform();
//u.addBranchGraph(scene2);
//End Merde
public BranchGroup createCubeGraph() {
BranchGroup Humanoid = new BranchGroup();
//Debut Ball REBOUND
// Create the root of the branch graph
//BranchGroup objRoot = new BranchGroup();
objTransxx = new TransformGroup();
objTransxx.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Humanoid.addChild(objTransxx);
// Cr�er une forme simple et l�ajouter au graph de sc�ne
Sphere spherex = new Sphere(0.85f);
objTransxx = new TransformGroup();
objTransxx.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Transform3D pos1 = new Transform3D();
pos1.setTranslation(new Vector3f(-2.0f,0.0f,-2.0f));
objTransxx.setTransform(pos1);
objTransxx.addChild(spherex);
Humanoid.addChild(objTransxx);
BoundingSphere boundsx =
new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
// I messed up the colors: I have applied 2 times some colorslights to the same BranchGroup
Color3f light1Colorx = new Color3f(1.0f, 1.0f, 1.0f);
Vector3f light1Directionx = new Vector3f(4.0f, -7.0f, -12.0f);
DirectionalLight light1x
= new DirectionalLight(light1Colorx, light1Directionx);
light1x.setInfluencingBounds(boundsx);
Humanoid.addChild(light1x);
// R�gler la lumi�re ambiante
Color3f ambientColorx = new Color3f(1.0f, 1.0f, 1.0f);
AmbientLight ambientLightNodex = new AmbientLight(ambientColorx);
ambientLightNodex.setInfluencingBounds(boundsx);
Humanoid.addChild(ambientLightNodex);
// END BallRebound
// Apparence BODY
// Configurer les couleurs
Color3f blackbody = new Color3f(0.0f, 0.0f, 0.0f);
Color3f whitebody = new Color3f(1.0f, 1.0f, 1.0f);
Color3f redbody = new Color3f(0.8f, .85f, .85f);
// Configurer la texture
//if I want it in Black and white i need to replace RGB by LUMINANCE
TextureLoader loaderbody = new TextureLoader("C:\\java3d\\body.jpg", "RGB", new Container());
Texture texturebody = loaderbody.getTexture();
texturebody.setBoundaryModeS(Texture.WRAP);
texturebody.setBoundaryModeT(Texture.WRAP);
texturebody.setBoundaryColor( new Color4f( 1.0f, 1.0f, 0.0f, 0.0f ) );
// Configurer les attributs de la texture
// Param�tres possibles : REPLACE, BLEND ou DECAL (ici, MODULATE)
TextureAttributes texAttrbody = new TextureAttributes();
texAttrbody.setTextureMode(TextureAttributes.MODULATE);
Appearance apbody = new Appearance();
apbody.setTexture(texturebody);
apbody.setTextureAttributes(texAttrbody);
//Configurer le mat�riau
apbody.setMaterial(new Material(redbody, blackbody, redbody, blackbody, 1.0f));
// Cr�er une sph�re pour y appliquer les textures
int primflagsbody = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS;
// End Apparence BODY
// Apparence BODYHEAD
// Configurer les couleurs
Color3f blackbodyH = new Color3f(0.0f, 0.0f, 0.0f);
Color3f whitebodyH = new Color3f(1.0f, 1.0f, 1.0f);
Color3f redbodyH = new Color3f(0.8f, .85f, .85f);
// Configurer la texture
//if I want it in Black and white i need to replace RGB by LUMINANCE
TextureLoader loaderbodyH = new TextureLoader("C:\\java3d\\head.jpg", "RGB", new Container());
Texture texturebodyH = loaderbodyH.getTexture();
texturebodyH.setBoundaryModeS(Texture.WRAP);
texturebodyH.setBoundaryModeT(Texture.WRAP);
texturebodyH.setBoundaryColor( new Color4f( 1.0f, 1.0f, 0.0f, 0.0f ) );
// Configurer les attributs de la texture
// Param�tres possibles : REPLACE, BLEND ou DECAL (ici, MODULATE)
TextureAttributes texAttrbodyH = new TextureAttributes();
texAttrbodyH.setTextureMode(TextureAttributes.MODULATE);
Appearance apbodyH = new Appearance();
apbodyH.setTexture(texturebodyH);
apbodyH.setTextureAttributes(texAttrbodyH);
//Configurer le mat�riau
apbodyH.setMaterial(new Material(redbodyH, blackbodyH, redbodyH, blackbodyH, 1.0f));
// Cr�er une sph�re pour y appliquer les textures
int primflagsbodyH = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS;
// End Apparence BODY HEAD
//for the trunk c le corps
TransformGroup fortheTrunk = new TransformGroup();
//will allow to modify object wgile executing
fortheTrunk.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
//alpha rotation time related
Alpha rotationAlpha2=new Alpha(-1,9000);
//behviour for our rotation
RotationInterpolator rotator2= new RotationInterpolator(rotationAlpha2,fortheTrunk);
// area where rotation will be
BoundingSphere bounds2=new BoundingSphere();
rotator2.setSchedulingBounds(bounds2);
fortheTrunk.addChild(rotator2);
//end of rtotation
Alpha transAlphahuman=new Alpha(-1,600);
//transform 3d trans for the interpolatipon HUMANOID
Transform3D transhumanoid=new Transform3D();
//matrix for 2positions
Point3f[] cheminhuman=new Point3f[3];
cheminhuman[0]=new Point3f(0.8f,0.0f,0.0f);
cheminhuman[1]=new Point3f(-0.8f,0.0f,0.0f);
cheminhuman[2]=new Point3f(0.8f,0.0f,0.0f);
//matrix of floats to make the dots match with timeline
float[] timePositionhuman={0.0f,0.50f,1.0f};
PositionPathInterpolator interpolhuman=new PositionPathInterpolator(transAlphahuman,fortheTrunk,transhumanoid,timePositionhuman,cheminhuman);
BoundingSphere bounds4=new BoundingSphere();
interpolhuman.setSchedulingBounds(bounds4);
fortheTrunk.addChild(interpolhuman);
//add the trunk to the branchgroup
Humanoid.addChild(fortheTrunk);
TransformGroup zeTrunk = new TransformGroup();
zeTrunk.addChild(new com.sun.j3d.utils.geometry.Box(.55f,.80f,.50f,
primflagsbody,apbody));
//t3D for the head= bouge up
Transform3D T3DHead = new Transform3D();
T3DHead.set(new Vector3f(0f,1.1f,0f));
//create a tranform group for this t3Dhead
TransformGroup fortheHead = new TransformGroup();
fortheHead.setTransform(T3DHead);
//add the box head
//fortheHead.addChild(new com.sun.j3d.utils.geometry.Box(.20f,.20f,.10f, primflagsbody,apbody));
fortheHead.addChild(new com.sun.j3d.utils.geometry.Sphere(0.35f,primflagsbodyH,apbodyH));
/* I dont need that anymore it was for putting a flat texture on a face. I chose a sphere instead!
//transform 3D for the face
Transform3D T3DFace = new Transform3D();
T3DFace.set(new Vector3f(0f,0f,.14f));
//create a TransformGroup for this Face
TransformGroup Face = new TransformGroup();
Face.setTransform(T3DFace);
//add the child box to the face;
Face.addChild(new com.sun.j3d.utils.geometry.Box(.20f,.20f,.2f,
primflagsbodyH,apbodyH));
//add this face to the head as a child
fortheHead.addChild(Face);
//tranform3d left arm
Transform3D T3DArmL = new Transform3D();
T3DArmL.set(new Vector3f(-0.79f,0.73f,0f));
//create Tranform Group for the leftarm
TransformGroup fortheArmL = new TransformGroup();
fortheArmL.setTransform(T3DArmL);
//add the group for upperarm
TransformGroup ArmL = new TransformGroup();
ArmL.addChild(new com.sun.j3d.utils.geometry.Box(.25f,.14f,.10f,
primflagsbody,apbody));
fortheArmL.addChild(ArmL);
//create a transform3D for the forearmleft
Transform3D T3DForearmL = new Transform3D();
T3DForearmL.set(new Vector3f(-.51f,0f,0f));
//create the tranformgroup for the forearmleft
TransformGroup ForearmL = new TransformGroup();
ForearmL.setTransform(T3DForearmL);
//add the child box to forearm
ForearmL.addChild(new com.sun.j3d.utils.geometry.Box(.20f,.14f,.10f,
primflagsbody,apbody));
ArmL.addChild(ForearmL);
//create transform 3d for the lefthand
Transform3D T3DHandL = new Transform3D();
T3DHandL.set(new Vector3f(-.42f,0f,0f));
//create the child tranform group for the box of the hand
TransformGroup HandL= new TransformGroup();
HandL.setTransform(T3DHandL);
//add the child hand to the forearm
ForearmL.addChild(HandL);
//create the box for the handLeft
HandL.addChild(new com.sun.j3d.utils.geometry.Box(.10f,.140f,.10f,
primflagsbody,apbody));
//Right Arm
//tranform3d right arm
Transform3D T3DArmR = new Transform3D();
T3DArmR.set(new Vector3f(0.79f,0.73f,0f));
//create Tranform Group for the right arm
TransformGroup fortheArmR = new TransformGroup();
fortheArmR.setTransform(T3DArmR);
//add the group for upperarm right
TransformGroup ArmR = new TransformGroup();
ArmR.addChild(new com.sun.j3d.utils.geometry.Box(.25f,.14f,.10f, primflagsbody,apbody));
//com.sun.j3d.utils.geometry.Box.GENERATE_NORMALS,new Appearance()));
fortheArmR.addChild(ArmR);
//create a transform3D for the forearmright
Transform3D T3DForearmR = new Transform3D();
T3DForearmR.set(new Vector3f(.51f,0f,0f));
//create the tranformgroup for the forearmright
TransformGroup ForearmR = new TransformGroup();
ForearmR.setTransform(T3DForearmR);
//add the child box to forearmright
ForearmR.addChild(new com.sun.j3d.utils.geometry.Box(.20f,.14f,.10f, primflagsbody,apbody));
ArmR.addChild(ForearmR);
//create transform 3d for the righthand
Transform3D T3DHandR = new Transform3D();
T3DHandR.set(new Vector3f(.42f,0f,0f));
//create the child tranform group for the box of the hand
TransformGroup HandR= new TransformGroup();
HandR.setTransform(T3DHandR);
//add the child hand to the forearmright
ForearmR.addChild(HandR);
//create the box for the handright
HandR.addChild(new com.sun.j3d.utils.geometry.Box(.10f,.14f,.10f, primflagsbody,apbody));
//Left Leg
//tranform3d left leg
Transform3D T3DLegL = new Transform3D();
T3DLegL.set(new Vector3f(0.43f,-1.23f,0f));
//create Tranform Group for the leftleg
TransformGroup fortheLegL = new TransformGroup();
fortheLegL.setTransform(T3DLegL);
//add the group for uppeleg
TransformGroup LegL = new TransformGroup();
LegL.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.35f,.10f, primflagsbody,apbody));
fortheLegL.addChild(LegL);
//create a transform3D for the downlegleft
Transform3D T3DDownLegL = new Transform3D();
T3DDownLegL.set(new Vector3f(0f,-.70f,0f));
//create the tranformgroup for the downegleft
TransformGroup DownLegL = new TransformGroup();
DownLegL.setTransform(T3DDownLegL);
//add the child box to downlegm
DownLegL.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.25f,.10f, primflagsbody,apbody));
LegL.addChild(DownLegL);
//create transform 3d for the leftfeet
Transform3D T3DFeetL = new Transform3D();
T3DFeetL.set(new Vector3f(.0f,-.45f,0f));
//create the child tranform group for the box of thefeet
TransformGroup FeetL= new TransformGroup();
FeetL.setTransform(T3DFeetL);
//add the child hand to the downleg
DownLegL.addChild(FeetL);
//create the box for the feetLeft
FeetL.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.10f,.15f, primflagsbody,apbody));
//Right Leg
//tranform3dright leg
Transform3D T3DLegR = new Transform3D();
T3DLegR.set(new Vector3f(-0.43f,-1.23f,0f));
//create Tranform Group for the righttleg
TransformGroup fortheLegR = new TransformGroup();
fortheLegR.setTransform(T3DLegR);
//add the group for uppelegR
TransformGroup LegR = new TransformGroup();
LegR.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.35f,.10f, primflagsbody,apbody));
fortheLegR.addChild(LegR);
//create a transform3D for the downlegright
Transform3D T3DDownLegR = new Transform3D();
T3DDownLegR.set(new Vector3f(0f,-.70f,0f));
//create the tranformgroup for the downegright
TransformGroup DownLegR = new TransformGroup();
DownLegR.setTransform(T3DDownLegR);
//add the child box to downlegRight
DownLegR.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.25f,.10f, primflagsbody,apbody));
LegR.addChild(DownLegR);
//create transform 3d for the rightfeet
Transform3D T3DFeetR = new Transform3D();
T3DFeetR.set(new Vector3f(.0f,-.45f,0f));
//create the child tranform group for the box of thefeetright
TransformGroup FeetR= new TransformGroup();
FeetR.setTransform(T3DFeetR);
//add the child feet right to the downleg
DownLegR.addChild(FeetR);
//create the box for the feetright
FeetR.addChild(new com.sun.j3d.utils.geometry.Box(.16f,.10f,.15f, primflagsbody,apbody));
//rajoute la box zetrunk et des fils
fortheTrunk.addChild(zeTrunk);
fortheTrunk.addChild(fortheHead);
fortheTrunk.addChild(fortheArmL);
fortheTrunk.addChild(fortheArmR);
fortheTrunk.addChild(fortheLegL);
fortheTrunk.addChild(fortheLegR);
//DEBUT CUBE
//beginning of rotation
TransformGroup objSpin=new TransformGroup();
//create transform 3d for box which spin
Transform3D T3DobjSpin = new Transform3D();
T3DobjSpin.set(new Vector3f(-2.50f,.45f,0f));
//create the child tranform group for the box which spin
objSpin.setTransform(T3DobjSpin);
//will allow to modify object while executing
objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
//alpha rotation time related
Alpha rotationAlpha=new Alpha(-1,900);
Alpha transAlpha=new Alpha(-1,900);
//transform 3d trans for the interpolatipon
Transform3D trans=new Transform3D();
//matrix for 2positions
Point3f[] chemin=new Point3f[3];
chemin[0]=new Point3f(-2.8f,0.40f,1.0f);
chemin[1]=new Point3f(-0.8f,0.40f,1.0f);
chemin[2]=new Point3f(-2.8f,0.40f,1.0f);
//matrix of floats to make the dots match with timeline
float[] timePosition={0.0f,0.50f,1.0f};
PositionPathInterpolator interpol=new PositionPathInterpolator(transAlpha,objSpin,trans,timePosition,chemin);
BoundingSphere bounds3=new BoundingSphere();
interpol.setSchedulingBounds(bounds3);
objSpin.addChild(interpol);
//behviour for our rotation
RotationInterpolator rotator= new RotationInterpolator(rotationAlpha,objSpin);
// area where rotation will be
BoundingSphere bounds=new BoundingSphere();
rotator.setSchedulingBounds(bounds);
objSpin.addChild(rotator);
//end of rtotation
//add transform group objspin to branchgroup humanoid
Humanoid.addChild(objSpin);
//test a cube which heritate of this rotation?
objSpin.addChild(new ColorCube(0.25));
//test
//module cube + transparency
// create an ALPHA transparency apparence (invisible)
Appearance app0x=new Appearance();
app0x.setColoringAttributes(new ColoringAttributes(new Color3f(0.3f,0.2f,1.0f),ColoringAttributes.SHADE_GOURAUD));
app0x.setTransparencyAttributes(new TransparencyAttributes(TransparencyAttributes.NICEST,0.5f));//0.5f represente 50% de transparence
// create the blue sphere which rotate
Transform3D transsphere=new Transform3D();
transsphere.set(new Vector3f(0.0f, -0.1f, 0.3f));
TransformGroup TGsphere=new TransformGroup(transsphere);
TGsphere.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objSpin.addChild(TGsphere);
//objRotatecube.addChild(TGsphere);
TGsphere.addChild( new Sphere(0.3f,app0x) );
//End Module Cube + Transparency
//END CUBE
//DEBUT WHOLE BIRD
//beginning of Rotation for Bird
TransformGroup Bird=new TransformGroup();
//will allow to modify object while executing
Bird.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
//alpha rotation time related
Alpha rotationAlphaBird=new Alpha(-1,400);
Alpha transAlphaBird=new Alpha(-1,5990);
//transform 3d trans for the interpolatipon
Transform3D transBird=new Transform3D();
//create transform 3d for the Bird
transBird.set(new Vector3f(1.90f,-.45f,0.9f));
//create the child tranform group for the Bird Box
Bird.setTransform(transBird);
//matrix for 2positions
Point3f[] cheminBird=new Point3f[3];
cheminBird[0]=new Point3f(1.95f,0.0f,-6.8f);
cheminBird[1]=new Point3f(1.95f,0.90f,-0.8f);
cheminBird[2]=new Point3f(1.95f,0.0f,5.8f);
//matrix of floats to make the dots match with timeline
float[] timePositionBird={0.00f,0.50f,1.0f};
PositionPathInterpolator interpolBird=new PositionPathInterpolator(transAlphaBird,Bird,transBird,timePosition,cheminBird);
BoundingSphere bounds3Bird=new BoundingSphere();
//BoundingSphere bounds3Bird= new BoundingSphere(new Point3d(0.0, 0.0, -50.0), 0.5);
interpolBird.setSchedulingBounds(bounds3Bird);
Bird.addChild(interpolBird);
//behviour for our rotation
RotationInterpolator rotatorBird= new RotationInterpolator(rotationAlphaBird,Bird);
// area where rotation will be
BoundingSphere boundsBird=new BoundingSphere();
rotatorBird.setSchedulingBounds(boundsBird);
Bird.addChild(rotatorBird);
//end of rotation For Bird
//add transform group objspin to branchgroup humanoid
Humanoid.addChild(Bird);
//debut test APPARENCE Wing Left
//test textures
// Configurer les couleurs
Color3f blackx = new Color3f(0.0f, 0.0f, 0.0f);
Color3f whitex = new Color3f(1.0f, 1.0f, 1.0f);
Color3f redx = new Color3f(0.7f, .75f, .75f);
// Configurer la texture
TextureLoader loaderx = new TextureLoader("C:\\java3d\\pois.jpg", "RGB", new Container());
Texture texturex = loaderx.getTexture();
texturex.setBoundaryModeS(Texture.WRAP);
texturex.setBoundaryModeT(Texture.WRAP);
texturex.setBoundaryColor( new Color4f( 0.0f, 1.0f, 0.0f, 0.0f ) );
// Configurer les attributs de la texture
// Param�tres possibles : REPLACE, BLEND ou DECAL (ici, MODULATE)
TextureAttributes texAttrx = new TextureAttributes();
texAttrx.setTextureMode(TextureAttributes.REPLACE);
Appearance apx = new Appearance();
apx.setTexture(texturex);
apx.setTextureAttributes(texAttrx);
//Configurer le mat�riau
apx.setMaterial(new Material(redx, blackx, redx, blackx, 1.0f));
int primflagsx = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS;
//End test APPARENCE Wing Left
//test a cube which heritate of this rotation?
// Bird.addChild(new ColorCube(0.8));
//test bird body
// Bird.addChild(new com.sun.j3d.utils.geometry.Box(.25f,.22f,.45f,
// com.sun.j3d.utils.geometry.Box.GENERATE_NORMALS,new Appearance()));
Bird.addChild(new com.sun.j3d.utils.geometry.Box(.25f,.22f,.45f, primflagsx,apx));
//test WingRightBird
//create a transform3D for the BirdWIngR
Transform3D T3DBirdWingR = new Transform3D();
T3DBirdWingR.set(new Vector3f(0.45f,.0f,-0.35f));
//create the tranformgroup for the BirdWIngR
TransformGroup BirdWingR = new TransformGroup();
BirdWingR.setTransform(T3DBirdWingR);
//add the child box to BirdWIngR
// BirdWingR.addChild(new com.sun.j3d.utils.geometry.Box(.43f,.07f,.22f,
// com.sun.j3d.utils.geometry.Box.GENERATE_NORMALS,new Appearance()));
//End test WingRightBird
////////comments/////////
//beginning of Rotating WINR
//----------------------d�but de la cr�ation de la rotation--------------------------------
TransformGroup WinRSpin=new TransformGroup();
// permet de modifier l'objet pendant l'execution
WinRSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// on cr�e un fonction de rotation au cours du temps
Alpha rotationAlphaWinRSpin=new Alpha(-1,1000);
Transform3D rot = new Transform3D();
rot.rotX((float)Math.PI/- 2.0f);
//rot.rotX(-45);
//rot.rotX((-Math.PI / 4.0)+30);
//rot.rotZ((-Math.PI / 4.0));
//rot.rotX(-Math.PI / 4.0);
//rot.rotY(-Math.PI / 4.0);
// rot.rotZ(-Math.PI / 4.0);
// rot.rotY(00);
//rot.rotZ(45);
// on cr�e un comportement qui va appliquer la rotation � l'objet voulu
// on d�finit la zone sur laquelle va s'appliquer la rotation
//RotationInterpolator rotatorWinRSpin=new RotationInterpolator(rotationAlphaWinRSpin,WinRSpin, rot, 0.50f,(float)(2.0*Math.PI));
RotationInterpolator rotatorWinRSpin=new RotationInterpolator(rotationAlphaWinRSpin,WinRSpin, rot, 25,26);
BoundingSphere boundsWinRSpin=new BoundingSphere(new Point3d((Math.PI / 4.0), 0.0, 0.0), 0.5);
// boundsWinRSpin.setCenter(new Point3d((Math.PI / 4.0),0,0));
boundsWinRSpin.setCenter(new Point3d(-10,0,0));
//boundsWinRSpin.setCenter();
//test put a t3d to a boundingsphere??
//Transform3D T3Dbounding = new Transform3D();
// T3Dbounding.set(new Vector3f(5.00f,0.0f,0.00f));
//WinRSpin.setTransform(T3Dbounding);
//end test put a t3d to a boundingsphere, not working
rotatorWinRSpin.setSchedulingBounds(boundsWinRSpin);
// test BoundingSphere of BODY BIRD rotatorWinRSpin.setSchedulingBounds(boundsBird);
WinRSpin.addChild(rotatorWinRSpin);
//----------------------End de la cr�ation de la rotation--------------------------------
BirdWingR.addChild(WinRSpin);
// on cree un cube qui h�rite de la rotation
//WinRSpin.addChild(new ColorCube(0.5));// de rayon 50 cm
WinRSpin.addChild(new com.sun.j3d.utils.geometry.Box(.43f,.07f,.22f, primflagsx,apx));
//End of Rotating WINR
//////// END comments/////////
//I commented the following, that was the TEST sinusoidal, rotation which help me understood how to rotate wingR
// -----------d�but de cr�ation de la rotation--------------------------------------------------
TransformGroup objSpinxx=new TransformGroup();
// permet de modifier l'objet pendant l'execution
objSpinxx.setCapability(TransformGroup.ALLThank you very much!
I cant believe this little comment has been so helpful!
But yes it is:
I explain, despite my efforts to find, googled it, forums, faqs, etc...
no where it mentionned the manifest.fm file is... INSIDE the .jar!
Your comment "a zip" made me attempt to open it with winrar, and I found a manifest.fm file inside!
So far I was editing the one at the "source" of my project and rebuilding it with netbeans.
I am going to try that now.
Actually.... :( no its mentionning my main class!
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 10.0-b19 (Sun Microsystems Inc.)
Main-class: courseworkjava3d.Simple3D
Class-Path:
X-COMMENT: Main-Class will be added automatically by buildWell I have no problems uploading you the .jar, it is for a coursework it is not a private project or whatever:
http://www.uploading.com/files/CM2LKWYU/BetaCourseworkJava3d_Final.jar.html
Oh and I felt on your comment "dont ask us" as if I was suppose to know... i'm a beginner, I did not know that! And I tried to give you so many infos so you dont lose your time if you want to help, especially as after my own research I found many, many results for this "main class" and I tried a few solutions!
Edited by: CupofTea on Apr 13, 2008 3:28 AM -
Hints image on the animation panel does not change.
Help I have several animation panels when the program initializes from the constructor. I have a separate AnimationPanel class that creates each panel for display. The initial ?hello ? welcome panel (from the constructor) animates on the main panel when the program begins.
The problem is I want to have different animation panels (that are stored ) to animate and replace the main panel animation at a push of a button. While, the various panels can animate if called from the constructor, they do not animate when called from a button.
The buttons I created to switch the main animated panel with a different one seems to work to the extent that it gets the correct music, but the image on the animation panel does not change.
I know this is a more in depth of a question but might you be able to give me a point in the right direction?
Here is the code from the constructor that works fine in the constructor to start the main animation.
public PingPong()
// null layout because it has a main panel where this display panel is placed
super(null);
//panels are created
instantiatePanels();
//panels are added to the main content pane
placePanelsOnView();
startAnimation();
initializeAudio();The problem is that I now start it with no animation to begin with and just an empty panel, but still when I try to add an animation from the button and it will not start. The contentPane is in a different class that places the buttons and the view together.
Here is the code that the button calls back with a getNextPanel() :
AnimatedPanel expertPingPongPlayerPanel
= new AnimatedPanel( );
add(expertPingPongPlayerPanel );
expertPingPongPlayerPanel.animate();
expertPingPongPlayerPanel.setVisible(true);
startAnimation(); -
Saving parameters entered in a gui dialog to be used in the main panel
Hi,
I'm having a nightmare at the moment.
I've finished creating a program for my final year project, that is all comand line at the moment.
i'm required to design a GUI for this. i've started already and have a main panel that has a few buttons one of which is a setParameters button. which opens up a file dialog that allows the user to enter parameters that will be used by the main panel later on.
I'm having trouble imagining how these parameters will be accessed by the main Panel once they are saved.
At the moment, without the GUI i have get and set methods in my main program which works fine. Is this the kind of thing i'll be using for this?
my code for the parameters dialog
public class Parameters extends JDialog
private GridLayout grid1, grid2, grid3;
JButton ok, cancel;
public Parameters()
setTitle( "Parameters" );
setSize( 400,500 );
setDefaultCloseOperation( DISPOSE_ON_CLOSE );
grid1 = new GridLayout(7,2);
grid2 = new GridLayout(1,2);
JPanel topPanel = new JPanel();
topPanel.setLayout(grid1);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(grid2);
ok = new JButton("OK");
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//when pressed i want to save the parameters that the user has entered
//and be able to access these in the RunPanel class
cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//when pressed just want the Jdialog to close
buttonPanel.add(ok);
buttonPanel.add(cancel);
JTextArea affinityThresholdScalar = new JTextArea();
JTextArea clonalRate = new JTextArea();
JTextArea stimulationValue = new JTextArea();
JTextArea totalResources = new JTextArea();
JLabel aTSLabel = new JLabel("affinityThresholdScalar");
JLabel cRLabel = new JLabel("clonalRate");
topPanel.add(aTSLabel);
topPanel.add(affinityThresholdScalar);
topPanel.add(cRLabel);
topPanel.add(clonalRate);
Container container = getContentPane();//.add( topPanel );
container.add( topPanel, BorderLayout.CENTER );
container.add( buttonPanel, BorderLayout.SOUTH );
}the main panel class is:
public class RunPanel extends JPanel implements ActionListener
JButton openButton, setParametersButton, saveButton;
static private final String newline = "\n";
JTextArea log;
JFileChooser fc;
Data d = new Data();
Normalise rf = new Normalise();
Parameters param = new Parameters();
public RunPanel()
super(new BorderLayout());
log = new JTextArea(5,20);
log.setMargin(new Insets(5,5,5,5));
log.setEditable(false);
JScrollPane logScrollPane = new JScrollPane(log);
fc = new JFileChooser();
openButton = new JButton("Open a File...")
openButton.addActionListener(this);
setParametersButton = new JButton("Set User Parameters");
setParametersButton.addActionListener(this);
saveButton = new JButton("save");
saveButton.addActionListener(this);
JPanel buttonPanel = new JPanel(); //use FlowLayout
buttonPanel.add(openButton);
buttonPanel.add(setParametersButton);
JPanel savePanel = new JPanel();
savePanel.add(saveButton);
add(buttonPanel, BorderLayout.PAGE_START);
add(logScrollPane, BorderLayout.CENTER);
add(savePanel, BorderLayout.SOUTH);
public void actionPerformed(ActionEvent e) {
if (e.getSource() == openButton) {
int returnVal = fc.showOpenDialog(RunPanel.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
log.append("Opening: " + file.getName() + "." + newline);
Vector data = d.readFile(file);
log.append("Reading file into Vector " +data+ "." + newline);
Vector dataNormalised = rf.normalise(data);
else {
log.append("Open command cancelled by user." + newline);
log.setCaretPosition(log.getDocument().getLength());
else if (e.getSource() == saveButton) {
int returnVal = fc.showSaveDialog(RunPanel.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
log.append("Saving: " + file.getName() + "." + newline);
} else {
log.append("Save command cancelled by user." + newline);
log.setCaretPosition(log.getDocument().getLength());
else
if (e.getSource() == setParametersButton)
log.append("loser." + newline);
param.show();
private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("AIRS");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JComponent newContentPane = new RunPanel();
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}Can anybody offer any suggestions?
CheersWhat you need is my ParamDialog. I think it could be perfect for this sort of thing. There are a few references in it to some of my other classes namely
StandardDialog. Which you can find by searching for other posts on this forum. But if you'd rather not find that you could just use JDialog instead
WindowUtils.visualize() this is just a helper method for getting things visualized on the screen. You can just use setBounds and setVisible and you'll be fine.
You are welcome to use and modify this code but please don't change the package or take credit for it as your own work.
If you need to bring up a filedialog or a color chooser you will need to make some modifications. If you do this, would you mind posting that when you are done so that myself and others can use it? :)
StandardDialog.java
================
package tjacobs.ui;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import java.awt.*;
import java.util.HashMap;
import java.util.Properties;
/** Usage:
* * ParamDialog pd = new ParamDialog(new String[] {"A", "B", "C"});
* pd.pack();
* pd.setVisible(true);
* Properties p = pd.getProperties();
public class ParamDialog extends StandardDialog {
public static final String SECRET = "(SECRET)";
String[] fields;
HashMap<String, JTextField> mValues = new HashMap<String, JTextField>();
public ParamDialog(String[] fields) throws HeadlessException {
this(null, fields);
public ParamDialog(JFrame owner, String[] fields) {
super(owner);
setModal(true);
this.fields = fields;
JPanel main = new JPanel();
main.setLayout(new GridLayout(fields.length, 1));
for (int i = 0; i < fields.length; i++) {
JPanel con = new JPanel(new FlowLayout());
main.add(con);
JTextField tf;
if (fields.endsWith(SECRET)) {
con.add(new JLabel(fields[i].substring(0, fields[i].length() - SECRET.length())));
tf = new JPasswordField();
else {
con.add(new JLabel(fields[i]));
tf = new JTextField();
tf.setColumns(12);
con.add(tf);
mValues.put(fields[i], tf);
this.setMainContent(main);
public boolean showApplyButton() {
return false;
public void apply() {
private boolean mCancel = false;
public void cancel() {
mCancel = true;
super.cancel();
public Properties getProperties() {
if (mCancel) return null;
Properties p = new Properties();
for (int i = 0; i < fields.length; i++) {
p.put(fields[i], mValues.get(fields[i]).getText());
return p;
public static void main (String[] args) {
ParamDialog pd = new ParamDialog(new String[] {"A", "B", "C"});
WindowUtilities.visualize(pd);
public static Properties getProperties(String[] fields) {
ParamDialog pd = new ParamDialog(fields);
WindowUtilities.visualize(pd);
return pd.getProperties(); -
Can not start WebLogic in Eclipse. Error: "Could not find the main class."
I have installed Eclipse 2.0 and WebLogic Server 6.1. and the WebLogc plug in from GENUITEC (and jdk1.3.1_04, on Win2K Server). After I have done the configuration, the WebLogic start/stop buttons are integried into the Eclipse Toolbar, but when I click on the start button to start Weblogic, it pops up a dialog box "Java Virtual Machine Launcher" with message: "Could not find the main class. Program will exit!"
Starting WebLogc Server from the Start panel works fine.
Does any one have seen this before or have a suggestion what I should do?
Many many thanks in advance.
HuanWeblogic must be started with a full JDK; otherwise
JSPs and dynamic EJB stubs could not be deployed. The
error message
indicates you are attempting to use a JRE. Configure
Eclipse JRE to point to a JDK. The product
documentation will help you with this process. It does not work for me. :-(
I have tried JDK 1.3.1 and 1.4.1: same result: I get a "Could not find the main class: Program will exit"
For free expert support please consider contacting
Genuitec at [email protected] If just want any
answer ask a newsgroup.
WayneI'll try the support at '[email protected]' :)
Michel
Michel Szybist
[email protected]
Fax: +33 (0)173729897
SMS: http://www.szybist.net/ -
Implementation of DragManager in extended Panel class
Hi,
I'm facing a problem during implementation of DragManager in
extended Panel class. I've a component which is extending the Panel
class where I've attached four Images with their corresponding
dragging features.
Say, the four images' x positions as these: x1 = 10, x2 = 20,
x3 = 30, x4 = 40. After adding the DragManger class and
implementation of dragging feature to those Images, the dragging is
works fine. But, the problem is, when I'm dragging x1 image, the
imageProxy associated to x1 starts showing from exactly the x1
position, but also all the three images' (x2, x3, x4) imageProxy
starts dragging from x1 position only! When the expected result is,
the x2 imageProxy shud starts drag from x2 x position itself, and
for other x3 imageProxy from x3 position and x4 is their also.
Except the x1 image, all the other three's imageProxy are not
starts from their respective image x position.
Anyone can give any idea.. how to overcome this?
tnks.
ASBWhat are the:
DragManager.doDrag(initiator, ds, event, imageProxy, x, y,
1.0);
x and y parameters in your drag manager's doDrag method? They
should be calculated from the point of mouse click that would
event.localX and event.localY.
ATTA -
Hi, I have quite a strange issue here. I´m just adding localization to my Mac App, and now there is the problem, that the main window is shown correctly, in the correct language. But a seperate panel is not shown in the correct language (German) it´s shown in the default language (English). I added the Localization directly through the ne xib and did not use ibtool.
Is there anything, that might have lead to this problem? Is there anything, I do have to notice?
Thanks in advance.Hi, I have quite a strange issue here. I´m just adding localization to my Mac App, and now there is the problem, that the main window is shown correctly, in the correct language. But a seperate panel is not shown in the correct language (German) it´s shown in the default language (English). I added the Localization directly through the ne xib and did not use ibtool.
Is there anything, that might have lead to this problem? Is there anything, I do have to notice?
Thanks in advance. -
Dialog updates database... refresh Main panel?
ref: JDev 3.1
Given an application that has a Master/Detail Form with details in a gridcontrol, and a button that kicks up a dialog panel that allows the user to edit extensively a row that appears in the said gridcontrol...
How does one force a refresh of the underlaying rowset in the original panel ( and force a redisplay into the grid control to reflect the updated data )?
I'm trying to avoid instantiating the rowset as a passed parameter to the dialog and then manually pushing everything back on the main panel...
Or am I ( again ) conceptually missing some significant approach to solving this task?
TIAOK... here's some (working) sample code for an application based on Brian's help to Ali's session question, that also answers my question. Probably obvious to many, it may be helpful to newbies like me who are very confused reading the postings and trying to figure this stuff out.
It shares a rowset between a frame and a dialog box. The data is kept in synch (automagically) as things change in the dialog box.
Steps:
1. Build a database connection class
2. Put it in the application before opening the base frame.
3. Build the frame/dialog. DO NOT specify a sessioninfo/rowsetinfo using the infoproducer drag/drops.
4. Manually hardcode the sessioninfo/rowset stuff manually as noted.
Note also that session info is not passed nor published except once.
This seems to work. Please advise if you know of any glaring flaws. I wouldn't be surprised. Obviously, this is easier to actually do when you see the sample code than what it sounds like reading the postings! TIA.
public class Application1
public Application1()
/** call the generic database connections **/
/** Note that this is a simple class that used the IDE **/
/** to define a sessioninfo and rowset using drag and drop **/
/** in the DESIGN mode to the Structure pane... then edit the attributes **/
dbConnections x = new dbConnections();
/** THEN open the frame **/
Frame1 frame = new Frame1();
frame.show();
public static void main(String[] args)
new Application1();
package package2;
import oracle.dacf.dataset.*;
import oracle.dacf.dataset.connections.*;
public class dbConnections extends Object
SessionInfo sessionInfo3 = new SessionInfo();
RowSetInfo rowSetInfo3 = new RowSetInfo();
AttributeInfo ACTION_CODErowSetInfo3 = new AttributeInfo(java.sql.Types.VARCHAR);
AttributeInfo ACTION_TEXTrowSetInfo3 = new AttributeInfo(java.sql.Types.VARCHAR);
public dbConnections()
try
jbInit();
sessionInfo3.publishSession();
catch (Exception e)
e.printStackTrace();
private void jbInit() throws Exception
ACTION_TEXTrowSetInfo3.setName("ACTION_TEXT");
ACTION_CODErowSetInfo3.setName("ACTION_CODE");
rowSetInfo3.setAttributeInfo( new AttributeInfo[] {
ACTION_CODErowSetInfo3,
ACTION_TEXTrowSetInfo3} );
sessionInfo3.setAppModuleInfo(new PackageInfo("", "MyProject3"));
sessionInfo3.setConnectionInfo(new LocalConnection("qms"));
sessionInfo3.setName("sessionInfo3");
rowSetInfo3.setQueryInfo(new QueryInfo(
"rowSetInfo3ViewUsage",
"package2.ActionCodes",
"action_code, action_text",
"action_codes",
null,
null
rowSetInfo3.setSession(sessionInfo3);
rowSetInfo3.setName("rowSetInfo3");
package package2;
import javax.swing.*;
import java.awt.*;
import oracle.dacf.control.swing.*;
import oracle.jdeveloper.layout.*;
import oracle.dacf.dataset.*;
import java.awt.event.*;
public class Frame1 extends JFrame
JPanel jPanel1 = new JPanel();
GridControl gridControl1 = new GridControl();
XYLayout xYLayout1 = new XYLayout();
XYLayout xYLayout2 = new XYLayout();
JButton jButton1 = new JButton();
public Frame1()
super();
try
jbInit();
catch (Exception e)
e.printStackTrace();
private void jbInit() throws Exception
this.getContentPane().setLayout(xYLayout2);
this.setSize(new Dimension(517, 549));
jButton1.setText("Detail");
jButton1.addActionListener(new java.awt.event.ActionListener()
public void actionPerformed(ActionEvent e)
jButton1_actionPerformed(e);
gridControl1.setLayout(xYLayout1);
this.getContentPane().add(jPanel1, new XYConstraints(0, 0, 508, 284));
jPanel1.add(gridControl1, null);
this.getContentPane().add(jButton1, new XYConstraints(219, 268, -1, -1));
/** manually typed this in **/
gridControl1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3");
void jButton1_actionPerformed(ActionEvent e)
Dialog1 myDialog = new Dialog1();
myDialog.show();
package package2;
import javax.swing.*;
import java.awt.Frame;
import java.awt.BorderLayout;
import oracle.jdeveloper.layout.*;
import oracle.dacf.control.swing.*;
import oracle.dacf.dataset.*;
public class Dialog1 extends JDialog
JPanel jPanel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
TextFieldControl textFieldControl1 = new TextFieldControl();
NavigationBar navigationBar1 = new NavigationBar();
TextFieldControl textFieldControl2 = new TextFieldControl();
public Dialog1(Frame parent, String title, boolean modal)
super(parent, title, modal);
try
jbInit();
pack();
catch (Exception e)
e.printStackTrace();
public Dialog1()
this(null, "", false);
private void jbInit() throws Exception
jPanel1.setLayout(xYLayout1);
getContentPane().add(jPanel1);
jPanel1.add(textFieldControl1, new XYConstraints(89, 125, 234, -1));
jPanel1.add(navigationBar1, new XYConstraints(99, 314, -1, -1));
jPanel1.add(textFieldControl2, new XYConstraints(89, 158, 236, -1));
/** Manually typed the following in **/
textFieldControl1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3/ACTION_CODE");
textFieldControl2.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3/ACTION_TEXT");
navigationBar1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3");
null -
Could not find the main class. & java.lang.NoClassDefFound error:
sir / madam
I am facing problems with j2ksdk1.4.0 beta instalation on my windows 2000 advance server.
while installing pops up a message saying could not find the main class.
while using java or javac it says
Exception in thread main
java.lang.NoClassDefFound error:
com/sun/tools/javac/main
even when double clicking java plugin from the control panel
I get the Java virtual machine launcher saying could not find the main class.
I don't have any other java sdk installed.
And i have my environment variables (classpath, path and java_home) set correctly.
this same j2sdk1.4.0 version is installed in the windows 98 system and it's working fine.
Kindly do help me to solve this problem.
eagerly awaiting for your response.
Thanking you
Sajeev Nair
[email protected]you must check with the classpath
please see that you have not repeated %classpath%
at the end of the class path like you do in win98.
similiarly with %path%
in win2000 it is automatically taken care off. -
Could not find the main class JRE 1.6 only with console program into Contro
Hi,
I want replace JRE1.5-11 with JRE 1.6.
Applet is running correctly with JRE 1.6.
But when i want launching Java program located into "Parameters/Control Panel"
I have following error message "Could not find the main class JRE 1.6 "
Regards
Philippei wouldn't report a nullpointer to sun unless you're fairly confident there's some sort of bug. if main() can't be found it sounds to me like a config issue. if nullpointer, sounds like a code issue. post the code if you want, but i don't think sun will help you debug this.
-
I have added a Panel to my Applet and some buttons on it. It compiled without any problems but once I view the html file nothing appears. Would anyone know what can be wrong? I am looking forward to hearing from you.
SauloThis is the code I am trying to implement. Apparently it's all correct, as when I compile there's not even a single error message. Problems start to appear when I use the appletviewer: nothing appears on the screen. I would be grateful if you could point where I have made a mistake, as Java is completely new for me. This is just an exercise that I am trying to do before moving forward. Thanks!
Saulo
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Web2 extends Applet implements ActionListener
private Button home;
private Button company;
private Button products;
private Button contact;
String msg ="";
AudioClip sound;
Panel panel;
public void init() {
panel = new Panel();
panel.setLayout(new GridLayout(1,4));
panel.add(home = new Button("home"));
home.addActionListener(this);
panel.add(company = new Button("company"));
company.addActionListener(this);
panel.add(products = new Button("products"));
products.addActionListener(this);
panel.add(contact = new Button("contact"));
contact.addActionListener(this);
validate();
AudioClip sound = getAudioClip (getDocumentBase(), "music.wav");
sound.play();
public void actionPerformed (ActionEvent e)// what each button will do
String msg = e.getActionCommand ();
if (msg.equals("Home")) {msg ="You pressed home";}
else if (msg.equals("The company")) {msg ="You pressed company";}
else if (msg.equals("Products")) {msg ="You pressed products";}
else if (msg.equals("Contact Information")) {msg ="You pressed contact";}
repaint ();
} -
sekic0429{uabudd_milou}[w10/rbssw/2.0] pwd
/tmp/MyJava/jexcelapi
sekic0429{uabudd_milou}[w10/rbssw/2.0] printenv CLASSPATH
/tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib
sekic0429{uabudd_milou}[w10/rbssw/2.0] ls
build ExcelSearch.java index.html resources SearchExcel.java~ tutorial.html
docs ExelSearch.java~ jxl.jar SearchExcel.class src workbook.dtd
ExcelSearch.class formatworkbook.dtd jxlrwtest.xls SearchExcel.java TestSpecification.xls
sekic0429{uabudd_milou}[w10/rbssw/2.0] javac -extdirs . ExcelSearch.java
sekic0429{uabudd_milou}[w10/rbssw/2.0]
sekic0429{uabudd_milou}[w10/rbssw/2.0] java ExcelSearch
Exception in thread "main" java.lang.NoClassDefFoundError: ExcelSearch
Caused by: java.lang.ClassNotFoundException: ExcelSearch
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: ExcelSearch. Program will exit.
sekic0429{uabudd_milou}[w10/rbssw/2.0] cat ExcelSearch.java
import java.io.File;
import java.io.IOException;
import java.util.Date;
import jxl.*;
import jxl.read.biff.BiffException;
public class ExcelSearch
public static void main(String[] args)
try
Workbook workbook = Workbook.getWorkbook(new File("TestSpecification.xls"));
catch (IOException e)
e.printStackTrace();
catch (BiffException e)
e.printStackTrace();
Regards Peter, hope for answerr035198x wrote:
Where is SearchExcel.class?Excellent question, though I think I spotted a problem with the cp supplied.
Note the documentation for -cp state (in part)
For example, if directory foo contains a.jar and b.JAR, then the class path element foo/* is expanded to a A.jar:b.JAR, except that the order of jar files is unspecified.So instead of this..
java -cp /tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcel..try this..
java -cp /tmp/MyJava/excelapi/*:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcelNotes:
1) Adding the JRE classes to the classpath should not be necessary, but I left the rest of the cp unaltered to highlight the one specific difference I am suggesting.
2) When posting code, code snippets, HTML/XML or input/output, please use the code tags. The code tags help retain the indentation and formatting of the sample. To use them, select the sample text and click the CODE button.
If that still fails, tell us more specifically where the SearchExcel class is by copy/pasting the output (within code tags) of the command..
prompt>jar -tvf mysearchexcel.jarWhere, of course, you replace 'mysearchexcel.jar' with the actual Jar name it is supposed to be located in.
Edit 1:
Changed JavaDocs -> documentation.
Edited by: AndrewThompson64 on Jan 11, 2010 7:12 PM
Maybe you are looking for
-
ITUNES connection timing out etc
Hello I got my IPOD in Jan this year. It was working fine until a Windows download wiped my hard drive (or something like that). Anyway, I got my laptop fixed and it's working fine now. I had to download ITUNES (8.0 I think) again and for the first t
-
Odd/Limited Mouse Behavior
I have an intermittent problem with my mouse behavior in 10.6. Actually, I'm pretty sure I had the same problem in 10.5, it's just a fiendishly intermittent problem that has an as yet undetermined cause & solution. All I know is that it occasionally
-
i just bought this brand new imac but i am unable to use or download almost anything because it asks for a password. When we bought this computer there was already this password. We did not install it. Also just today we went to a shop to ask for the
-
Well, I must say that i am not surprised! I am not the only one it seems where the BB speed at home consistently dips to below my former speeds before i paid for BT. So my latest speed shows the following: Download 0,5 mb Upload 0.1 mb basically pre
-
Having problem with the type tool
When I click on the type tool, I don't see the cursor like I should. Instead, I see a tiny flash, but when I type, nothing. What's wrong. Does anyone know?