Need some BADI or USEREXIT for VI06
Hi,
I want to update the validity start and validity end date in the ME23N using the pricing date of the shipment cost document .
I am sheduling a batch job for shipmet cost through VI06 . So, can anyone help me how to do this .
Regards,
Shilpa
Hi,
I think this needs to be done with MM user exits after creation of Shipment cost document. Else you may create an utility which runs on schedule which picks the date from shipment cost document and update in PO.
Thanks,
Krish.
Similar Messages
-
DO i need some extra hardware interface for receving both Audio and video
hi i m doing e-learning project. i have to capture video from webcam and voice from headphone and send to client.
but my code is working fine for either one at a time.
DO i need some extra hardware interface for receving both Audio and video. im using code AVTransmit and AVReceive found from this site only
After running TX
i give Dsound:// & vfw://0 in Media Locater only sound is received and no vedio
and when i give vfw://0 in Media Locater only live video is transmited.
im using JMF1.1.2e.
if any one know the method to run or cause of it plz reply me soon. i will be very thankfull
transmiter/server side code .first run TX on server
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.util.*;
import javax.media.rtp.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
public class Tx extends JFrame implements ActionListener, KeyListener,
MouseListener, WindowListener {
Vector targets;
JList list;
JButton startXmit;
JButton rtcp;
JButton update;
JButton expiration;
JButton statistics;
JButton addTarget;
JButton removeTarget;
JTextField tf_remote_address;
JTextField tf_remote_data_port;
JTextField tf_media_file;
JTextField tf_data_port;
TargetListModel listModel;
AVTransmitter avTransmitter;
RTCPViewer rtcpViewer;
JCheckBox cb_loop;
Config config;
public Tx() {
setTitle( "JMF/RTP Transmitter");
config= new Config();
GridBagLayout gridBagLayout= new GridBagLayout();
GridBagConstraints gbc;
JPanel p= new JPanel();
p.setLayout( gridBagLayout);
JPanel localPanel= createLocalPanel();
gbc= new GridBagConstraints();
gbc.gridx= 0;
gbc.gridy= 0;
gbc.gridwidth= 2;
gbc.anchor= GridBagConstraints.CENTER;
gbc.fill= GridBagConstraints.BOTH;
gbc.insets= new Insets( 10, 5, 0, 0);
((GridBagLayout)p.getLayout()).setConstraints( localPanel, gbc);
p.add( localPanel);
JPanel targetPanel= createTargetPanel();
gbc= new GridBagConstraints();
gbc.gridx= 1;
gbc.gridy= 1;
gbc.weightx= 1.0;
gbc.weighty= 1.0;
gbc.anchor= GridBagConstraints.CENTER;
gbc.fill= GridBagConstraints.BOTH;
gbc.insets= new Insets( 10, 5, 0, 0);
((GridBagLayout)p.getLayout()).setConstraints( targetPanel, gbc);
p.add( targetPanel);
JPanel mediaPanel= createMediaPanel();
gbc= new GridBagConstraints();
gbc.gridx= 1;
gbc.gridy= 2;
gbc.weightx= 1.0;
gbc.weighty= 1.0;
gbc.anchor= GridBagConstraints.CENTER;
gbc.fill= GridBagConstraints.BOTH;
gbc.insets= new Insets( 10, 5, 0, 0);
((GridBagLayout)p.getLayout()).setConstraints( mediaPanel, gbc);
p.add( mediaPanel);
JPanel buttonPanel= new JPanel();
rtcp= new JButton( "RTCP Monitor");
update= new JButton( "Transmission Status");
update.setEnabled( false);
rtcp.addActionListener( this);
update.addActionListener( this);
buttonPanel.add( rtcp);
buttonPanel.add( update);
gbc= new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth= 2;
gbc.weightx = 1.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets( 5,5,10,5);
((GridBagLayout)p.getLayout()).setConstraints( buttonPanel, gbc);
p.add( buttonPanel);
getContentPane().add( p);
list.addMouseListener( this);
addWindowListener( this);
pack();
setVisible( true);
private JPanel createMediaPanel() {
JPanel p= new JPanel();
GridBagLayout gridBagLayout= new GridBagLayout();
GridBagConstraints gbc;
p.setLayout( gridBagLayout);
JLabel label= new JLabel( "Media Locator:");
gbc= new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.EAST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,10,5);
((GridBagLayout)p.getLayout()).setConstraints( label, gbc);
p.add( label);
tf_media_file= new JTextField( 35);
gbc= new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets( 5,5,10,5);
((GridBagLayout)p.getLayout()).setConstraints( tf_media_file, gbc);
p.add( tf_media_file);
tf_media_file.setText( config.media_locator);
cb_loop= new JCheckBox( "loop");
startXmit= new JButton( "Start Transmission");
startXmit.setEnabled( true);
startXmit.addActionListener( this);
gbc= new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,10,5);
((GridBagLayout)p.getLayout()).setConstraints( cb_loop, gbc);
p.add( cb_loop);
cb_loop.setSelected( true);
cb_loop.addActionListener( this);
gbc= new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,10,5);
((GridBagLayout)p.getLayout()).setConstraints( startXmit, gbc);
p.add( startXmit);
TitledBorder titledBorder= new TitledBorder( new EtchedBorder(), "Source");
p.setBorder( titledBorder);
return p;
private JPanel createTargetPanel() {
JPanel p= new JPanel();
GridBagLayout gridBagLayout= new GridBagLayout();
GridBagConstraints gbc;
p.setLayout( gridBagLayout);
targets= new Vector();
for( int i= 0; i < config.targets.size(); i++) {
targets.addElement( config.targets.elementAt( i));
listModel= new TargetListModel( targets);
list= new JList( listModel);
list.addKeyListener( this);
list.setPrototypeCellValue( "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
JScrollPane scrollPane= new JScrollPane( list,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
gbc= new GridBagConstraints();
gbc.gridx= 0;
gbc.gridy= 0;
gbc.weightx= 1.0;
gbc.weighty= 1.0;
gbc.anchor= GridBagConstraints.CENTER;
gbc.fill= GridBagConstraints.BOTH;
gbc.insets= new Insets( 10, 5, 0, 0);
((GridBagLayout)p.getLayout()).setConstraints( scrollPane, gbc);
p.add( scrollPane);
JPanel p1= new JPanel();
p1.setLayout( gridBagLayout);
JLabel label= new JLabel( "IP Address:");
gbc= new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.EAST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,0,5);
((GridBagLayout)p1.getLayout()).setConstraints( label, gbc);
p1.add( label);
tf_remote_address= new JTextField( 15);
gbc= new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,0,5);
((GridBagLayout)p1.getLayout()).setConstraints( tf_remote_address, gbc);
p1.add( tf_remote_address);
label= new JLabel( "Data Port:");
gbc= new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.EAST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,0,5);
((GridBagLayout)p1.getLayout()).setConstraints( label, gbc);
p1.add( label);
tf_remote_data_port= new JTextField( 15);
gbc= new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,0,5);
((GridBagLayout)p1.getLayout()).setConstraints( tf_remote_data_port, gbc);
p1.add( tf_remote_data_port);
JPanel p2= new JPanel();
addTarget= new JButton( "Add Target");
removeTarget= new JButton( "Remove Target");
p2.add( addTarget);
p2.add( removeTarget);
addTarget.addActionListener( this);
removeTarget.addActionListener( this);
gbc= new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.weightx = 1.0;
gbc.weighty = 0.0;
gbc.gridwidth= 2;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets( 20,5,0,5);
((GridBagLayout)p1.getLayout()).setConstraints( p2, gbc);
p1.add( p2);
gbc= new GridBagConstraints();
gbc.gridx= 1;
gbc.gridy= 0;
gbc.weightx= 1.0;
gbc.weighty= 1.0;
gbc.anchor= GridBagConstraints.CENTER;
gbc.fill= GridBagConstraints.BOTH;
gbc.insets= new Insets( 10, 5, 0, 0);
((GridBagLayout)p.getLayout()).setConstraints( p1, gbc);
p.add( p1);
TitledBorder titledBorder= new TitledBorder( new EtchedBorder(), "Targets");
p.setBorder( titledBorder);
return p;
private JPanel createLocalPanel() {
JPanel p= new JPanel();
GridBagLayout gridBagLayout= new GridBagLayout();
GridBagConstraints gbc;
p.setLayout( gridBagLayout);
JLabel label= new JLabel( "IP Address:");
gbc= new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.EAST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,0,5);
((GridBagLayout)p.getLayout()).setConstraints( label, gbc);
p.add( label);
JTextField tf_local_host= new JTextField( 15);
gbc= new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,0,5);
((GridBagLayout)p.getLayout()).setConstraints( tf_local_host, gbc);
p.add( tf_local_host);
try {
String host= InetAddress.getLocalHost().getHostAddress();
tf_local_host.setText( host);
} catch( UnknownHostException e) {
label= new JLabel( "Data Port:");
gbc= new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.EAST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,0,5);
((GridBagLayout)p.getLayout()).setConstraints( label, gbc);
p.add( label);
tf_data_port= new JTextField( 15);
gbc= new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets( 5,5,10,5);
((GridBagLayout)p.getLayout()).setConstraints( tf_data_port, gbc);
p.add( tf_data_port);
tf_data_port.setText( config.local_data_port);
TitledBorder titledBorder= new TitledBorder( new EtchedBorder(), "Local Host");
p.setBorder( titledBorder);
return p;
public void actionPerformed( ActionEvent event) {
Object source= event.getSource();
if( source == addTarget) {
String ip= tf_remote_address.getText().trim();
String port= tf_remote_data_port.getText().trim();
String localPort= tf_data_port.getText().trim();
addTargetToList( localPort, ip, port);
if( avTransmitter != null) {
avTransmitter.addTarget( ip, port);
} else if( source == removeTarget) {
int index= list.getSelectedIndex();
if( index != -1) {
Target target= (Target) targets.elementAt( index);
if( avTransmitter != null) {
avTransmitter.removeTarget( target.ip, target.port);
targets.removeElement( target);
listModel.setData( targets);
} else if( source == startXmit) {
if( startXmit.getLabel().equals( "Start Transmission")) {
int data_port= new Integer( tf_data_port.getText()).intValue();
avTransmitter= new AVTransmitter( this, data_port);
avTransmitter.start( tf_media_file.getText().trim(), targets);
avTransmitter.setLooping( cb_loop.isSelected());
startXmit.setLabel( "Stop Transmission");
} else if( startXmit.getLabel().equals( "Stop Transmission")) {
avTransmitter.stop();
avTransmitter= null;
removeNonBaseTargets();
listModel.setData( targets);
startXmit.setLabel( "Start Transmission");
} else if( source == rtcp) {
if( rtcpViewer == null) {
rtcpViewer= new RTCPViewer();
} else {
rtcpViewer.setVisible( true);
rtcpViewer.toFront();
} else if( source == cb_loop) {
if( avTransmitter != null) {
avTransmitter.setLooping( cb_loop.isSelected());
private void removeNonBaseTargets() {
String localPort= tf_data_port.getText().trim();
for( int i= targets.size(); i > 0;) {
Target target= (Target) targets.elementAt( i - 1);
if( !target.localPort.equals( localPort)) {
targets.removeElement( target);
i--;
public void addTargetToList( String localPort,
String ip, String port) {
ListUpdater listUpdater= new ListUpdater( localPort, ip,
port, listModel, targets);
SwingUtilities.invokeLater( listUpdater);
public void rtcpReport( String report) {
if( rtcpViewer != null) {
rtcpViewer.report( report);
public void windowClosing( WindowEvent event) {
config.local_data_port= tf_data_port.getText().trim();
config.targets= new Vector();
for( int i= 0; i < targets.size(); i++) {
Target target= (Target) targets.elementAt( i);
if( target.localPort.equals( config.local_data_port)) {
config.addTarget( target.ip, target.port);
config.media_locator= tf_media_file.getText().trim();
config.write();
System.exit( 0);
public void windowClosed( WindowEvent event) {
public void windowDeiconified( WindowEvent event) {
public void windowIconified( WindowEvent event) {
public void windowActivated( WindowEvent event) {
public void windowDeactivated( WindowEvent event) {
public void windowOpened( WindowEvent event) {
public void keyPressed( KeyEvent event) {
public void keyReleased( KeyEvent event) {
Object source= event.getSource();
if( source == list) {
int index= list.getSelectedIndex();
public void keyTyped( KeyEvent event) {
public void mousePressed( MouseEvent e) {
public void mouseReleased( MouseEvent e) {
public void mouseEntered( MouseEvent e) {
public void mouseExited( MouseEvent e) {
public void mouseClicked( MouseEvent e) {
Object source= e.getSource();
if( source == list) {
int index= list.getSelectedIndex();
if( index != -1) {
Target target= (Target) targets.elementAt( index);
tf_remote_address.setText( target.ip);
tf_remote_data_port.setText( target.port);
int index= list.locationToIndex( e.getPoint());
public static void main( String[] args) {
new Tx();
class TargetListModel extends AbstractListModel {
private Vector options;
public TargetListModel( Vector options) {
this.options= options;
public int getSize() {
int size;
if( options == null) {
size= 0;
} else {
size= options.size();
return size;
public Object getElementAt( int index) {
String name;
if( index < getSize()) {
Target o= (Target)options.elementAt( index);
name= o.localPort + " ---> " + o.ip + ":" + o.port;
} else {
name= null;
return name;
public void setData( Vector data) {
options= data;
fireContentsChanged( this, 0, data.size());
class ListUpdater implements Runnable {
String localPort, ip, port;
TargetListModel listModel;
Vector targets;
public ListUpdater( String localPort, String ip, String port,
TargetListModel listModel, Vector targets) {
this.localPort= localPort;
this.ip= ip;
this.port= port;
this.listModel= listModel;
this.targets= targets;
public void run() {
Target target= new Target( localPort, ip, port);
if( !targetExists( localPort, ip, port)) {
targets.addElement( target);
listModel.setData( targets);
public boolean targetExists( String localPort, String ip, String port) {
boolean exists= false;
for( int i= 0; i < targets.size(); i++) {
Target target= (Target) targets.elementAt( i);
if( target.localPort.equals( localPort)
&& target.ip.equals( ip)
&& target.port.equals( port)) {
exists= true;
break;
return exists;
>>>>>>>>>>>>>>>>>
import java.awt.*;
import java.io.*;
import java.net.InetAddress;
import java.util.*;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.format.*;
import javax.media.control.TrackControl;
import javax.media.control.QualityControl;
import javax.media.rtp.*;
import javax.media.rtp.event.*;
import javax.media.rtp.rtcp.*;
public class AVTransmitter implements ReceiveStreamListener, RemoteListener,
ControllerListener {
// Input MediaLocator
// Can be a file or http or capture source
private MediaLocator locator;
private String ipAddress;
private int portBase;
private Processor processor = null;
private RTPManager rtpMgrs[];
private int localPorts[];
private DataSource dataOutput = null;
private int local_data_port;
private Tx tx;
public AVTransmitter( Tx tx, int data_port) {
this.tx= tx;
local_data_port= data_port;
* Starts the transmission. Returns null if transmission started ok.
* Otherwise it returns a string with the reason why the setup failed.
public synchronized String start( String filename, Vector targets) {
String result;
locator= new MediaLocator( filename);
// Create a processor for the specified media locator
// and program it to output JPEG/RTP
result = createProcessor();
if (result != null) {
return result;
// Create an RTP session to transmit the output of the
// processor to the specified IP address and port no.
result = createTransmitter( targets);
if (result != null) {
processor.close();
processor = null;
return result;
// Start the transmission
processor.start();
return null;
* Use the RTPManager API to create sessions for each media
* track of the processor.
private String createTransmitter( Vector targets) {
// Cheated. Should have checked the type.
PushBufferDataSource pbds = (PushBufferDataSource)dataOutput;
PushBufferStream pbss[] = pbds.getStreams();
rtpMgrs = new RTPManager[pbss.length];
localPorts = new int[ pbss.length];
SessionAddress localAddr, destAddr;
InetAddress ipAddr;
SendStream sendStream;
int port;
SourceDescription srcDesList[];
for (int i = 0; i < pbss.length; i++) {
// for (int i = 0; i < 1; i++) {
try {
rtpMgrs[i] = RTPManager.newInstance();
port = local_data_port + 2*i;
localPorts[ i]= port;
localAddr = new SessionAddress( InetAddress.getLocalHost(),
port);
rtpMgrs.initialize( localAddr);
rtpMgrs[i].addReceiveStreamListener(this);
rtpMgrs[i].addRemoteListener(this);
for( int k= 0; k < targets.size(); k++) {
Target target= (Target) targets.elementAt( k);
int targetPort= new Integer( target.port).intValue();
addTarget( localPorts[ i], rtpMgrs[ i], target.ip, targetPort + 2*i);
sendStream = rtpMgrs[i].createSendStream(dataOutput, i);
sendStream.start();
} catch (Exception e) {
e.printStackTrace();
return e.getMessage();
return null;
public void addTarget( String ip, String port) {
for (int i= 0; i < rtpMgrs.length; i++) {
int targetPort= new Integer( port).intValue();
addTarget( localPorts[ i], rtpMgrs[ i], ip, targetPort + 2*i);
public void addTarget( int localPort, RTPManager mgr, String ip, int port) {
try {
SessionAddress addr= new SessionAddress( InetAddress.getByName( ip),
new Integer( port).intValue());
mgr.addTarget( addr);
tx.addTargetToList( localPort + "", ip, port + "");
} catch( Exception e) {
e.printStackTrace();
public void removeTarget( String ip, String port) {
try {
SessionAddress addr= new SessionAddress( InetAddress.getByName( ip),
new Integer( port).intValue());
for (int i= 0; i < rtpMgrs.length; i++) {
rtpMgrs[ i].removeTarget( addr, "target removed from transmitter.");
} catch( Exception e) {
e.printStackTrace();
boolean looping= true;
public void controllerUpdate( ControllerEvent ce) {
System.out.println( ce);
if( ce instanceof DurationUpdateEvent) {
Time duration= ((DurationUpdateEvent) ce).getDuration();
System.out.println( "duration: " + duration.getSeconds());
} else if( ce instanceof EndOfMediaEvent) {
System.out.println( "END OF MEDIA - looping=" + looping);
if( looping) {
processor.setMediaTime( new Time( 0));
processor.start();
public void setLooping( boolean flag) {
looping= flag;
public void update( ReceiveStreamEvent event) {
String timestamp= getTimestamp();
StringBuffer sb= new StringBuffer();
if( event instanceof InactiveReceiveStreamEvent) {
sb.append( timestamp + " Inactive Receive Stream");
} else if( event instanceof ByeEvent) {
sb.append( timestamp + " Bye");
} else {
System.out.println( "ReceiveStreamEvent: "+ event);
tx.rtcpReport( sb.toString());
public void update( RemoteEvent event) {
String timestamp= getTimestamp();
if( event instanceof ReceiverReportEvent) {
ReceiverReport rr= ((ReceiverReportEvent) event).getReport();
StringBuffer sb= new StringBuffer();
sb.append( timestamp + " RR");
if( rr != null) {
Participant participant= rr.getParticipant();
if( participant != null) {
sb.append( " from " + participant.getCNAME());
sb.append( " ssrc=" + rr.getSSRC());
} else {
sb.append( " ssrc=" + rr.getSSRC());
tx.rtcpReport( sb.toString());
} else {
System.out.println( "RemoteEvent: " + event);
private String getTimestamp() {
String timestamp;
Calendar calendar= Calendar.getInstance();
int hour= calendar.get( Calendar.HOUR_OF_DAY);
String hourStr= formatTime( hour);
int minute= calendar.get( Calendar.MINUTE);
String minuteStr= formatTime( minute);
int second= calendar.get( Calendar.SECOND);
String secondStr= formatTime( second);
timestamp= hourStr + ":" + minuteStr + ":" + secondStr;
return timestamp;
private String formatTime( int time) {
String timeStr;
if( time < 10) {
timeStr= "0" + time;
} else {
timeStr= "" + time;
return timeStr;
* Stops the transmission if already started
public void stop() {
synchronized (this) {
if (processor != null) {
processor.stop();
processor.close();
processor = null;
for (int i= 0; i < rtpMgrs.length; i++) {
rtpMgrs[ i].removeTargets( "Session ended.");
rtpMgrs[ i].dispose();
public String createProcessor() {
if (locator == null) {
return "Locator is null";
DataSource ds;
DataSource clone;
try {
ds = javax.media.Manager.createDataSource(locator);
} catch (Exception e) {
return "Couldn't create DataSource";
// Try to create a processor to handle the input media locator
try {
processor = javax.media.Manager.createProcessor(ds);
processor.addControllerListener( this);
} catch (NoProcessorException npe) {
return "Couldn't create processor";
} catch (IOException ioe) {
return "IOException creating processor";
// Wait for it to configure
boolean result = waitForState(processor, Processor.Configured);
if (result == false)
return "Couldn't configure processor";
// Get the tracks from the processor
TrackControl [] tracks = processor.getTrackControls();
// Do we have atleast one track?
if (tracks == null || tracks.length < 1)
return "Couldn't find tracks in processor";
// Set the output content descriptor to RAW_RTP
// This will limit the supported formats reported from
// Track.getSupportedFormats to only valid RTP formats.
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor.setContentDescriptor(cd);
Format supported[];
Format chosen;
boolean atLeastOneTrack = false;
// Program the tracks.
for (int i = 0; i < tracks.length; i++) {
Format format = tracks[i].getFormat();
if (tracks[i].isEnabled()) {
supported = tracks[i].getSupportedFormats();
// We've set the output content to the RAW_RTP.
// So all the supported formats should work with RTP.
// We'll just pick the first one.
if (supported.length > 0) {
if (supported[0] instanceof VideoFormat) {
// For video formats, we should double check the
// sizes since not all formats work in all sizes.
chosen = checkForVideoSizes(tracks[i].getFormat(),
supported[0]);
} else
chosen = supported[0];
tracks[i].setFormat(chosen);
System.err.println("Track " + i + " is set to transmit as:");
System.err.println(" " + chosen);
atLeastOneTrack = true;
} else
tracks[i].setEnabled(false);
} else
tracks[i].setEnabled(false);
if (!atLeastOneTrack)
return "Couldn't set any of the tracks to a valid RTP format";
// Realize the processor. This will internally create a flow
// graph and attempt to create an output datasource for JPEG/RTP
// audio frames.
result = waitForState(processor, Controller.Realized);
if (result == false)
return "Couldn't realize processor";
// Set the JPEG quality to .5.
setJPEGQuality(processor, 0.5f);
// Get the output data source of the processor
dataOutput = processor.getDataOutput();
return null;
static SessionAddress destAddr1, destAddr2;
* For JPEG and H263, we know that they only work for particular
* sizes. So we'll perform extra checking here to make sure they
* are of the right sizes.
Format checkForVideoSizes(Format original, Format supported) {
int width, height;
Dimension size = ((VideoFormat)original).getSize();
Format jpegFmt = new Format(VideoFormat.JPEG_RTP);
Format h263Fmt = new Format(VideoFormat.H263_RTP);
if (supported.matches(jpegFmt)) {
// For JPEG, make sure width and height are divisible by 8.
width = (size.width % 8 == 0 ? size.width :
(int)(size.width / 8) * 8);
height = (size.height % 8 == 0 ? size.height :
(int)(size.height / 8) * 8);
} else if (supported.matches(h263Fmt)) {
// For H.263, we only support some specific sizes.
if (size.width < 128) {
width = 128;
height = 96;
} else if (size.width < 176) {
width = 176;
height = 144;
} else {
width = 352;
height = 288;
} else {
// We don't know this particular format. We'll just
// leave it alone then.
return supported;
return (new VideoFormat(null,
new Dimension(width, height),
Format.NOT_SPECIFIED,
null,
Format.NOT_SPECIFIED)).intersects(supported);
* Setting the encoding quality to the specified value on the JPEG encoder.
* 0.5 is a good default.
void setJPEGQuality(Player p, float val) {
Control cs[] = p.getControls();
QualityControl qc = null;
VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
// Loop through the controls to find the Quality control for
// the JPEG encoder.
for (int i = 0; i < cs.length; i++) {
if (cs[i] instanceof QualityControl &&
cs[i] instanceof Owned) {
Object owner = ((Owned)cs[i]).getOwner();
// Check to see if the owner is a Codec.
// Then check for the output format.
if (owner instanceof Codec) {
Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
for (int j = 0; j < fmts.length; j++) {
if (fmts[j].matches(jpegFmt)) {
qc = (QualityControl)cs[i];
qc.setQuality(val);
System.err.println("- Setting quality to " +
val + " on " + qc);
break;
if (qc != null)
break;
* Convenience methods to handle processor's state changes.
private Integer stateLock = new Integer(0);
private boolean failed = false;
Integer getStateLock() {
return stateLock;
void setFailed() {
failed = true;
private synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
} else if (state == Processor.Realized) {
p.realize();
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
if (failed)
return false;
else
return true;
* Inner Classes
class StateListener implements ControllerListener {
public void controllerUpdate(ControllerEvent ce) {
// If there was an error during configure or
// realizI do this all the time, I put my MBP to a 60 inch Sharp. If you have the video working do the simple thing first. Check to make sure your sound is on your TV and Mac. Then if that doesn't work go to System Prefrences and under sound go to a tab called Output and see if your TV is listed and if it is change it to that setting
Hope It Works -
BADI or Userexit for ME2Xn for VERSION
Hello,
I want to know which is the BADI or USerexit for which in ME22n what ever the changes made in PO,Netprice or Delivery date it should create a NEW VERSION number,only if the Netprice is changed,new version is getting genarated....can any one help me regarding this please?
Moderator message: please work yourself first on your requirement, search for available information.
Edited by: Thomas Zloch on Dec 1, 2010 11:43 AMList of all U-Exists for ME22N:
AMPL0001 User subscreen for additional data on AMPL
LMEDR001 Enhancements to print program
LMELA002 Adopt batch no. from shipping notification when posting a GR
LMELA010 Inbound shipping notification: Transfer item data from IDOC
LMEQR001 User exit for source determination
LMEXF001 Conditions in Purchasing Documents Without Invoice Receipt
LWSUS001 Customer-Specific Source Determination in Retail
M06B0001 Role determination for purchase requisition release
M06B0002 Changes to comm. structure for purchase requisition release
M06B0003 Number range and document number
M06B0004 Number range and document number
M06B0005 Changes to comm. structure for overall release of requisn.
M06E0004 Changes to communication structure for release purch. doc.
M06E0005 Role determination for release of purchasing documents
ME590001 Grouping of requsitions for PO split in ME59
MEETA001 Define schedule line type (backlog, immed. req., preview)
MEFLD004 Determine earliest delivery date f. check w. GR (only PO)
MELAB001 Gen. forecast delivery schedules: Transfer schedule implem.
MEQUERY1 Enhancement to Document Overview ME21N/ME51N
MEVME001 WE default quantity calc. and over/ underdelivery tolerance
MM06E001 User exits for EDI inbound and outbound purchasing documents
MM06E003 Number range and document number
MM06E004 Control import data screens in purchase order
MM06E005 Customer fields in purchasing document
MM06E007 Change document for requisitions upon conversion into PO
MM06E008 Monitoring of contr. target value in case of release orders
MM06E009 Relevant texts for "Texts exist" indicator
MM06E010 Field selection for vendor address
MMAL0001 ALE source list distribution: Outbound processing
MMAL0002 ALE source list distribution: Inbound processing
MMAL0003 ALE purcasing info record distribution: Outbound processing
MMAL0004 ALE purchasing info record distribution: Inbound processing
MMDA0001 Default delivery addresses
MMFAB001 User exit for generation of release order
MRFLB001 Control Items for Contract Release Order
best regards. -
Hai everyone,
Could Anyone Pls Tel me the BADI or USEREXIT for VL31N while Saving the inbound Delivery .
REgards,
EKadevi.SHI Ekadevi ,
following are the Badi's
DLV_CHECK_APO_UPD
DELIVERY_PUBLISH
Following are the user Exits :
V50PSTAT
V02V0004
V02V0003
V02V0002
V02V0001
VMDE0004
VMDE0003
VMDE0002
VMDE0001
V53W0001
V53C0002
V53C0001
V50S0001
V50R0004
V50R0002
V50R0001
V50Q0001
Hope this will help to you.
Regards,
Nikhil -
I need some Important Trigger Programs for Objects
I need some Important Trigger Programs for Objects.
If the program includes the V-array appln, that would be better to.There are some drawbacks, running Windows 7 (only) on a Mac via Bootcamp yields less than stellar results, especially with the Retina display.
And of your traveling, the Mac's high power needs (especially the Retina display) and lack of removable battery are going to be a serious issue. The Retina display is glossy, not ideal for viewing on the road and in varied environments.
CS4 won't run on the OS X version that comes with a Mac, so your looking at purchasing CS6.
Support for Windows is more widespread than for Mac's, also if you ever need to redownload OS X to fix a issue, requires a fast reliable Internet connection of the broadband kind.
If your running Windows on your Mac, you can expect to be on your own and not get support as easily as if you were running it on a regular PC.
If you can't afford to keep up with CS upgrades, then you shouldn't be considering a Mac because there are more paid upgrades on that than on Windows 7, it's like a annual nightmare.
IMMO your still better off on a decent, 1920 x 1080 res, matte screen, removable battery (with extras), Win 7 Pro i7 machine (Pro+ runs XP programs) which will stay like it is and get security updates until 2020.
OS X changes every year and if you don't upgrade, + all your third party software, then about 3 years later your left behind for updates.
Also you will have to buy Win 7 to run on your Mac, the OEM disks won't work.
If your trying to budget, then a Mac is certainly not for you. -
Hi
After creation or change of Inspection plan (QP01 and QP02) i need to start some additional process. Is there any BADI or userexit?
Thanks all,
BrankoHI,
Check the below enhancements.
QPAA0001 Enhancements: Formula checking / editing
QPAA0002 Customer exit - info fields
QPAA0004 Enhancement for transferring mstr insp. char. to task lists
QPAA0005 Deactivation of functions for insp. char. maintenance
QPAA0006 Additional consistency checks - inspection characteristics
QPAP0002 Enhancement for material/plan assignment, plan selection
QPAP0003 Conversion of sample unit of measure to material unit
CNEX0026 Customer enhancement for general inspection of material
QAPP0001 User exit QAPP 1 (create inspection point)
QAPP0002 User exit QAPP 2 (create inspection point & other data)
QAPP0003 User exit QAPP 3 (IDI: inspection point and other data)
QEEM0002 User exit add. functions after reading inspection features
QEEM0006 User exit: add. functions after closing inspection characs
QEVA0002 Calculation of share of scrap in inspection lot
QEVA0003 Calculate "Next inspection date" for batch
QMSB0001 User exit after reading in inspection catalog data
QMSC0001 User exit after reading in inspection method data
QMSC0002 User exit for search field entry in the inspection method
QMSC0003 User exit after saving inspection method data
QMSD0001 User exit after importing master inspection charac. data
QMSD0003 User exit after saving master inspection charac. data
QPAA0003 Additional (auth.) check in plan (inspection chars.)
QPAA0006 Additional consistency checks - inspection characteristics
QPL10003 Sample calculation for inspection lot without plan
QVDM0003 Determ. of deliv. type for inspection lots from deliv. note
Thanks,
Ramakrishna
Message was edited by: Ramakrishna Prasad -
BADI or Userexit For QM01(Quality Notification)
Dear Experts,
I want to add some extra fields in QM01 .
Is there is any BADI or userexit available for QM01(Quality Notification).
Please give me some solution.
Regards,
Sanket.Hi,
SPRO-->Quality management >Notification> Overview of notification types-->Select the notification & 90 give the customer specific screen area
this is the process where we will add the screen...
Go to Function group is XQQM in SE80....create the screen which you have added in config...example 0090 ....
No wgo to includes tab you will see one z*TOP include there you declare the fields you want on this custom screen ....
example : dist type char3.
In the PBO and PAI validations you can make for the added fields as we do in normal Module pool.
In the PAI event create a module and pass the values to the structure VIQMEL.
for example if your added field is dist.
Pass as
VIQMEL-dist = dist.
Go to cmod create a project ,give the enhacement QQMA0001.
In the exit EXIT_SAPMIWO0_009
Pass those values to the req structure which needs to be populated.
example :
i_viqmel-dist = dist.
move-corresponding i_viqmel to e_viqmel.
--> Go to standard table where the values need to be updated(qmel) add one append structure with the req fields
Thanks,
Shailaja Ainala. -
BADI or userexit for MM01 and MM02
Hi All,
My requirment is that when the user create a new material, the profit center field should be auto populated from the input Plant. For example, if the plant for this new material is A, then profit center PCA will be populate. The mapping between plant and profit center is very simple.
Furthermore, when the user try to save the material with invalid profit center, the system should create a warning message and automatically change the profit center to the valid one as well.
Right now, i'm looking for either BADI or userexit that would be suitable for my requirement. Does anyone know which BADI or userexit, I should use. Thanks in advanceHi
Check the following
Enhancement
MGA00001 Material Master (Industry): Checks and Enhancements
MGA00002 Material Master (Industry): Number Assignment
MGA00003 Material Master (Industry and Retail): Number Display
Business Add-in
CDT_CHECK_MATERIAL Checks for Existence of a Material in a CDT
BADI_MM_MATNR Modification-Free Archiving Enhancement of MM_MATNR
BADI_MAT_F_SPEC_SEL BAdI for Material Special Field Selection
BADI_MATNR_CHECK_PVS Check Material for Use in iPPE
BADI_MATERIAL_REF Addition of customer-defined default data for material
BADI_MATERIAL_OD Integration of New Objects in Material or Article Master
BADI_MATERIAL_CHECK Enhanced Checks for Material Master Tables
BADI_GTIN_VARIANT User Exit for Customer-Specific GTIN Variant Check
BADI_EAN_SYSTEMATIC BAdI for Internal Control of EAN Logic
WRF_DISCONT_PARAMS_I BAdI: Parameters in Fashion Discontinuation
WRF_DISCONT_FACT_E BAdI: Follow-Up Actions in Discontinuation
WRF_DISCONT_CHECKS_I BAdI: Scope of Check in Material Reorganization
MG_MASS_NEWSEG User-Specific Fields & Segments in Mass Maintenance
MATGRP_SKU_UPD BAdI for Article Hierarchy Connection
Reward points if useful
Regards
Anji -
BADI or userexit for MIGO transaction
hi All,
I have a requirement to enhance the MIGO transaction subscreen 304.
In subscreen 304 there is only check box ITEM_OK.
In the MIGO at the bottom of the screen ,whenver we click on item_OK check box and press enter, in the line item it will automatically checks.
After the first check it has to get disabled in the screen.
I am trying to find the BADI for this..still trying
Please let me know how to achieve this functionality.Hi,
Try below BAdi's :
MB_MIGO_ITEM_BADI or
MB_MIGO_BADI
MB_DOCUMENT_BADI.
Also these will be of help furthur.
Enhancement/ Business Add-in Description
Enhancement
MB_CF001 Customer Function Exit in the Case of Updating a Mat. Doc.
MBCF0011 Read from RESB and RKPF for print list in MB26
MBCF0010 Customer exit: Create reservation BAPI_RESERVATION_CREATE1
MBCF0009 Filling the storage location field
MBCF0007 Customer function exit: Updating a reservation
MBCF0006 Customer function for WBS element
MBCF0005 Material document item for goods receipt/issue slip
MBCF0002 Customer function exit: Segment text in material doc. item
Business Add-in
MB_RESERVATION_BADI MB21/MB22: Check and Complete Dialog Data
MB_QUAN_CHECK_BADI BAdI: Item Data at Time of Quantity Check
MB_PHYSINV_INTERNAL Connection: Core Inventory and Retail AddOn
MB_MIGO_ITEM_BADI BAdI in MIGO for Changing Item Data
MB_MIGO_BADI BAdI in MIGO for External Detail Subscreens
MB_DOC_BADI_INTERNAL BAdIs when Creating a Material Document (SAP Internal)
MB_DOCUMENT_UPDATE BADI when updating material document: MSEG and MKPF
MB_DOCUMENT_BADI BAdIs when Creating a Material Document
MB_CIN_MM07MFB7_QTY Proposal of quantity from Excise invoice in GR
MB_CIN_MM07MFB7 BAdI for India Version exit in include MM07MFB7
MB_CIN_LMBMBU04 posting of gr
MB_CHECK_LINE_BADI BAdI: Check Line Before Copying to the Blocking Tables
ARC_MM_MATBEL_WRITE Check Add-On-Specific Data for MM_MATBEL
ARC_MM_MATBEL_CHECK Check Add-On-Specific Criteria for MM_MATBEL
hope this will help you.
Regards,
Kiran -
I need some help on ACS for a programmers
Hi all,
Kindly I need someone to guide me how to get the below information for our programmers, our company now they need to integrate our billing system
With ACS which already running. the setup running is :
We have cisco Access points managed by Access controllers with two SSIDs ( USERS , GUESTS ) and the access controller is configured as Client on ACS.
We need to make new setup for Guests, any Guest want to access to Guest wireless network (SSID: GUESTS) I need to create the account on Billing system, our programmers asking me to provide them the DB structure of ACS 5.0 and all information needs for integration between the billing system and the ACS.
Note: we already have another SSID (USERS) for company users and it is running fine and accounts managed directy by ACS ( no need to change the setup).
Goals: The billing system will create the Guest accounts and the account information to be automaticly added to our ACS.
I realy don't know more about ACS and this requirements.
Anyone can help me to acheive this goals.
RegardsJack:
Yes you can any program to do tasks with ACS.
Look into this:
http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_system/5.3/sdk/cli_imp_exp.html
There seems no developer's guide for ACS 5.0. I think you have to upgrde anyway preferably to 5.3 or 5.4.
HTH
Amjad
Rating useful replies is more useful than saying "Thank you" -
Need some friends on ichat for practicing my english
eed some friends on ichat for practicing my english
Hi,
http://www.ralphjohns.co.uk/page5.html#_lists
Lists of Sites that hold List of Chatters using the AIM services.
I may receive some form of compensation, financial or otherwise, from my recommendation or link
8:49 PM Sunday; August 21, 2011
Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb( 10.6.8)
Mac OS X (10.6.8),
"Limit the Logs to the Bits above Binary Images." No, Seriously -
My father gave me his old Mac Book, with OS 10.5.8. I need the version 10.6 for it,despite me searching for software updates daily,it says there are no updates. How do I update it? Will I loose any Save datas from Musics and stuff? By The Way, I live in Brazil.
Snow Leopard = OS X 10.6.x
It is Not available as a download... It is a Paid Upgrade.
Do this first...
Check that your Mac meets the System Requirements for Snow Leopard...
Snow Leopard Tech Specs
http://support.apple.com/kb/SP575
If so... Purchase a Snow Leopard Install Disc...
http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
Other countries...
http://support.apple.com/kb/HE57
After the Successful Install, run Software Update to get the latest updates for Snow Leopard.
Be sure to make a Backup of your Current System Before Upgrading... -
I need to automaticaly change Payment conditions depending on some conditions on item level. There is algorithm which we got from our customer for this calculation. So, i need userexit or badi where I can implement enhancement.
Hello,
Following user exits are present in MIRO
LMR1M001 User exits in Logistics Invoice Verification
LMR1M002 Account grouping for GR/IR account maintenance
LMR1M003 Number assignment in Logistics Invoice Verification
LMR1M004 Logistics Invoice Verification: item text for follow-on docs
LMR1M005 Logistics Inv. Verification: Release Parked Doc. for Posting
LMR1M006 Logistics Invoice Verification: Process XML Invoice
MRMH0001 Logistics Invoice Verification: ERS procedure
MRMH0002 Logistics Invoice Verification: EDI inbound
MRMH0003 Logistics Invoice Verification: Revaluation/RAP
MRMN0001 Message output and creation: Logistics Invoice Verification
No of Exits: 10
Saurabh -
Need some OO design pointers for a Java card game I wrote for uni
Hi,
I hope a few of you Java sifus can help me understand I dilemma I keep finding myself in.
I created a card game for a university assignment which works great but its not very OO at the moment.
I only have 3 classes; a Card class, a Deck class and a Game class which contains all my GUI, AI, Game Controller, Player and Hand code.
The assignment is over but I feel like enhancing the game, adding animation, multiplayer, several AI agents etc.
The first thing I have attempted is animation and I've hit a brick wall. I am trying to create animation for my card game whereby I have an animation showing the cards being shuffled and then an animation which shows the cards being dealt to the players. The game then commences. The cards on the GUI then need to be clickable (MouseListeners?) to play the game. If you're running Windows 7, load up 'Hearts' and you'll know what I'm trying to achieve.
I don't understand how the GUI, and Card class need to be seperated so that its good OO.
If I give you a few snippets of code, it might explain the situation:
A snippet of my card class is as follows:
import javax.swing.*;
public class Card extends JLabel //Each card is a JLabel
private int value; //variable for the value of the card
private int suit; //variable for the suit of the card
private ImageIcon frontOfCard; //Displays the image of the front of the cards
private ImageIcon backOfCard; //displays the image of the back of the cards
public Card (int Value, int Suit, ImageIcon front, ImageIcon back)
value = Value;
suit = Suit;
frontOfCard = front;
backOfCard = back;
setIcon(backOfCard); //To make it non-visible when dealt
}As you can see, each card is a JPanel. I've been told by some I shouldn't extend JPanel but rather that I should have a BufferedImage/Image instance variable for each card as the image of the card. The thing is that I need each card displayed on the GUI which can then be clickable. When it is clicked, it is moved from the players hand, into the players move. - There needs to be an animation showing this.
I've got the animation code figured out in terms of how to move 'images' around a screen to make a pleasing animation. The problem is there are no clickable listeners for images, so the Images needs to be inside some container; a widget which can fire events - Hence the reason I have chosen to extend JPanel for my Cards.
and a Deck class, snippet is as follows:
public class Deck extends JLabel //The deck will be shown on the GUI as a JLabel
private ArrayList<Card> standardDeck;
public Deck()
standardDeck = new ArrayList<Card>();
ImageIcon cardBack = new ImageIcon("CardBack.png");
setPreferredSize(new Dimension(90, 135));
setIcon(cardBack);
int cardCount = 0; //This variable counts the cards. Is used to assist in the name generation of the imageicon filename
String str; //the imageIcon constructor accepts filenames as strings so this string holds the filename of the corresponding card image file.
for (int a=0; a<4; a++) //putting the cards into the deck with the specifed parameters
for (int b=2; b<15; b++)
cardCount+=1; //incrementing the card count (the card files are named 1-52 as integers)
str = Integer.toString(cardCount); //Integer is converted to string type before being added to string str variable
str += ".png"; //To complete the image filename, ".png" has to be concatenated to the string.
standardDeck.add(new Card(b, a, new ImageIcon(str), cardBack)); //creating and then adding the cards
}This is how I envisage a new class diagram for my game:
Card class
Game Class <--- Holds a Deck instance, Players instances, and the GUI instance
Player Class <-- Will contains hand 'instances' , but I will not create a seperate 'Hand' Class, I will use an ArrayList.
AI Class extends Player Class
GUI Class
Deck Class <-- contains 52 cards
My question is, how do I show the Cards on the GUI if my Cards are in a Deck and the Deck is held in the Game class?
Please note that there are 52 cards, so potentially 52 images on the GUI, each of which needs to be clickable. When clicked, the cards are moved about, e.g. from the deck to a players hand, from a players hand back to the deck, from a players hand to a players current move hand.
etc
I've read that GUI, program control, and logic should be seperated. If thats the case, what do I have in my GUI class if the Cards (which are JPanels) are held in the Deck class which in turn is held in the Game class?
Any help on this would be greatly appreciated!
I know what I have written may not be fully clear. I find it hard sometimes to fully convey a problem at hand. Please let me know if you don't understand what I've written and I'll do my best to explain further.Faz_86 wrote:
Hi,
I hope a few of you Java sifus can help me understand I dilemma I keep finding myself in.
I created a card game for a university assignment which works great but its not very OO at the moment.
I only have 3 classes; a Card class, a Deck class and a Game class which contains all my GUI, AI, Game Controller, Player and Hand code.
The assignment is over but I feel like enhancing the game, adding animation, multiplayer, several AI agents etc.
Admirable, and the best way to learn, doing something that interests you.
The first thing I have attempted is animation and I've hit a brick wall. I am trying to create animation for my card game whereby I have an animation showing the cards being shuffled and then an animation which shows the cards being dealt to the players. The game then commences. The cards on the GUI then need to be clickable (MouseListeners?) to play the game. If you're running Windows 7, load up 'Hearts' and you'll know what I'm trying to achieve.
I don't understand how the GUI, and Card class need to be seperated so that its good OO.
If I give you a few snippets of code, it might explain the situation:
A snippet of my card class is as follows:
Do a quick Google on the model view controller pattern. Your listeners are your controllers. Your JPanel, JButton, etc. are your view. The AI, Player, Card and Deck (and presumably something like Score) are your model. Your model should be completely testable and not dependent on either the controller or the view. Imagine you could play the game from the command line. Get that working first. Then you can add all the bells and whistles for the UI.
import javax.swing.*;
public class Card extends JLabel //Each card is a JLabel
(redacted)
As you can see, each card is a JPanel. I've been told by some I shouldn't extend JPanel but rather that I should have a BufferedImage/Image instance variable for each card as the image of the card. The thing is that I need each card displayed on the GUI which can then be clickable. When it is clicked, it is moved from the players hand, into the players move. - There needs to be an animation showing this.Extending JPanel is fine. As you noted, you need something to add listeners to. However, I would separate things a bit. First, a card really only has a rank and suit (and perhaps an association to either the deck or a player holding the card). The notion of setIcon() is where you are tripping up. The card itself exists in memory. You should be able to test a card without using a UI. Create a separate class (CardPanel or something similar) that has a reference to a Card and the additional methods needed for your UI.
I've got the animation code figured out in terms of how to move 'images' around a screen to make a pleasing animation. The problem is there are no clickable listeners for images, so the Images needs to be inside some container; a widget which can fire events - Hence the reason I have chosen to extend JPanel for my Cards.
and a Deck class, snippet is as follows:
public class Deck extends JLabel //The deck will be shown on the GUI as a JLabel
private ArrayList<Card> standardDeck;
public Deck()
standardDeck = new ArrayList<Card>();
ImageIcon cardBack = new ImageIcon("CardBack.png");
setPreferredSize(new Dimension(90, 135));
setIcon(cardBack);
int cardCount = 0; //This variable counts the cards. Is used to assist in the name generation of the imageicon filename
String str; //the imageIcon constructor accepts filenames as strings so this string holds the filename of the corresponding card image file.
for (int a=0; a<4; a++) //putting the cards into the deck with the specifed parameters
for (int b=2; b<15; b++)
cardCount+=1; //incrementing the card count (the card files are named 1-52 as integers)
str = Integer.toString(cardCount); //Integer is converted to string type before being added to string str variable
str += ".png"; //To complete the image filename, ".png" has to be concatenated to the string.
standardDeck.add(new Card(b, a, new ImageIcon(str), cardBack)); //creating and then adding the cards
}This is how I envisage a new class diagram for my game:
I am not an animation buff, so I will assume the above works.
Card classRemove the UI aspects to this class, and I think you are all set here.
Game Class <--- Holds a Deck instance, Players instances, and the GUI instancePresumably this is where main() resides. It will certainly have a reference to model classes (player, game, deck, etc.) and likely the master JFrame (or a controller class you create yourself).
Player Class <-- Will contains hand 'instances' , but I will not create a seperate 'Hand' Class, I will use an ArrayList.Does a player really have multiple hands? It seems to me more of a one-to-one relationship (or a player has a one-to-many relationship to Card).
AI Class extends Player ClassWhy extend Player? Create a Player interface, then have a HumanPlayer and AIPlayer implementation. Common parts could be refactored out into either a helper class (delegation) or AbstractPlayer (inheritance).
GUI ClassMy assumption is that this class has a reference to the master JFrame.
Deck Class <-- contains 52 cards
Yes. You may end up recycling this class such that a Deck can also function as a Hand for a given player. If there are differences between the two, create an interface and have a Hand and a Deck implementation. Coding to interfaces is a good thing.
My question is, how do I show the Cards on the GUI if my Cards are in a Deck and the Deck is held in the Game class?You need to pass a reference to the appropriate view class. That is how MVC works. The controller receives a request from the view, dispatches to some model functionality you write (such as GameRulesEngine, Deck, etc.) and returns a result to the view (which could be the same view or a different one, imagine someone clicking 'high scores').
Please note that there are 52 cards, so potentially 52 images on the GUI, each of which needs to be clickable. When clicked, the cards are moved about, e.g. from the deck to a players hand, from a players hand back to the deck, from a players hand to a players current move hand.
etc
That is up to you to write the animation code. In principle, you have a mouse listener, and then you take the appropriate rendering steps.
I've read that GUI, program control, and logic should be seperated. If thats the case, what do I have in my GUI class if the Cards (which are JPanels) are held in the Deck class which in turn is held in the Game class?
See above.
Any help on this would be greatly appreciated!
You are welcome.
I know what I have written may not be fully clear. I find it hard sometimes to fully convey a problem at hand. Please let me know if you don't understand what I've written and I'll do my best to explain further.No, you have been doing fine.
- Saish -
Need some help with tools for java projects
Hi Friends,
I just want to know what software release management tool do you use.Is there any free tool available on net??
I do not need a subversion tool( cvs,svn etc) or a automation build tool ( luntbuild, cruisecontrol, anthill) , I am looking for some tool,that helps you manage the release after its made.For example,i would like to track down which release was made to which customer on which date,how many releases were made to any particular customer,what source code was shipped to the customer..and so on....
Is there any such tool that can accomplish this???
ThanksHi Friends,
I just want to know what software release management tool do you use.Is there any free tool available on net??
I do not need a subversion tool( cvs,svn etc) or a automation build tool ( luntbuild, cruisecontrol, anthill) , I am looking for some tool,that helps you manage the release after its made.For example,i would like to track down which release was made to which customer on which date,how many releases were made to any particular customer,what source code was shipped to the customer..and so on....
Is there any such tool that can accomplish this???
Thanks
Maybe you are looking for
-
Use of MPSS on Solaris 9 and Java 141_03 - not getting 4M pagesizes
Hi all, Anyone know how to get MPSS actually using large page sizes in 1.4 / SunOS 5.9 ?? I have a 1.4.1_03-b02 JVM that is using the -XX:+UseMPSS option and using the LD_PRELOAD=/usr/lib/mpss.so.1 and MPSSHEAP=4M but when I use pmap -Fxs <PID> I alw
-
Adobe reader xi will not open pdf's in browser for IE 7
I have found the information for internet explorer 8 and 9 but these instructions do not apply to users using internet explorer 7. Any help you can provide would be greatly appreciated.
-
Audio Assignment - sesx to mp3
i need to be able to compile my mult. track into a mp3.. i cant get it to work.. help?
-
Is there a way to pull images from an slideshow?
how do i pull images from a slideshow and bring them back to normal iphoto album?
-
Htmldb service administration password (1.6)
hi , how can I create new service administration account , when i forget the prvious one ? Things like this from 1.5 version does not work. begin wwv_flow_api.set_security_group_id(p_security_group_id=>10); wwv_flow_fnd_user_api.create_fnd_user( p_us