Custom mouselook behavior problems
I am trying to write a custom behavior for mouselook (I know there is one but I want the challenge and the custom levels). I can't seem to get it to move...
Interaction1 class (JFrame):
import javax.swing.JFrame;
import java.awt.event.*;
import javax.swing.Timer;
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.universe.SimpleUniverse;
import javax.media.j3d.*;
import java.awt.Container;
import java.awt.FlowLayout;
import javax.vecmath.*;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import java.awt.Polygon;
import com.sun.j3d.utils.geometry.GeometryInfo;
import com.sun.j3d.utils.geometry.Triangulator;
import com.sun.j3d.utils.geometry.Stripifier;
import com.sun.j3d.utils.universe.ViewingPlatform;
import com.sun.j3d.utils.universe.Viewer;
public class Interaction1 extends JFrame implements ActionListener, KeyListener
public static final long serialVersionUID=1;
private Timer t;
private Canvas3D canvas;
public Interaction1()
super("Interaction1");
setSize(700,530);
setVisible(true);
Container c = getContentPane();
c.setLayout(new FlowLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
canvas = new Canvas3D(config);
canvas.setSize(640,480);
canvas.setVisible(true);
c.add(canvas);
ViewingPlatform vp = new ViewingPlatform();
vp.setNominalViewingTransform();
vp.getViewPlatformTransform().setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
vp.setViewPlatformBehavior( new MouseLookBehavior(vp.getViewPlatformTransform(),this,5f) );
vp.getViewPlatformBehavior().setSchedulingBounds(new BoundingSphere());
SimpleUniverse univ = new SimpleUniverse(vp, new Viewer(canvas));
BranchGroup scene = createSceneGraph();
scene.compile();
univ.addBranchGraph(scene);
addKeyListener(this);
t=new Timer(10,this);
private BranchGroup createSceneGraph()
BranchGroup i = new BranchGroup();
Background bg = new Background();
bg.setColor(.75f,1f,1f);
bg.setApplicationBounds(new BoundingSphere(new Point3d(),500.0));
Shape3D side1 = new Shape3D();
QuadArray abgeom = new QuadArray(4,QuadArray.COORDINATES|QuadArray.TEXTURE_COORDINATE_2);
//order TL,BL,BR,TR
abgeom.setCoordinate(0,new Point3f(-3f,4f,0f));//Front
abgeom.setCoordinate(1,new Point3f(-3f,0f,0f));
abgeom.setCoordinate(2,new Point3f(3f,0f,0f));
abgeom.setCoordinate(3,new Point3f(3f,4f,0f));
abgeom.setTextureCoordinate(0,0,new TexCoord2f(0f,0f));//Front
abgeom.setTextureCoordinate(0,1,new TexCoord2f(0f,1f));
abgeom.setTextureCoordinate(0,2,new TexCoord2f(1f,1f));
abgeom.setTextureCoordinate(0,3,new TexCoord2f(1f,0f));
side1.setGeometry(abgeom);
Appearance abapp = new Appearance();
Texture2D abtex = new Texture2D(Texture.BASE_LEVEL,Texture.RGB,64,64);
abtex.setImage(0,new ImageComponent2D(ImageComponent.FORMAT_RGB,toBufferedImage((new ImageIcon("buildingside.jpg")).getImage())));
abapp.setTexture(abtex);
side1.setAppearance(abapp);
i.addChild(bg);
i.addChild(side1);
return i;
public void keyPressed(KeyEvent e)
if(e.getKeyCode()==KeyEvent.VK_ESCAPE)
System.exit(0);
public void keyReleased(KeyEvent e)
public void keyTyped(KeyEvent e)
private BufferedImage toBufferedImage(Image a)
BufferedImage b = new BufferedImage(64,64,BufferedImage.TYPE_INT_RGB);
Graphics g = b.getGraphics();
g.drawImage(a,0,0,null);
return b;
public void actionPerformed(ActionEvent e)
repaint();
public void paint(Graphics g)
canvas.repaint();
public static void main(String args[])
JFrame a = new Interaction1();
}MouseLookBehavior class (ViewPlatformBehavior):
import java.util.Enumeration;
import javax.media.j3d.*;
import java.awt.event.MouseEvent;
import java.awt.Robot;
import java.awt.Window;
import java.awt.Point;
import java.awt.Dimension;
import com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior;
public class MouseLookBehavior extends ViewPlatformBehavior
private TransformGroup target;
private Transform3D yaw;
private double yawTheta=0.0;
private Robot robot;
private Window window;
private float sensitivity;
public MouseLookBehavior(TransformGroup ooc, Window a, float senstvty)
target=ooc;
window = a;
try{robot = new Robot();}catch(Exception e){}
sensitivity=senstvty;
yaw = new Transform3D();
public MouseLookBehavior(TransformGroup ooc, Window a)
target=ooc;
window = a;
try{robot = new Robot();}catch(Exception e){}
sensitivity=2f;
yaw = new Transform3D();
public void initialize()
wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED));
public void processStimulus(Enumeration e)
MouseEvent a = (MouseEvent)(((WakeupOnAWTEvent)e.nextElement()).getAWTEvent()[0]);
Point winloc = window.getLocation(null);
Dimension windim = window.getSize(null);
winloc.translate((int)windim.getWidth()/2,(int)windim.getHeight()/2);
int difx=a.getX()-(int)(windim.getWidth()/2),dify=a.getY()-(int)(windim.getWidth()/2);
difx*=sensitivity;
dify*=sensitivity;
yawTheta+=difx;
yaw.rotY(yawTheta);
wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED));
robot.mouseMove((int)windim.getWidth()/2,(int)windim.getHeight()/2);
PLEASE NOTE: I have been trying to get an exit command in there but it hasn't worked, so if you decide to run this, you will have to ctrl-alt-dlt it and alt-e it to end the task which brings up an AWT question... why wont it exit?
ALSO NOTE: I am aware of some extra useless variables in the processStimulus method. This is for future versions once I get this one to work. Ignore it.
Perfect! Thanks. I've got a new problem now. whenever I try to use the mouselook, the object disappears. And so I tryed turning to find it and it still isn't there...
Main class
import javax.swing.JFrame;
import java.awt.event.*;
import javax.swing.Timer;
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.universe.SimpleUniverse;
import javax.media.j3d.*;
import java.awt.Container;
import java.awt.FlowLayout;
import javax.vecmath.*;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import java.awt.Polygon;
import com.sun.j3d.utils.geometry.GeometryInfo;
import com.sun.j3d.utils.geometry.Triangulator;
import com.sun.j3d.utils.geometry.Stripifier;
import com.sun.j3d.utils.universe.ViewingPlatform;
import com.sun.j3d.utils.universe.Viewer;
import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
public class Interaction1 extends JFrame implements KeyListener
public static final long serialVersionUID=1;
private Canvas3D canvas;
public Interaction1()
super("Interaction1");
setSize(700,530);
setVisible(true);
Container c = getContentPane();
c.setLayout(new FlowLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
canvas = new Canvas3D(config);
canvas.setSize(640,480);
canvas.setVisible(true);
c.add(canvas);
ViewingPlatform vp = new ViewingPlatform();
vp.setNominalViewingTransform();
vp.getViewPlatformTransform().setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
vp.setViewPlatformBehavior( new MouseLookBehavior(vp.getViewPlatformTransform(),this,10f));
vp.getViewPlatformBehavior().setSchedulingBounds(new BoundingSphere());
SimpleUniverse univ = new SimpleUniverse(vp, new Viewer(canvas));
BranchGroup scene = createSceneGraph();
scene.compile();
univ.addBranchGraph(scene);
addKeyListener(this);
private BranchGroup createSceneGraph()
BranchGroup i = new BranchGroup();
Background bg = new Background();
bg.setColor(.75f,1f,1f);
bg.setApplicationBounds(new BoundingSphere(new Point3d(),500.0));
Shape3D side1 = new Shape3D();
QuadArray abgeom = new QuadArray(4,QuadArray.COORDINATES|QuadArray.TEXTURE_COORDINATE_2);
//order TL,BL,BR,TR
abgeom.setCoordinate(0,new Point3f(-3f,4f,0f));//Front
abgeom.setCoordinate(1,new Point3f(-3f,0f,0f));
abgeom.setCoordinate(2,new Point3f(3f,0f,0f));
abgeom.setCoordinate(3,new Point3f(3f,4f,0f));
abgeom.setTextureCoordinate(0,0,new TexCoord2f(0f,0f));//Front
abgeom.setTextureCoordinate(0,1,new TexCoord2f(0f,1f));
abgeom.setTextureCoordinate(0,2,new TexCoord2f(1f,1f));
abgeom.setTextureCoordinate(0,3,new TexCoord2f(1f,0f));
side1.setGeometry(abgeom);
Appearance abapp = new Appearance();
Texture2D abtex = new Texture2D(Texture.BASE_LEVEL,Texture.RGB,64,64);
abtex.setImage(0,new ImageComponent2D(ImageComponent.FORMAT_RGB,toBufferedImage((new ImageIcon("buildingside.jpg")).getImage())));
abapp.setTexture(abtex);
side1.setAppearance(abapp);
i.addChild(bg);
i.addChild(side1);
return i;
public void keyPressed(KeyEvent e)
if(e.getKeyCode()==KeyEvent.VK_ESCAPE)
System.exit(0);
public void keyReleased(KeyEvent e)
public void keyTyped(KeyEvent e)
private BufferedImage toBufferedImage(Image a)
BufferedImage b = new BufferedImage(64,64,BufferedImage.TYPE_INT_RGB);
Graphics g = b.getGraphics();
g.drawImage(a,0,0,null);
return b;
public static void main(String args[])
JFrame a = new Interaction1();
}MouseLookBehavior:
import java.util.Enumeration;
import javax.media.j3d.*;
import java.awt.event.MouseEvent;
import java.awt.Robot;
import java.awt.Window;
import java.awt.Point;
import java.awt.Dimension;
import com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior;
public class MouseLookBehavior extends ViewPlatformBehavior
private TransformGroup target;
private Transform3D yaw;
private double yawTheta=0.0;
private Robot robot;
private Window window;
private float sensitivity;
public MouseLookBehavior(TransformGroup ooc, Window a, float senstvty)
target=ooc;
window = a;
try{robot = new Robot();}catch(Exception e){}
sensitivity=senstvty;
yaw = new Transform3D();
public MouseLookBehavior(TransformGroup ooc, Window a)
target=ooc;
window = a;
try{robot = new Robot();}catch(Exception e){}
sensitivity=2f;
yaw = new Transform3D();
public void initialize()
wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED));
public void processStimulus(Enumeration e)
MouseEvent a = (MouseEvent)(((WakeupOnAWTEvent)e.nextElement()).getAWTEvent()[0]);
Point winloc = window.getLocation(null);
Dimension windim = window.getSize(null);
winloc.translate((int)windim.getWidth()/2,(int)windim.getHeight()/2);
int difx=a.getX()-(int)(windim.getWidth()/2),dify=a.getY()-(int)(windim.getWidth()/2);
difx*=sensitivity;
dify*=sensitivity;
yawTheta+=difx;
yaw.rotY(yawTheta/180*Math.PI);
target.setTransform(yaw);
robot.mouseMove((int)windim.getWidth()/2,(int)windim.getHeight()/2);
wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED));
}
Similar Messages
-
I’ve drawn shapes many times with the “write on” behavior. All of a sudden, it’s not working. Here’s the problem. “Write On” completes drawing and then reverses a little bit on the last frame. I included frame shots. If anyone can help, I would appreciate it.
Side note: I know I can do the same thing with key frames. However, I’d rather solve the “write on” behavior problem.Ah, nevermind! I think I may have solved the issue myself. It seems if you click on the Group tab to the left of the main timeline as opposed to the clip within the timeline, it allows you to change the group and scale it while also keeping different elements together. Could be helpful for anyone with a similar question.
-
URGENT: Custom Behavior Problem
I'm writing an application which must plot a 3D curve. It has 3 panels, each of which has a 2D projection of the curve (xy, xz, yz). Moving the points on the panels will change the properties of the underlying 3D curve.
When I start the application, The 3D curve is shown correctly, but when I move the points, the 3D curve disappears.
The problem is not the canvas3d not being redrawn, because resizing the window doesn't bring the curve back. Any idea why the curve isn't redrawn?
The code for the curve is as follows:
import javax.media.j3d.*;
import javax.vecmath.*;
import java.lang.Math.*;
public class CubicCurve3D extends Shape3D{
public CubicCurve3D(Point3d p1, Point3d p2, Point3d p3, Point3d p4){
this.setGeometry(createGeometry(p1,p2,p3,p4));
public Geometry createGeometry(Point3d p1, Point3d p2, Point3d p3, Point3d p4){
// setup the LineArray to represent the curve
LineArray curveLine = new LineArray(148, GeometryArray.COORDINATES);
// Add vertices to the array
setupLineArray(p1,p2,p3,p4,curveLine);
return curveLine;
// This method adds the vertices into the array
public void setupLineArray(Point3d p1, Point3d p2, Point3d p3, Point3d p4, LineArray curve){
final Point3d p = new Point3d();;
double nx = 0;
double ny = 0;
double nz = 0;
double u = 0.0;
int lIndex = 0;
for(int i=0;i<75;i++){
u = ((double)i/100)/0.75;
// Equations to work out point
nx = ((p1.x)*Math.pow((1-u),3.0)) + ((p2.x)*(3*u)*Math.pow((1-u),2.0)) + ((p3.x)*(3*u*u)*(1-u)) + ((p4.x)*Math.pow(u,3.0));
ny = ((p1.y)*Math.pow((1-u),3.0)) + ((p2.y)*(3*u)*Math.pow((1-u),2.0)) + ((p3.y)*(3*u*u)*(1-u)) + ((p4.y)*Math.pow(u,3.0));
nz = ((p1.z)*Math.pow((1-u),3.0)) + ((p2.z)*(3*u)*Math.pow((1-u),2.0)) + ((p3.z)*(3*u*u)*(1-u)) + ((p4.z)*Math.pow(u,3.0));
p.set(nx,ny,nz);
// Put point into LineArray
curve.setCoordinate(lIndex,p);
if((i > 0) && (i < 74)){
lIndex++;
curve.setCoordinate(lIndex,p);
lIndex++;
public void updateGeometry(Point3d p1, Point3d p2, Point3d p3, Point3d p4){
this.setGeometry(createGeometry(p1,p2,p3,p4));
}The behavior, called UpdateBehavior, is:
import javax.media.j3d.*;
import javax.vecmath.*;
import java.util.Enumeration;
public class UpdateBehavior extends Behavior
// The set of points to be updated
private Point3d[] points;
private CubicCurve3D cc;
public UpdateBehavior(CubicCurve3D c)
cc = c;
postId(1);
public void initialize()
this.wakeupOn(new WakeupOnBehaviorPost(this, 1));
public void processStimulus(Enumeration e)
cc.updateGeometry(points[0],points[1],points[2],points[3]);
this.wakeupOn(new WakeupOnBehaviorPost(this, 1));
public void setNewPoints(Point3d[] p)
points = p;
this.postId(1);
}And the createSceneGraph() method from the Graph3D class is:
public BranchGroup createSceneGraph() {
// Create the root of the branch group
BranchGroup objRoot = new BranchGroup();
// rotate object has composite transformation matrix
Transform3D rotate = new Transform3D();
Transform3D tempRotate = new Transform3D();
rotate.rotX(Math.PI/20.0d);
tempRotate.rotY(Math.PI/6.0d);
rotate.mul(tempRotate);
TransformGroup objRotate = new TransformGroup(rotate);
cc = new CubicCurve3D(points[0],points[1],points[2],points[3]);
cc.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
cc.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
Line3D ax1 = new Line3D(new Point3d(0,0,0), new Point3d(0.75,0,0));
Line3D ax2 = new Line3D(new Point3d(0,0,0), new Point3d(0,0.75,0));
Line3D ax3 = new Line3D(new Point3d(0,0,0), new Point3d(0,0,0.75));
objRotate.addChild(ax1);
objRotate.addChild(ax2);
objRotate.addChild(ax3);
objRotate.addChild(cc);
uBehavior = new UpdateBehavior(cc);
uBehavior.setSchedulingBounds(new BoundingSphere());
objRoot.addChild(objRotate);
objRoot.addChild(uBehavior);
return objRoot;
}Graph3D also has a method updatePoints():
public void updatePoints(Point3d[] p)
points = p;
uBehavior.setNewPoints(points);
System.out.println(cc.getP1() + "," + cc.getP2() + "," + cc.getP3() + "," + cc.getP4());Have you checked if the processStimulus method will ever be executed (e.g. print something or use a debugger and set a breakpoint). If it is not executed maybe the radius of the BoundingSphere of the Behavior is to small ?
I don't know what the initial values of the points and the values of the points you are supplying after change are. So check the coordinates of the new created points ad the calculated curve points.
Is the curve moving out of the viewing frustrum (behind the front or back clipping planes) ?
Add some Appearance object with a color other than the default. -
Weird custom menu behavior in 8.2
I'm in charge of upgrading a large project from LV 7.1 to 8.2 and I ran into several problems but was able to resolve them except 2 major ones (not including the crashing tables and indices in self-indexing while loops).
1) Our custom menu now seems to badly lag when trying to open it. Takes a good 2-3 seconds for any items to show up when the application is running and this behavior continues UNTIL i switch to the block diagram and put in the password for our application (to access the code). This definitely seems like a bug and I wasn't able to find any similar posts. Is this a known issue? Why does it happen?
2)Badly lagging .VIT files. We have about 7 custom display .vit subvis which get called as clones by the application. They're not marked as re-entrant and I know 8.x changed the pass-by-value to pass-by-reference handling of clones. Is this the case? Why are my .vit now running twice as slow as in 7.1 on the same computer?
Altenbach mentioned overlapping elements on the FP of the .vit's in another post, but could someone clear this up for me please? Does slightly overlapping cursor display on a wavegraph count? Or is this when you have a completely different FP control right on top of another control? Any help is greatly appreciated.Message Edited by romulus on 01-24-2007 08:27 AM
Message Edited by romulus on 01-24-2007 08:31 AMHey romulus,
I am still not fully understanding the best way to try and reproduce your issue. If I were to create a new VI with a custom runtime menu in 7.1, then lock the block diagram with a password, and then open this VI in 8.20, should it display this behavior? I will continue trying to reproduce this on my machine, but have been unable to thus far. If you can provide a VI that replicates this problem, I would be happy to talk with R&D about it and see what is happening to cause the issue. Thanks!!
Brian B
Field Sales Engineer
Tennessee/Southern Kentucky
National Instruments -
Layer & Custom Effects UI problem
Here is code of simple effect plug-in:
#include "AEConfig.h"
#include "AEGP_SuiteHandler.h"
#include "AE_Macros.h"
#include "Param_Utils.h"
#include "AEFX_SuiteHelper.h"
#include "entry.h"
extern "C" {
PF_Err DllExport
EntryPointFunc( PF_Cmd cmd, PF_InData *in_data, PF_OutData *out_data,PF_ParamDef *params[], PF_LayerDef *output, void *extra);
static PF_Err
GlobalSetup (PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[],PF_LayerDef *output)
out_data->my_version = PF_VERSION(3, 1, 0, 0, 1);
out_data->out_flags = PF_OutFlag_CUSTOM_UI;
return PF_Err_NONE;
static PF_Err
ParamsSetup ( PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output)
PF_Err err = PF_Err_NONE;
PF_ParamDef def;
AEFX_CLR_STRUCT(def);
PF_ADD_ARBITRARY("Test custom UI", 100, 10, PF_PUI_CONTROL, 0, 2323, 0);
if (!err) {
PF_CustomUIInfo ci;
AEFX_CLR_STRUCT(ci);
ci.events = PF_CustomEFlag_EFFECT | PF_CustomEFlag_LAYER;
err = (*(in_data->inter.register_ui))(in_data->effect_ref, &ci);
AEFX_CLR_STRUCT(def);
PF_ADD_LAYER("Test layer", PF_LayerDefault_NONE, 2);
out_data->num_params = 3;
return err;
static PF_Err
SequenceSetup(PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output, bool allocate)
AEGP_SuiteHandler suites(in_data->pica_basicP);
if(allocate)
out_data->sequence_data = suites.HandleSuite1()->host_new_handle(1);
else if (in_data->sequence_data)
suites.HandleSuite1()->host_dispose_handle(in_data->sequence_data);
return PF_Err_NONE;
DllExport
PF_Err EntryPointFunc ( PF_Cmd cmd, PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output, void *extra)
PF_Err err = PF_Err_NONE;
switch (cmd) {
case PF_Cmd_GLOBAL_SETUP:
err = GlobalSetup( in_data, out_data, params, output);
break;
case PF_Cmd_PARAMS_SETUP:
err = ParamsSetup(in_data, out_data, params, output);
break;
case PF_Cmd_SEQUENCE_SETUP:
err = SequenceSetup(in_data, out_data, params, output, true);
break;
case PF_Cmd_SEQUENCE_SETDOWN:
err = SequenceSetup(in_data, out_data, params, output, false);
break;
return err;
The problem is when i press cntr+C than cntr+V on effect the layer parameter control drop to its' default value.
What i doing wrong?
If i delete custom parameter or sequenceSetup function then layer parameter value do not change after copying.
If i press cntr+D on effect layer parameter do not change too.What i doing wrong?
you're not doing anything wrong.
that's just what AE does when copy/pasting effects with a layer param.
the assumption is that you won't necessarily paste the effect in a comp where the layer with the same layerID is desired as the target. (layer ID's are unique per comp, not the entire project)
experiment with other effects that have a layer param. they should behave in the same way.
what you're describing with the deletion of the custom param and sequence data is indeed strange.
i have no idea why it happens. -
Hi all,
I have written CustomButtonUI for JButton.
But, it results into error.please suggest me.
Here is the code:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.accessibility.Accessible;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.metal.MetalButtonUI;
* CustomButtonUI.java
* Created on March 4, 2010, 5:13 PM
* @author mourya
public class CustomButtonUI extends javax.swing.JDialog {
/** Creates new form CustomButtonUI */
public CustomButtonUI(java.awt.Frame parent, boolean modal) {
super(parent, modal);
String DEFAULTCLASSID="Mybutton";
UIManager.put(DEFAULTCLASSID, "Mybutton");
UIManager.put("ButtonUI",DEFAULTCLASSID);
initComponents();
JButton jbutton = new JButton("Custom");
jbutton.setBounds(10,10,100,20);
add(jbutton);
this.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent event)
System.exit(0);
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 400, Short.MAX_VALUE)
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 300, Short.MAX_VALUE)
pack();
}// </editor-fold>
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CustomButtonUI(new javax.swing.JFrame(), true).setVisible(true);
// Variables declaration - do not modify
// End of variables declaration
class Mybutton extends MetalButtonUI
private final static Mybutton
mMybutton = new Mybutton();
public static ComponentUI createUI(JComponent c)
return mMybutton;
protected void clearTextShiftOffset()
super.clearTextShiftOffset();
protected void finalize() throws Throwable
super.finalize();
protected BasicButtonListener createButtonListener(AbstractButton b)
return super.createButtonListener(b);
protected Color getDisabledTextColor()
return super.getDisabledTextColor();
protected Color getFocusColor()
return super.getFocusColor();
protected String getPropertyPrefix()
return super.getPropertyPrefix();
protected Color getSelectColor()
return super.getSelectColor();
protected int getTextShiftOffset() {
return super.getTextShiftOffset();
protected void installKeyboardActions(AbstractButton b)
super.installKeyboardActions(b);
protected void installListeners(AbstractButton b) {
super.installListeners(b);
protected Object clone() throws CloneNotSupportedException {
return super.clone();
protected void paintButtonPressed(Graphics g, AbstractButton b)
super.paintButtonPressed(g,b);
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
super.paintFocus(g,b,viewRect,textRect,iconRect);
protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect) {
super.paintIcon(g,c,iconRect);
protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text)
g.setColor(Color.GRAY);
super.paintText(g,b,textRect,text);
protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
g.setColor(Color.GRAY);
super.paintText(g,c,textRect,text);
protected void setTextShiftOffset() {
super.setTextShiftOffset();
protected void uninstallKeyboardActions(AbstractButton b) {
super.uninstallKeyboardActions(b);
protected void uninstallListeners(AbstractButton b) {
super.uninstallListeners(b);
public boolean contains(JComponent c, int x, int y)
return super.contains(c,x,y);
public boolean equals(Object obj)
return super.equals(obj);
public Accessible getAccessibleChild(JComponent c, int i) {
return super.getAccessibleChild(c,i);
public int getAccessibleChildrenCount(JComponent c) {
return super.getAccessibleChildrenCount(c);
public int getDefaultTextIconGap(AbstractButton b) {
return super.getDefaultTextIconGap(b);
public Dimension getMaximumSize(JComponent c) {
return super.getMaximumSize(c);
public Dimension getMinimumSize(JComponent c) {
return super.getMinimumSize(c);
public Dimension getPreferredSize(JComponent c) {
return super.getPreferredSize(c);
public void installDefaults(AbstractButton b) {
super.installDefaults(b);
public void installUI(JComponent c) {
super.installUI(c);
public int hashCode() {
return super.hashCode();
public void paint(Graphics g, JComponent c) {
super.paint(g,c);
public String toString() {
return super.toString();
public void uninstallDefaults(AbstractButton b)
super.uninstallDefaults(b);
public void uninstallUI(JComponent c)
super.uninstallUI(c);
public void update(Graphics g, JComponent c)
super.update(g,c);
}Thank YouHi DarrylBurke,
Sure i will.
But i have posted that code after trying all the possibilities.
I thought that getUI() failed exception may have the resulkt for not implementing any method or any registration problem with UIManager.
So, that is my test code not exactly i have posted that in hurry.
Here is the code :
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.accessibility.Accessible;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.metal.MetalButtonUI;
* CustomButtonUI.java
* Created on March 4, 2010, 5:13 PM
* @author mourya
public class CustomButtonUI extends javax.swing.JDialog {
/** Creates new form CustomButtonUI */
public CustomButtonUI(java.awt.Frame parent, boolean modal) {
super(parent, modal);
String DEFAULTCLASSID="Mybutton";
UIManager.put(DEFAULTCLASSID, "Mybutton");
UIManager.put("ButtonUI",DEFAULTCLASSID);
initComponents();
JButton jbutton = new JButton("Custom");
jbutton.setBounds(10,10,100,20);
add(jbutton);
this.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent event)
System.exit(0);
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 400, Short.MAX_VALUE)
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 300, Short.MAX_VALUE)
pack();
}// </editor-fold>
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CustomButtonUI(new javax.swing.JFrame(), true).setVisible(true);
// Variables declaration - do not modify
// End of variables declaration
class Mybutton extends MetalButtonUI
private final static Mybutton
mMybutton = new Mybutton();
public static ComponentUI createUI(JComponent c)
return mMybutton;
protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text)
g.setColor(Color.RED);
super.paintText(g,b,textRect,text);
}Can you please suggest me the possible solution for this problem.
Thank You DarrylBurke -
OOP ALV report custom control performance problem
HI
how to write OOP ALV report without custom control.. Actually with custom control which taking long time... and time out happens for huge selection of data..
Regards
Roops.timeout is not an alv problem. If you try to display a "huge" amount of data, any display technology will fail. Even sap programs fail, their wise solution is to ask user to restrict data to be displayed. Or reduce database selection time, or display amount. Or propose the user to download data as a spool, or output to a file on server.
Otherwise, read some advices about how to handle timeout in [Note 25528 - Parameter rdisp/max_wprun_time|http://service.sap.com/sap/support/notes/25528].
About your question, if you still want to try, look at [example code with alv class cl_salv_table for simple display|http://help.sap.com/saphelp_nw2004s/helpdata/en/f9/1ab54099de3726e10000000a1550b0/frameset.htm] -
Custom Tag Capitalization Problem..
All,
OS: Windows 2000
App Server: Weblogic 6.0 sp 2
JDK: 1.3 (and tried 1.3.1)
I have a set of custom tags that run fine when I use them on an app server (such as Enhydra) with JDK 1.2.2, but when I switch to JDK 1.3.x, which weblogic 6.x requires, they suddenly start generating errors with attributes which have capitalized letters in them. For example, in my taglib I have:
<attribute>
<name>closeConnection</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
and in the support class I have:
* Get the value of closeConnection.
* @return value of closeConnection.
public boolean getCloseConnection() {
return closeConnection;
* Set the value of closeConnection.
* @param v Value to assign to closeConnection.
public void setCloseConnection(String v) {
if(v.toUpperCase().equals("TRUE")){
this.closeConnection = true;
} else {
this.closeConnection = false;
When I go to the page that this tag is on, I get the following output:
Parsing of JSP File '/index.jsp' failed:
/index.jsp(1): Error in using tag library uri='/cwerks' prefix='cwerks': There is no setter method for property 'closeconnection', for Tag class 'net.cwerks.taglib.MyTag'
probably occurred due to an error in /index.jsp line 1:
<%@ taglib uri="/cwerks" prefix="cwerks" %>
Thu Aug 02 19:06:52 PDT 2001
Note that the 'closeconnection' is all lowercase despite the fact that it is upper case in the tld and in the class itself.
I came across a similar problem in weblogic 5.1 when I upgraded from JDK 1.2.2 to JDK 1.3. I tried changing the JDK for weblogic 6.0 sp 2 to 1.2.2, but a dll was missing. I also tried switching it to 1.3.1, but that did not help. It seems like introspection may have changed slightly between the two version. I'm shocked, and a bit suspicious, that I haven't seen this problem all over the newsgroups. Anyone else seen this?
Thank you,
Carson Gross
[email protected]
[att1.html]
A solution presents itself:
The problem was NOT with capitalization. Instead, the problem was as
follows:
My method was for setting a boolean, but I took a string so that people
wouldn't have to type:
<mytags:tag foo="<%=true%>" />
instead, they could type:
<mytags:tag foo="true" />
which would call the setter method with a string "true", which would be then
converted to a boolean within my class.
So my setter has this signature:
public void setFoo(String s)
and my getter has this signature:
public boolean getFoo() /* I know this isn't standard, but isFoo doesn't
sound good to me*/
I can't tell if it's because JavaBeans changed slightly between jdk 1.2.2
and 1.3.x, or if Weblogic changed the way that they do things (I suspect the
latter, since I had things working fine in WL 5.2 w/ jdk 1.2.2 and then
things broke with WL 5.2 w/ jdk 1.3), but this no longer returns foo as a
valid property to be set, and since weblogic 6.x relies on JavaBeans,
instead of straight up introspection, it barfs. (I found this out by using
jad/emacs, a wicked combination for those who want to poke around in jars).
Anyway, I hope I can save someone else who has this same, albeit
specialized, problem a lot of pain by my discovery. Your getters and
setters better be of the same type with custom tags, or weblogic w/ jdk1.3.x
is gonna barf when parsing the tld.
Cheers, and thank God that's behind me,
Carson Gross
[email protected]
====================================================
"Carson Gross" <[email protected]> wrote in message
news:[email protected]...
The plot grows thicker...
The tags work fine on Tomcat 3.2.2
I deploy the example tags that came with wl60 that have more than one
capital letter in thier attributes, and they work fine. But my tag library
stubbornly insists on not working so long as I keep the attributes with more
than one capital letter in. If I remove the offending attributes, or change
them to have only one capital letter, they work, but this is not an
acceptable solution. (I guess.)
I even created an simple introspection class to make sure that the acutal
methods were there. They were.
I am at a complete loss here... I guess it's tomcat for now.
Cheers,
Carson Gross
[email protected]
"Carson Gross" <[email protected]> wrote in message
news:[email protected]...
All,
OS: Windows 2000
App Server: Weblogic 6.0 sp 2
JDK: 1.3 (and tried 1.3.1)
I have a set of custom tags that run fine when I use them on an app server
(such as Enhydra) with JDK 1.2.2, but when I switch to JDK 1.3.x, which
weblogic 6.x requires, they suddenly start generating errors with attributes
which have capitalized letters in them. For example, in my taglib I have:
<attribute>
<name>closeConnection</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
and in the support class I have:
* Get the value of closeConnection.
* @return value of closeConnection.
public boolean getCloseConnection() {
return closeConnection;
* Set the value of closeConnection.
* @param v Value to assign to closeConnection.
public void setCloseConnection(String v) {
if(v.toUpperCase().equals("TRUE")){
this.closeConnection = true;
} else {
this.closeConnection = false;
When I go to the page that this tag is on, I get the following output:
Parsing of JSP File '/index.jsp' failed:
/index.jsp(1): Error in using tag library uri='/cwerks' prefix='cwerks':
There is no setter method for property 'closeconnection', for Tag class
'net.cwerks.taglib.MyTag'
probably occurred due to an error in /index.jsp line 1:
<%@ taglib uri="/cwerks" prefix="cwerks" %>
Thu Aug 02 19:06:52 PDT 2001
Note that the 'closeconnection' is all lowercase despite the fact that it is
upper case in the tld and in the class itself.
I came across a similar problem in weblogic 5.1 when I upgraded from JDK
1.2.2 to JDK 1.3. I tried changing the JDK for weblogic 6.0 sp 2 to 1.2.2,
but a dll was missing. I also tried switching it to 1.3.1, but that did not
help. It seems like introspection may have changed slightly between the two
version. I'm shocked, and a bit suspicious, that I haven't seen this
problem all over the newsgroups. Anyone else seen this?
Thank you,
Carson Gross
[email protected]
-
Customer Balances Report problem?
Hi,
I am facing some problem it may have been discussed before but it is urgent so I am posting it.
1) User wants to see the S_ALR_87012172 - Customer Balances in Local Currency on daily basis or any report which is similar to that.
As far as I know he can't have this report on date wise for that we may have to go for the customization.
Please suggest any other T. code or way out if we have in SAP.
2) I have checked the records and I am confused as when I am running the FBL5N then I can see the balances for a customer
1660000056 DR 31.03.2010 50,000.00
5432402564 GL 31.03.2008 56,545.00-
1900005638 AB 30.06.2007 56,545.00
50,000.00
which is fine as all are open items and due but when I run S_ALR_87012168 - Due Date Analysis for Open Items
Due - Total OI Total OI - Total OI
NAZIMA STORES 10,681.45 23,809.50
Please suggest me why is it so.
Thanks and Regards
NitinHi,
Thanks for your reply PPIO_ENTRY....
The customer does not want the report that is in FD10N and FD11 he wants the report based on the T. code S_ALR_87012172 - Customer Balances in Local Currency or something related to that.
Please suggest...
Thanks and Regards
Nitin -
Custom Report with Problems and incidents
I'm trying to create a custom report of all problems and related incidents. I can query the problemDimvw table, but I need some assistance linking to the incidents. Anyone have a query or point me in a direction to join the necessary tables?
What I'm trying to get is Problem ID, Title, Description, and Incident IDs linked to it. Thanks.
ChrisI know PowerShell can help you with the Get-SCSMRelatedObject command but you would have to write a small script to get that to work en mass.
http://smlets.codeplex.com/ -
Hello, i am facing with such problem:
I have developed application "custom logon screen"
[https://cw.sdn.sap.com/cw/docs/DOC-101074]
after deploy i get this error:
[EXCEPTION]
java.lang.InstantiationException: ID018236: Cannot instantiate bean. java.lang.ClassNotFoundException: class com.sap.engine.applications.security.logon.beans.ResourceBean : java.lang.InstantiationException: com.sap.engine.applications.security.logon.beans.ResourceBean
at JEE_jsp_logonPage_7538450_1282116953062_1282116953515._jspService(JEE_jsp_logonPage_7538450_1282116953062_1282116953515.java:52)
I try to develop similar application at NW CE 7.20 (using documentation for 7.20 - [http://help.sap.com/saphelp_nwce72/helpdata/en/23/c0e240beb0702ae10000000a155106/content.htm]) and had the same problems.
There is at least one mistake in documentation:
"To avoid inconsistencies in class references, add the class folder of the logon logic application to the libraries of the Java build path of the imported logon UI application.
You can find the class folder of the default logon logic application
under the following path:
<ASJava_Installation>/j2ee/cluster/apps/sap.com/com.sap.security.core.logon/servlet_jsp/logon_app/root/WEB-INF/classes"
There are no such folder on server. I tried to add tcsecumelogonlogic_api.jar which can be found at similar location: <ASJava_Installation>/j2ee/cluster/apps/sap.com/com.sap.security.core.logon/servlet_jsp/logon_app/root/WEB-INF/lib After that my application compiling successfully (without that i have errors compiling/validating original file "logonPage.jsp" and others which are using beans from mentioned JAR). But after deployment i get NoClassDefFound/InstantiationException error. btw, all mentioned things in documentions was done exactly as written in documentantion and with different variations many times but without success.Hi,
I have the same problem, please tell us how you solved this problem -
Customer down payment problems
Hello All,
My client is facing the following problem can any one give me a clear idea about reason for this
When an invoice is created from a billing plan, the amount displayed as the amount available from the downpayment is different from the amount that is showing up in the G/L for downpayments.
For example the downpayment amount available while posting an invoice to a customer be 1000, if you go and check the spl GL for the down payment made by the same customer it is showing 9000 ie, a difference of 8000.
What may be the reason for this difference any idea??
Thanks in advance
Arun RHi Arun,
Down payment is a SPL GL transaction. During configuration for SPL GL a seperate recon account is used to book the SPL GL transactions.
In your case, the amount of 1000 may have been posted without SPL GL & rest of the amount may have posted with SPL GL. Check your entry for 1000 posted to customer.
Regards,
Ajay -
Change the look and custom themes, masterpage problem
I have created a masterpage and deployed it to the masterpage gallery.
I have created a spcolor file and a spfont file and deployed them to the theme catalog.
I have also created a New item in the composed look list like this:
Masterpage: /_catalogs/masterpage/mycustom.seattle.master
Theme: /_catalogs/theme/15/mycustom.spcolor
Font: /_catalogs/theme/15/mycustom.spfont
Image: none
DisplayIndex 3
The problem is this: The theme is not displayed in the Change the look preview window.
But if i change the masterpage back to std (/_catalogs/masterpage/seattle.master) in my composed look item. THEN it is displayed ??
Changing back to my custom masterpage, then it disappears.
Everything looks right, i can apply the theme through code. Masterpage is also changed in code and works.
The only place it doesn't work is in change the look.
The masterpage is deployed like this:
<Module Name="MasterPages" List="116" Url="_catalogs/masterpage" Path="MasterPages" RootWebOnly="TRUE">
<File Url="mycustom.seattle.master" Type="GhostableInLibrary">
<Property Name="UIVersion" Value="15" />
<Property Name="ContentTypeId" Value="0x010105" />
</File>
</Module>
What am i missing ??Hi blarsern,
Thanks for your sharing! It will be beneficial to others in this forum who meet the same issue in the future.
I will mark your reply as anwser to close this case.
Wendy
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Quadrature encoder on PCI 6220 DAQ custom digital filter problem
I am using both counters on my 6220 DAQ for quadrature encoders. What I am trying to do is filter some bounce that I am getting on the axes. I want to be able to custom set the minimum pulse width for each encoder (or both the same should be fine). The problem is that the digital filter using DAQmx channel property for each line seems to work fine (I haven't proven that this actually works) but one has to choose from preset values (the smallest being 2.55ms). I want to reject anything that is less the 10ms. This document mentions that you can set up a programmable filter based on an external filter clock. How do you actually do this? Is there no way to use one of the internal timebases for this? If so how? The "Digital Filtering Conciderations for TIO-Based Devices" entry in the NI-DAQmx help states that you can choose one of four different values for a debouncing filter on a PFI line (different values than the previously linked document) and a custom filter value.
OK here is the short question .... is there a way for me to digitally filter the lines coming into my counters to reject anything less then 10ms through software only? If so, how? If using an external timebase is required, how do I do this?
Thanks in advance for any help
GreycatHi Greycat,
Although the documentation does mention that you can have one programmable filter setting, this is only true for TIO-Based devices. Unfortunately, the NI-6220 is a M-Series, which means that the only allowable minimum pulse widths settings are 125 ns, 6.425 µs and 2.55 ms. More information on this can be found in your NI-DAQmx help under NI-DAQmx Device Considerations » Digital Filtering » C and M Series.
I believe for your application requirement, we would have to look into some oour Counter/Timer devices.
S_Hong
National Instruments
Applications Engineer -
Sequel Search Server Behaviors Problem
This code was made with php-msql server behaviors - recordset
pull down's....
I have a form to search for firstname or lastname or both but
I'm not getting the right results
SELECT * FROM phonebook WHERE firstname LIKE %s and lastname
LIKE %s
problem 1 - if I have NOTHING in the form then *all* records
get returned
I guess the problem is with blank form fields?
Q: How can I fix this?
full query below...still curious about this - thanks in advance
Maybe you are looking for
-
How to configure Oracle National Language Support for Hindi
Hello I am Working on one library project and right now it is in foxpro. it is working in local(hindi) language using c-dec software.Now i want to run this project using oracle national language support.i have done lots of rnd on that but till could
-
How to change the colors for individual bubbles in a bubble chart?
I have a report where in a bubble chart needs to be shown with different colors for bubbles available in the chart. I cant find any option to select individual bubbles and format the color options. Any guidance or suggestions solving this would be mu
-
Backend connection Steps to be done to recieve idocs? i.e XI to R3(IDOC)
Hi all, what are the backend connection need to be done to Receive IDoc from XI i.e From XI to R3( IDOC)
-
Missing setipmm command under listenerconfig
Team, I have been trying to test the mail merge feature on test environment and somehow I can not find a way to execute setipmm command on CLI. As per the user guide 8-5-6, Use the setipmm subcommand of listerconfig to enable the IPMM on the listener
-
Can I replace my HD with a SSD?
I just got an ad in my email. I can get a 12GB SSD with up to 559 MB/Sec speed for $155. Can I replace the HD in my iMac with such a drive? I might then get an external enclosure for the original drive.