Clock applet example. createImage returns null

Hello, I'm quite new with AWT and I need help. I cannot use swing.
I'm trying to make a "normal" app with the applet of the analog clock that is included as an example in the JDK. I have been reading the API of java.awt.applet and I have made the following things:
1.- I have deleted the Parser classes that are there fore taking the parameters that were used in the html.
2.- I have made an class that extends Panel and implement Runnable, as same as the class Applet. This class, called XClock, includes an adapted AnalogClock that is the class included in the example.
I think I have to do the double-buffering. So I have included the following code:
// Create the offImage for double-buffering.
offImage = createImage(size.width, size.height);
offG = offImage.getGraphics();
Of course, size has the right values. My code compiles ok, but when I run it says that offImage becomes null, so in the second line it throws a NullPointerException.
I have made the following class to test the XClock class:
public class Prueba {
public static void main(String[]args){
XClock reloj=new XClock();
XClock extends Panel. �Any help?. Please, it's quite important for me.

This will make you go:
import java.awt.event.*;
import java.awt.*;
public class Prueba  extends Frame 
     Xclock clock = new Xclock();
public Prueba ()
     addWindowListener(new WindowAdapter()
    {     public void windowClosing(WindowEvent ev)
          {     setVisible(false);
     setBounds(10,10,400,300);
     add(clock);
     setVisible(true);
public class Xclock extends Panel
     Image    offImage = null;
     Graphics offG;
public Xclock()
public void paint(Graphics g)
     if (offImage == null)
          offImage = createImage(getWidth(),getHeight());
          offG     = offImage.getGraphics();
          offG.drawOval(10,10,250,250);
     g.drawImage(offImage,0,0,this);
public void update(Graphics g)
     paint(g);
public static void main(String[] args )
     new Prueba ();
Noah
import java.awt.event.*;
import java.awt.*;
public class Prueba extends Frame
     Xclock clock = new Xclock();
public Prueba ()
     addWindowListener(new WindowAdapter()
{     public void windowClosing(WindowEvent ev)
          {     setVisible(false);
     setBounds(10,10,400,300);
     add(clock);
     setVisible(true);
public class Xclock extends Panel
     Image offImage = null;
     Graphics offG;
public Xclock()
public void paint(Graphics g)
     if (offImage == null)
          offImage = createImage(getWidth(),getHeight());
          offG = offImage.getGraphics();
          offG.drawOval(10,10,250,250);
     g.drawImage(offImage,0,0,this);
public void update(Graphics g)
     paint(g);
public static void main(String[] args )
     new Prueba ();
}

Similar Messages

  • FrameGrabbingControl returns null

    In my code i want to grab a frame from a video and displey it in another window.But the problem is that " FrameGrabbingControl fgc =(FrameGrabbingControl) player.getControl("javax.media.control.FrameGrabbingControl");" returns null.Please help me by pionting out the error. Thanks in advance.
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.Thread;
    import java.util.*;
    import java.lang.*;
    import java.lang.String;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.IOException;
    import java.util.Properties;
    import javax.media.*;
    import java.applet.*;
    import javax.swing. *;
    import javax.swing.border. *;
    import javax.media.datasink. *;
    import javax.media.format. *;
    import javax.media.protocol. *;
    import javax.media.util. *;
    import javax.media.control. *;
    import java.awt.image. *;
    import com.sun.image.codec.jpeg. *;
    import com.sun.media.protocol.vfw.VFWCapture;
    import java.io.*;
    import javax.media.control.FrameGrabbingControl;
    //import com.sun.media.util.JMFSecurity;
    * This is a Java Applet that demonstrates how to create a simple
    * media player with a media event listener. It will play the
    * media clip right away and continuously loop.
    * <!-- Sample HTML
    * <applet code=SimplePlayerApplet width=320 height=300>
    * <param name=file value="sun.avi">
    * </applet>
    * -->
    public class grabframe extends Applet implements ControllerListener,ActionListener
    static int shotCounter = 1;
    Button button;
    // media Player
    Player player = null;
    // component in which video is playing
    Component visualComponent = null;
    // controls gain, position, start, stop
    Component controlComponent = null;
    // displays progress during download
    Component progressBar = null;
    boolean firstTime = true;
    long CachingSize = 0L;
    Panel panel = null;
    int controlPanelHeight = 0;
    int videoWidth = 0;
    int videoHeight = 0;
    * Read the applet file parameter and create the media
    * player.
    public void init()
    setLayout(new BorderLayout());
         setBackground(Color.white);
         panel = new Panel();
         //panel.setLayout( null );
         add(panel,BorderLayout.SOUTH);
         panel.setBounds(0, 0, 320, 240);
    button=new Button("GRAB FRAME");
              panel.add(button);
              button.addActionListener(this);
         // input file name from html param
         String mediaFile = null;
         // URL for our media file
         MediaLocator mrl = null;//MediaLocator describes the location of the media content while
         URL url = null;//URL specify the location of the media
         // Get the media filename info.
         // The applet tag should contain the path to the
         // source media file, relative to the html page.
         if ((mediaFile = getParameter("file")) == null)
         Fatal("Invalid media file parameter");
    //System.out.println("mediafile :"+mediaFile);
         try
         url = new URL(getDocumentBase(), mediaFile);//return a new URL using an existing URL as reference
    //     System.out.println("url :"+url);
                   mediaFile = url.toExternalForm();//return a string representation of the URL
    //     System.out.println("mediafile :"+mediaFile);
              catch (MalformedURLException mue)
         try
         // Create a media locator from the file name
         if ((mrl = new MediaLocator(mediaFile)) == null)
              Fatal("Can't build URL for " + mediaFile);
         // Create an instance of a player for this media
         try
              player = Manager.createPlayer(mrl);
                   catch (NoPlayerException e)
              System.out.println(e);
              Fatal("Could not create player for " + mrl);
    /* catch (CannotRealizeException e)
              System.out.println(e);
              Fatal("Could not create player for " + mrl);
         // Add ourselves as a listener for a player's events
         player.addControllerListener(this);
              catch (MalformedURLException e)
         Fatal("Invalid media file URL!");
              catch (IOException e)
         Fatal("IO exception creating player for " + mrl);
         // This applet assumes that its start() calls
         // player.start(). This causes the player to become
         // realized. Once realized, the applet will get
         // the visual and control panel components and add
         // them to the Applet. These components are not added
         // during init() because they are long operations that
         // would make us appear unresposive to the user.
    }//end of init
    * Start media file playback. This function is called the
    * first time that the Applet runs and every
    * time the user re-enters the page.
    public void start()
         //$ System.out.println("Applet.start() is called");
    // Call start() to prefetch and start the player.
    if (player != null)
         player.start();
    * Stop media file playback and release resource before
    * leaving the page.
    public void stop()
         //$ System.out.println("Applet.stop() is called");
    if (player != null)
    player.stop();
    player.deallocate();
    public void destroy()
         //$ System.out.println("Applet.destroy() is called");
         player.close();
    * This controllerUpdate function must be defined in order to
    * implement a ControllerListener interface. This
    * function will be called whenever there is a media event
    public synchronized void controllerUpdate(ControllerEvent event)
         // If we're getting messages from a dead player,
         // just leave
         if (player == null)
         return;
         // When the player is Realized, get the visual
         // and control components and add them to the Applet
         if (event instanceof RealizeCompleteEvent)
         if (progressBar != null)
              panel.remove(progressBar);
              progressBar = null;
         int width = 320;
         int height = 0;
         if (controlComponent == null)
              if (( controlComponent = player.getControlPanelComponent()) != null)
                        //controlPanelComponent provides the default user interface for controlling the player
              controlPanelHeight = controlComponent.getPreferredSize().height;
              panel.add(controlComponent);
              height += controlPanelHeight;
         if (visualComponent == null)
              if (( visualComponent = player.getVisualComponent())!= null)
                        //visualComponent provides display component(where the visual media is recorded) of the player
              panel.add(visualComponent,BorderLayout.CENTER);
              Dimension videoSize = visualComponent.getPreferredSize();
              videoWidth = videoSize.width;
              videoHeight = videoSize.height;
              width = videoWidth;
              height += videoHeight;
              visualComponent.setBounds(0, 0, videoWidth, videoHeight);
         panel.setBounds(0, 0, width, height);
         if (controlComponent != null)
              controlComponent.setBounds(0, videoHeight,width, controlPanelHeight);
              controlComponent.invalidate();
         } //end of RearizedCompleteEvent
              else if (event instanceof CachingControlEvent)
         if (player.getState() > Controller.Realizing)
              return;
         // Put a progress bar up when downloading starts,
         // take it down when downloading ends.
         CachingControlEvent e = (CachingControlEvent) event;
         CachingControl cc = e.getCachingControl();
         // Add the bar if not already there ...
         if (progressBar == null)
         if ((progressBar = cc.getControlComponent()) != null)
              panel.add(progressBar);
              panel.setSize(progressBar.getPreferredSize());
              validate();
         } //end of CashingControlEvent
                   else if (event instanceof EndOfMediaEvent)
         // We've reached the end of the media; rewind and
         // start over
         player.setMediaTime(new Time(0));
         player.start();
         } //end of EndOfMediaEvent
                   else if (event instanceof ControllerErrorEvent)
         // Tell TypicalPlayerApplet.start() to call it a day
         player = null;
         Fatal(((ControllerErrorEvent)event).getMessage());
    }//end of ControllerErrorEvent
                   else if (event instanceof ControllerClosedEvent)
         panel.removeAll();
         }//end of ControllerClosedEnent
    }//end of controller update
    void Fatal (String s)
         // Applications will make various choices about what
         // to do here. We print a message
         System.err.println("FATAL ERROR: " + s);
         throw new Error(s); // Invoke the uncaught exception
                   // handler System.exit() is another
                   // choice.
    public void actionPerformed(ActionEvent ae)
    Dimension imageSize = null;
    String str=ae.getActionCommand();
    if(str.equals ("GRAB FRAME"))
    Image photo = grabFrameImage();
         if (photo != null)
    MySnapshot snapshot = new MySnapshot(photo, new Dimension(imageSize));
         else
    System.err.println("Errore : Impossibile grabbare il frame");
    repaint();
    * Grabba un frame dalla webcam @restituisce il frame in un buffer
    public Buffer grabFrameBuffer()
    if (player != null)
         FrameGrabbingControl fgc =(FrameGrabbingControl) player.getControl("javax.media.control.FrameGrabbingControl");
    System.out.println(fgc );
         if (fgc != null)
    return (fgc.grabFrame());
         else
    System.err.println("Errore : FrameGrabbingControl non disponibile");
    return (null);
    else
         System.err.println("Errore nel Player");
    return (null);
    * Converte il buffer frame in un'immagine
    public Image grabFrameImage()
    Buffer buffer = grabFrameBuffer();
    if (buffer != null)
    BufferToImage btoi = new BufferToImage((VideoFormat) buffer.getFormat());
    if (btoi != null)
    Image image = btoi.createImage(buffer);
    if (image != null)
    return (image);
              else
    System.err.println("Errore di conversione Buffer - BufferToImage");
    return (null);
         else
    System.err.println("Errore nella creazione di BufferToImage");
    return (null);
         else
    System.out.println("Errore: buffer vuoto");
    return (null);
    class MySnapshot extends JFrame
    protected Image photo = null;
    protected int shotNumber;
         public MySnapshot(Image grabbedFrame, Dimension imageSize)
    super();
    shotNumber = shotCounter++;
    setTitle("Immagine" + shotNumber);
    photo = grabbedFrame;
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    int imageHeight = photo.getWidth(this);
    int imageWidth = photo.getHeight(this);
    setSize(imageSize.width, imageSize.height);
    final FileDialog saveDialog = new FileDialog(this,"Salva immagine", FileDialog.SAVE);
    final JFrame thisCopy = this;
    saveDialog.setFile("Immagine" + shotNumber);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    saveDialog.show();
    String filename = saveDialog.getFile();
    if (filename != null)
    if (saveJPEG(filename))
    JOptionPane.showMessageDialog(thisCopy,"Salvata immagine " + filename);
    setVisible(false);
    dispose();
                             else
    JOptionPane.showMessageDialog(thisCopy,"Errore nel salvataggio di " + filename);
                             else
    setVisible(false);
    dispose();
    setVisible(true);
    public void paint(Graphics g)
    g.drawImage(photo, 0, 0, getWidth(), getHeight(), this);
    public boolean saveJPEG(String filename)
    boolean saved = false;
    BufferedImage bi = new BufferedImage(photo.getWidth(null), photo.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = bi.createGraphics();
    g2.drawImage(photo, null, null);
    FileOutputStream out = null;
    try
    out = new FileOutputStream(filename);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
    param.setQuality(1.0f, false);
    encoder.setJPEGEncodeParam(param);
    encoder.encode(bi);
    out.close();
    saved = true;
         catch (Exception ex)
    System.out.println("Errore salvataggio JPEG: "+ ex.getMessage());
    return (saved);
    }//end of class SimplePlayerApplet

    Hmm....
    some of that looks very familiar to me :-)
    http://forum.java.sun.com/thread.jspa?forumID=28&threadID=570463
    1. post your code wrapped in code tags and it'll display it nicely.
    2. post to the Java Media Framework topic,
    I haven't tried JMF within an applet.
    Have you tried getting it working in an application first ?
    That should simplify your debugging to start with.
    I suspect the Player hasn't started yet, or isn't in a realised state.
    regards,
    Owen

  • HelpSet.findHelpSet() returns null, and trapping ID errors

    I was having a problem initializing JavaHelp. HelpSet.findHelpSet() was returning null. I searched the forum, and found it was a common problem, but the answers were unhelpful. The answers pointed to a problem with CLASSPATH, but offered little in the way of advice for a newbie like myself on how to deal with it.
    A second issue concerns HelpBroker.enableHelpOnButton(). If you feed it a bogus ID, it throws an exception, and there's no way to trap it and fail gracefully. JHUG doesn't provide much in the way of alternatives.
    Now, having done a bit of research and testing, I'm willing to share a cookbook formula for what worked for me.
    I'm working in a project directory that contains MyApp.jar and the Help subdirectory, including Help/Help.hs. My first step is to copy jh.jar to the project directory.
    Next, in the manifest file used to generate MyApp.jar, I add the line:
        Class-Path: jh.jar Help/I'm working with Eclipse, so in Eclipse, I use Project - Properties - Java Build Path - Libraries to add JAR file jh.jar, and Class Folder Tony/Help
    I define the following convenience class:
    public class HelpAction extends AbstractAction
        private static HelpBroker helpBroker = null;
        private String label = null;
        public HelpAction( String name, String label )
            super( name );
            this.label = label;
        public void actionPerformed( ActionEvent event )
            displayHelp( label );
        public static boolean displayHelp( String label )
            if ( helpBroker == null )
                Utils.reportError( "Help package not initialized!" );
                return false;
            try
                helpBroker.setCurrentID( label );
                helpBroker.setDisplayed( true );
                return true;
            catch ( Exception e )
                Utils.reportError( e, "Help for " + label + " not found" );
                return false;
        public static boolean initialize( String hsName )
            URL hsURL = HelpSet.findHelpSet( null, hsName );
            if ( hsURL == null )
                Utils.reportError( "Can't find helpset " + hsName );
                return false;
            try
                HelpSet helpSet = new HelpSet( null, hsURL );
                helpBroker = helpSet.createHelpBroker();
            catch ( HelpSetException e )
                Utils.reportError( e, "Can't open helpset " + hsName );
                return false;
            return true;
    }If you use this class in your own code, you'll want to replace Utils.reportError() with something of your own devising.
    Finally, in my GUI class, I use the following:
        JPanel panel = ...
        JMenu menu = ...
        JToolbar toolbar = ...
        HelpAction.initialize( "Help.hs" )
        Action gsAction = new HelpAction( "Getting Started Guide", "gs.top" );
        menu.add( gsAction );
        JButton helpButton = new HelpAction( "Help", "man.top" );
        toolbar.add( helpButton );
        InputMap imap = panel.getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
        imap.put( KeyStroke.getKeyStroke( "F1" ), "F1help" );
        ActionMap amap = panel.getActionMap();
        amap.put( "F1help", new HelpAction( null, "man.top" ) );

    Sorry, the sixth-from-last line of my example should read,
        JButton helpButton = new JButton( new HelpAction( "Help", "man.top" ) );

  • Get textFrame by label returns null and anchored objects

    I have the following two functions:
    function getByLabel(page, label)
        for(var i=0; i < page.allPageItems.length; i++)
            if( page.allPageItems[i].label == label )
                return page.allPageItems[i];
    and
    Object.prototype.findItems = function(/*obj*/props)
        if( !('everyItem' in this) )
            throw new Error("Error: " + this + " is not a collection.");
        var ret = this.everyItem().getElements(),
            i = ret.length,
            e, p;
        while( i-- && e=ret[i] )
            for( p in props )
                if( (p in e) && e[p]===props[p] ) continue;
                ret.splice(i,1);
        return ret;
    In my page structure, I got one main text frame (the content area) and two vertical text fromes on the sides of the page. There is also a small box textframe on top of the page. All these textboxes EXCEPT the main text frame are ALL "ANCHORED objects". I had to make them anchored objects, eitherwise after importing data, the boxes would jump around. (Example, the small box textframe that is on the top would get moved to the content area textframe etc). Not sure if using anchored objects is the proper way to fix this.
    When I try to get the small box text frame, it does not work using the findItems (returns null) but it works fine with the getByLabel method. Why is that?
    The calling syntax is:
    for( i=0 ; i < doc.pages.length ; ++i )
            var page = doc.pages.item(i);
            var textFrame = getByLabel(page, 'lblSection' ); //This works
            //   var textFrame = page.textFrames.findItems({ label:  'lblSection' })[0]; This does not work, returns null
            if( textFrame != null )
                textFrame.parentStory.contents = "";

    (function () {
        // Per the InDesign Scripting Guide, app.activeScript is only
        // valid when a script is directly executed from InDesign, not
        // from the ESTK, so a try/catch block is recommended to handle
        // it.
        var d;
        try {
            d = app.activeScript.parent.parent.fsName;
        } catch (e) {
            d = Folder.appPackage.parent.fsName+"/Scripts";
            return d;

  • GetDocumentBase returns null in Update 40

    The change to make getCodeBase() and getDocumentBase() return null has broken our FindinSite-CD signed applet which is out in the field on many data CDs and similar, ie running locally.  It doesn't provide any more security as our all-permissions applet can still access the same information (once it knows where it is).  The trouble is, the CD may be run from anywhere so I do not know the absolute path in advance. I have found that I can add code so that JavaScript is used to pass the current URL as a PARAM to the APPLET.  However this should not be necessary.
    Can you provide a better fix that does not break all our existing users who update to Update 25 or 40?
    I would be happy for our applet to have access restricted to its own directory or lower.
    Or for an all-permissions applet, make getCodeBase() and getDocumentBase() return the correct values.
    Please see the second link below for a further discussion.
    Bug ID: JDK-8019177 getdocument base should behave the same as getcodebase for file applets
    Oracle's Java Security Clusterfuck
    PS  There is a separate Firefox 23 issue stopping access to local Java applets - this should be fixed this week in version 24.
    Chris Cant
    PHD Computer Consultants Ltd
    http://www.phdcc.com/fiscd/

    Our company uses the above FindinSite-CD software to provide search functionality on our data CDs and we have done so successfully for many years.  These latest changes in Update 40 have now broken this vital component on our product and will cost us considerably in technical support time and replacing the discs when a fix comes out. Just an end user's perspective!

  • GetConnectionURL returns null in Bluetooth Application

    Hi,
    I am trying to make my first steps with the JSR-82 API on mobile phones
    (Nokia 6680 and Sony Ericsson W800i). I have written a simple program
    (see code below), which is supposed to discover near-by devices, search
    for a given service (UUID) on a chosen (previously discovered) device
    (=server) and then to connect to the server and send a byte (n) to it. The
    server should then in turn send n+1 back. All this should be done using
    RFCOMM.
    The code works fine in the emulator as well as on two Nokia phones and
    on two SE phones. It further works, when using a Nokia phone as the
    server and a SE phone as the client. However, when using a SE as the
    client and a Nokia as the server, the call to getConnectionURL() returns
    null instead of a valid URL that can be used to set up the connection
    (you can find this piece of code in the ClientThread class). Can somebody
    explain me what I am doing wrong?
    Thanks,
    Michael
    P.S.:At first I thought it might be a compatibility problem, but in the
    BluetoothDemo program that comes with WTK2.2 the correct URL ist
    returned by getConnectionURL() (have other problems with this example
    though, when it comes to download images, in particular...).
    import java.io.IOException;
    import java.util.Vector;
    import javax.bluetooth.BluetoothStateException;
    import javax.bluetooth.DataElement;
    import javax.bluetooth.DeviceClass;
    import javax.bluetooth.DiscoveryAgent;
    import javax.bluetooth.DiscoveryListener;
    import javax.bluetooth.LocalDevice;
    import javax.bluetooth.RemoteDevice;
    import javax.bluetooth.ServiceRecord;
    import javax.bluetooth.UUID;
    import javax.microedition.io.StreamConnectionNotifier;
    import javax.microedition.lcdui.Alert;
    import javax.microedition.lcdui.AlertType;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.List;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    public class MessageTest2 extends MIDlet
          implements CommandListener, DiscoveryListener {
          private final int START = 0;
          private final int SERVER_IDLE = 1;
          private final int CLIENT_START = 2;
          private final int CLIENT_DEVICES_DISCOVERED = 3;
          private final int CLIENT_SERVICES_DISCOVERED = 4;
          private final String MY_UUID = "F0E0D0C0B0A000908070605040302010";
          private final Command EXIT_CMD = new Command("Exit", Command.EXIT, 1);
          private final Command OK_CMD = new Command("Ok", Command.OK, 1);
          private List startList = new List("Select Type", List.IMPLICIT);
          private List deviceList = null;
          private List serviceList = null;
          private Form mainForm = new Form("Message Test 2");
          private int state;
          private ServerThread serverThread = null;
          private LocalDevice local = null;
          private DiscoveryAgent agent = null;
          StreamConnectionNotifier server = null;
          private Vector devicesFound = null;
          private ServiceRecord[] servicesFound = null;
          public MessageTest2() {
                super();
                mainForm.addCommand(EXIT_CMD);
                mainForm.addCommand(OK_CMD);
                mainForm.setCommandListener(this);
                startList.addCommand(EXIT_CMD);
                startList.addCommand(OK_CMD);
                startList.append("Server", null);
                startList.append("Client", null);
                startList.setCommandListener(this);
          protected void startApp() throws MIDletStateChangeException {
                state = START;
                Display.getDisplay(this).setCurrent(startList);
          protected void pauseApp() {
                // TODO Auto-generated method stub
          protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
                // TODO Auto-generated method stub
          public void commandAction(Command c, Displayable d) {
                if (c == EXIT_CMD) {
                      if (server != null) {
                            try {
                                  server.close();
                            } catch (IOException e) {
                      notifyDestroyed();
                if (c == OK_CMD) {
                      if (state == START) {
                            if (startList.getSelectedIndex() == 0) {
                                  startServer();
                            } else {
                                  startClient();
                      } else if (state == CLIENT_START) {
                            doDeviceDiscovery();
                      } else if (state == CLIENT_DEVICES_DISCOVERED) {
                            doServiceDiscovery();
                      } else if (state == CLIENT_SERVICES_DISCOVERED) {
                            communicate();
          public void deviceDiscovered(RemoteDevice dev, DeviceClass devClass) {
                devicesFound.addElement(dev);
          public void servicesDiscovered(int transID, ServiceRecord[] serviceRecs) {
                servicesFound = serviceRecs;
          public void serviceSearchCompleted(int transID, int respCode) {
                switch(respCode) {
                case DiscoveryListener.SERVICE_SEARCH_COMPLETED:
                      showServices();
                      break;
                case DiscoveryListener.SERVICE_SEARCH_DEVICE_NOT_REACHABLE:
                      System.err.println("Device not reachable");
                      break;
                case DiscoveryListener.SERVICE_SEARCH_ERROR:
                      System.err.println("Service search error");
                      break;
                case DiscoveryListener.SERVICE_SEARCH_NO_RECORDS:
                      System.err.println("No records");
                      break;
                case DiscoveryListener.SERVICE_SEARCH_TERMINATED:
                      System.err.println("Service search terminated (cancelled)");
                      break;
          public void inquiryCompleted(int param) {
                switch (param) {
                case DiscoveryListener.INQUIRY_COMPLETED:
                      showDevices();
                      break;
                case DiscoveryListener.INQUIRY_ERROR:
                      System.err.println("Inquiry error");
                      Display.getDisplay(this).setCurrent(mainForm);
                      break;
                case DiscoveryListener.INQUIRY_TERMINATED:
                      System.err.println("Inquiry terminated (cancelled)");
                      Display.getDisplay(this).setCurrent(mainForm);
                      break;
          public void setServer(StreamConnectionNotifier server) {
                this.server = server;
          private void startServer() {
                state = SERVER_IDLE;
                mainForm.deleteAll();
                mainForm.append("Server");
                Display.getDisplay(this).setCurrent(mainForm);
                String connectionURL = "btspp://localhost:" + MY_UUID + ";"
                      + "authenticate=false;encrypt=false;name=RFCOMM Server";
                try {
                      local = LocalDevice.getLocalDevice();
                      local.setDiscoverable(DiscoveryAgent.GIAC);
                } catch (BluetoothStateException e) {
                      System.err.println(e);
                serverThread = new ServerThread(this, connectionURL);
                serverThread.start();
                System.out.println("Server thread started");
          private void startClient() {
                state = CLIENT_START;
                mainForm.deleteAll();
                mainForm.append("Discover?");
                Display.getDisplay(this).setCurrent(mainForm);
          private void doDeviceDiscovery() {
                Form discoveringForm = new Form("discovering");
                try {
                      local = LocalDevice.getLocalDevice();
                } catch (BluetoothStateException e) {
                      System.err.println(e);
                agent = local.getDiscoveryAgent();
                devicesFound = new Vector();
                try {
                      if (!agent.startInquiry(DiscoveryAgent.GIAC, this)) {
                            System.err.println("Inquiry not started...");
                } catch (BluetoothStateException e) {
                      System.err.println(e);
                Display.getDisplay(this).setCurrent(discoveringForm);
          private void doServiceDiscovery() {
                if (devicesFound.size() <= 0) return;
                int[] attributes = {0x100, 0x101, 0x102};
                UUID[] uuids = new UUID[1];
                uuids[0] = new UUID(MY_UUID, false);
                int index = deviceList.getSelectedIndex();
                RemoteDevice rd = (RemoteDevice)devicesFound.elementAt(index);
                try {
                      agent.searchServices(attributes, uuids, rd, this);
                } catch (BluetoothStateException e) {
                      System.err.println(e);
          private void showDevices() {
                state = CLIENT_DEVICES_DISCOVERED;
                deviceList = new List("Discovered Devices", List.IMPLICIT);
                deviceList.addCommand(EXIT_CMD);
                deviceList.addCommand(OK_CMD);
                deviceList.setCommandListener(this);
                for (int i = 0; i < devicesFound.size(); i++) {
                      RemoteDevice rd = (RemoteDevice)devicesFound.elementAt(i);
                      String str = rd.getBluetoothAddress();
                      try {
                            str = str + " " + rd.getFriendlyName(false);
                      } catch (IOException e) {
                      deviceList.append(str, null);
                Display.getDisplay(this).setCurrent(deviceList);
          private void showServices() {
                state = CLIENT_SERVICES_DISCOVERED;
                if (servicesFound.length <= 0) {
                      mainForm.deleteAll();
                      mainForm.append("no services found");
                      mainForm.append("discover devices?");
                      state = CLIENT_START;
                      Display.getDisplay(this).setCurrent(mainForm);
                      return;
                serviceList = new List("Services Found", List.IMPLICIT);
                serviceList.addCommand(EXIT_CMD);
                serviceList.addCommand(OK_CMD);
                serviceList.setCommandListener(this);
                for (int i = 0; i < servicesFound.length; i++) {
                      String str;
                      ServiceRecord sr = (ServiceRecord)servicesFound;
    DataElement de = sr.getAttributeValue(0x100);
    str = (String)de.getValue();
    serviceList.append(str, null);
    Display.getDisplay(this).setCurrent(serviceList);
    private void communicate() {
    int index = serviceList.getSelectedIndex();
    ServiceRecord sr = (ServiceRecord)servicesFound[index];
    ClientThread clientThread = new ClientThread(this, sr);
    clientThread.start();
    public void showResult(int n) {
    Form resultForm = new Form("End");
    resultForm.addCommand(EXIT_CMD);
    resultForm.setCommandListener(this);
    resultForm.append("Received: " + n);
    Display.getDisplay(this).setCurrent(resultForm);
    public void showMessage(String msg) {
    Displayable d = Display.getDisplay(this).getCurrent();
    Alert al = new Alert("Info", msg, null, AlertType.INFO);
    al.setTimeout(Alert.FOREVER);
    Display.getDisplay(this).setCurrent(al, d);
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    import javax.microedition.io.StreamConnectionNotifier;
    public class ServerThread extends Thread {
          private MessageTest2 parent;
          private StreamConnectionNotifier server;
          private String connectionURL = null;
          public ServerThread(MessageTest2 parent, String connectionURL) {
                this.parent = parent;
                this.connectionURL = connectionURL;
          public void run() {
                StreamConnection conn = null;
                try {
                      server = (StreamConnectionNotifier) Connector.open(connectionURL);
                } catch (IOException e) {
                      System.err.println(e);
                parent.setServer(server);
                try {
                      conn = server.acceptAndOpen();
                } catch (IOException e) {
                      System.err.println(e);
                InputStream in = null;
                int n = -1;
                try {
                      in = conn.openInputStream();
                      n = in.read();
                } catch (IOException e) {
                      System.err.println(e);
                if (in != null) {
                      try {
                            in.close();
                      } catch (IOException e) {
                            System.err.println(e);
                try {
                      OutputStream out;
                      out = conn.openOutputStream();
                      out.write(n + 1);
                      out.flush();
                } catch (IOException e) {
                      System.err.println(e);
                try {
                      conn.close();
                } catch (IOException e) {
                      System.out.println(e);
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import javax.bluetooth.ServiceRecord;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    public class ClientThread extends Thread {
          private MessageTest2 parent;
          private ServiceRecord sr;
          public ClientThread(MessageTest2 parent, ServiceRecord sr) {
                this.parent = parent;
                this.sr = sr;
          public void run() {
            StreamConnection conn = null;
            String url = null;
            int n = 0;
            try {
                url = sr.getConnectionURL(
                        ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
                if (url == null) {
                      parent.showMessage("URL null");
                      return;
                conn = (StreamConnection) Connector.open(url);
            } catch (IOException e) {
                System.err.println("Note: can't connect to: " + url);
            try {
                OutputStream out = conn.openOutputStream();
                out.write(n);
                out.flush();
                out.close();
                InputStream in = conn.openInputStream();
                n = in.read();
            } catch (IOException e) {
                System.err.println("Can't write to server for: " + url);
            try {
                  conn.close();
            } catch (IOException ee) {
                  System.err.println(ee);
            parent.showResult(n);

    Hi:
    How did you compile and build the package using WSDL2JAVA. I tried under UCM 6.1 environment but receiving error message on 2 of the classes that, too large object.
    axisbuild:
    compiling 1007 source files
    /generatedaxisclient/com/cisco/www/AXLAPLService/AXLAPIBindingStub.java:4026:code too large
    public AXLAPIBindingStub(javax.xml.rpc.Service service)throws org.apache.axis.AxisFault {
    Error
    /generatedaxisclient/com/cisco/www/AXLAPLService/AXLAPIBindingStub.java:18:code too large
    public AXLAPIBindingStub(javax.xml.rpc.Service service)throws org.apache.axis.AxisFault {
    static {
    Error
    2 Errors
    Please let me know if you have any thoughts on this.
    Thank You
    Ramesh Vasudevan

  • Code returning NULL

    T1 (Table and columns & data ) used in my example
    create table T1 (col1 number,col2 number);
    col1 col2
    1 5
    2 5
    3 5
    4 5
    11 6
    12 6
    13 6
    14 6
    CREATE OR REPLACE FUNCTION TEST (par NUMBER) RETURN VARCHAR2 IS
    l_concat VARCHAR2(32767) ;
    BEGIN
    select wm_concat(col1) into l_concat from t1 where col2=par;
    RETURN l_concat;
    END;
    select TEST(5) from dual;
    The above example always returns a NULL as opposed to (1,2,3,4);
    CREATE OR REPLACE FUNCTION TEST (par NUMBER) RETURN VARCHAR2 IS
    l_concat VARCHAR2(32767) ;
    l_str varchar2(32767);
    BEGIN
    l_str:='select wm_concat(col1) from t1 where col2=:b';
    execute immediate l_str into l_concat using par;
    RETURN l_concat;
    END;
    select TEST(5) from dual;
    This returns the correct answer .i.e. (1,2,3,4);
    My question is why my first code returning NULL? Is there any restriction using aggregate functions inside
    plsql code ?

    BluShadow wrote:
    The in paramter has the same name as one of the column . Thus the select query was not taking the filtering predicate as the in parameter col1 ,rather it was
    using the column's value for filtering each row and hence the wm_concat was not getting any row to concatenate .That's why you should use a good coding standard and perhaps prefix parameters with "p" or "p_" and local variables with "v" or "v_" etc.Smacks too much of archaic Hungarian notation. :-)
    Explicit scope definition is supported by PL/SQL. So why invent a new manual standard for scope, when there exists one already?
    SQL> create or replace procedure FooProc( empNo emp.empno%Type ) is
      2          empRow  emp%RowType;
      3  begin
      4          select
      5                  e.* into empRow
      6          from    emp e
      7          where   e.empno = FooProc.empNo;
      8 
      9          dbms_output.put_line(
    10                  'Employee '||empNo||' is '||empRow.ename||
    11                  ', and employed as '||empRow.job
    12          );
    13  end;
    14  /
    Procedure created.
    SQL>
    SQL>
    SQL> exec FooProc(7369)
    Employee 7369 is SMITH, and employed as CLERK
    PL/SQL procedure successfully completed.
    SQL> Personally, I find the v_ and p_ prefix approach quite silly - attempting to address an issue that is already solved by explicit PL/SQL scope.
    Never mind that the approach of using different prefixes, attempts to identify scope - and goes down the exact same slippery scope that Hungarian notation did. Which resulted in the death of this misguided standard, many years ago.
    Frustrates me to no end to see the exact SAME mistakes made in PL/SQL that were made a decade or more ago - where lessons learned since then are conveniently ignored when it comes to PL/SQL programming.
    It is still seems to be the Dark Ages when it comes to PL/SQL development.... :-(

  • Request.getParameter("_ROWKEY") returns null in JDev 3.2

    My SubmitEditForm.jsp uses a bean which inherits from the EditCurrentRecord data web bean. In JDeveloper 3.1 'request.getParameter("ROWKEY")' in this JSP returns the rowkey for the record being edited, but in JDeveloper 3.2 'request.getParameter("_ROWKEY")' returns null. No modifications have bean made to the application - the working JDeveloper 3.1 app has only been compiled in JDeveloper 3.2. Can anyone help please?

    Hi,
    This exception is raised when the multipart/form-data parser has read the number of bytes specified by the Content-Length HTTP header, or tries to read past the end of the input stream, but has not parsed to the end of the message. As implied by the error text, this can happen for a couple of reasons.
    Although its unlikely, it is possible for a client to sent an incorrect Content-Length header. However, we've so far only seen this with a user-written HTTP client. We have yet to see a browser send the wrong value.
    The usual reason for this error is if a user hits the stop button while submitting a form. If the browser has already sent the HTTP header, including Content-Type, then the parser will try to read the entire message. However, this is going to fail, as the browser stops sending the request as soon as the stop button is pressed.
    Finally, there is one more possible reason for this error, and that is if the request is somehow being 'munged' in some way between the browser and the servlet container.
    To help us better understand what is happening here, can you supply
    the following information:
    - Does this problem happen consistently or occur only randomly?
    - When it does happen, is it repeatable, or does it go away if the user hits the submit button again?
    - Does it happen with certain HTML forms, any HTML form, or is it specific to the data entered into a pariticular form?
    - Does it happen with any browser, or a specific version and/or implementation?
    - What is your network configuration? For example, does the problem occur only when going through a proxy server or fire wall.
    - Does it depend on network load? For example, does it happen only at heavy load times?
    - What is you web server configuration, on what platform are you running it, and what JDK version are you using?
    As I'm writing this, the TAR system is down for upgrades - my apologies if you've already supplied this information.
    Regards,
    Simon
    null

  • User Exists but APEX_UTL.GET_USER_ID returns null

    Hi,
    I am fairly new to APEX especially the API, I have created a user via the workspace admin pages (application is using standard apex authentication scheme). I want a page to open with data shown restricted by an attribute that has been set for the user. The page computation code is simply:
    begin
    return apex_util.get_attribute(p_username => 'JONES', p_attribute_number => 2);
    end;
    (hard coding added for debug, does not work with :APP_USER):
    However this is always returning null.
    If I do this in SQL Developer:
    apex_util.get_user_id('JONES');
    I get null
    If I do this :
    select *
    from APEX_WORKSPACE_APEX_USERS
    where user_name = 'JONES'
    I get data.
    What am I doing wrong?? The JONES user was created via the APEX system not SQL.
    Thanks in advance
    Chris

    Chris,
    the point is that you can't get values from some APEX functions running it from SQL Developer or some other tool, you can only see it in runtime of your APEX application (because of APEX session).
    Here's example:
    [http://apex.oracle.com/pls/apex/f?p=43478:3]
    User: user
    Password: xxx
    apex_util.set_attribute is not a function and you can't run it from SQL, only PL/SQL...
    On the other hand, you can see values from SQL developer (without APEX session) through APEX views...
    Br,
    Marko

  • CreateWordHiLite returns null on Arabic pdf document

    Greatly appreciated if someone in this forum can help to resolve the issue that I am facing. I am using Visual C# to do some stuff with a pdf document where I want to create a list of all words in a page. I am using InterOp Services to access the api exposed the the acrobat.tlb library. Here is the code snippet I am using:
                CAcroPDPage page = (CAcroPDPage)document.AcquirePage(pageNumber);
                CAcroHiliteList hitelite = new Acrobat.AcroHiliteListClass();
                hitelite.Add(0, 32767);     // create a hilite that includes all possible text on the page
                CAcroPDTextSelect selectedText = (Acrobat.CAcroPDTextSelect)page.CreateWordHilite(hitelite);
    On the last line the CreateWordHilite is returning null, meaning the method failed on an Arabic pdf file. If I run the same code on an English document, the code works fine.
    Regards.

    Hi there,
    Thanks for the response. I narrowed down the problem further. In fact a few of the pages are giving trouble. Now I'm concentrating on the pages that are giving me the word collection but I'm facing a separate issue.
    The CAcroPDTextSelect object is now having values but when I am using the GetText(iNum) method and examining the content of a particular word, it does not show the Arabic word. For example one of the word looks like this: "çáçñý: " . Do I have to use a different sdk for non-latin character sets?
    Regards.

  • How to use getRelativePath() with browseForOpen()? It returns null

    It's quite simple:
    fTargetFile:File = File.applicationDirectory.resolvePath("assets");
    fRootFile:File = File.applicationDirectory.resolvePath("assets");
    fTargetFile.addEventListener(Event.SELECT,onSelect)
    fTargetFile.browseForOpen("test"); <-- here I open a file in "/assets/images/test.jpg"
    function onSelect(e:Event):void
        trace(fRootFile.getRelativePath(fTargetFile));  <-- this returns null
    Every single "tutorial" in the web - along with Adobe's documentation - gracefully uses resolvePath to explicitly point to the file objects, thereby bypassing the actual use case. getRelativePath indeed works with resolvePath, but using resolvePath means I've already known where the file is located in the first place, rendering getRelativePath actually useless
    tracing the nativePath property of both objects returns the correct path.
    What I'm trying to do is letting the user choose a file within the "assets" directory. The file can be from any folder so long as they're under the "assets", and once user chooses a file, display the relative path from "assets" to the chosen file.
    So, in the example above, I expect "images/test.jpg" to be returned, but it returns nothing
    Do I have to do some wizardry before getRelativePath works?

    This post is rather old, so I may not be able to help the original author of this topic, but as I found this thread, when searching for a solution for this problem myself, I might be able to help someone else.
    I found the following solution:
    function onSelect(e:Event):void
      var f1:File = (new File()).resolvePath(e.currentTarget.nativePath);
      var f2:File = (new File()).resolvePath(File.applicationDirectory.nativePath);
      trace(f2.getRelativePath(f1, true));

  • Java 7 u45 System.getProperty returns null

    After upgrade to u45, our web launch application stopped working. it failed at System.getProperty("myproperty").
    "myproperty" is defined as a
    <resources>       
    <j2se version="1.6+" initial-heap-size="64m" max-heap-size="256m"/>
           <jar href="nms_wsclient.jar" download="eager" main="true"/>
           <jar href="commons-httpclient.jar" download="eager"/>      
          <jar href="commons-codec.jar" download="eager"/>       
          <jar href="commons-logging.jar" download="eager"/>       
          <jar href="log4j.jar" download="eager"/>       
          <property name="myproperty"   value="http://138.120.128.94:8085/"/>
        </resources>
    with older version java ,System.getProperty("myproperty") works fine to return the value, but with u45 it returned null.
    Does anyone have the same problem? any idea how to fix it or work around it?
    Thanks,
    Zhongyao

    So did you succeed with the jnlp template ?
    After frustrating hours of that information useless JNLPSigningException trial & error, It seems that as :
    1. You can't make the j2se version variable
    2. You can't have your own variable property/values
    I've opened a bug report...
    The documentation is atrocious, with a vague "we reserve the right to blacklist variable elements, but we will never say which ones".
    The JNLP example in the various example is a joke - Its a hello world jnlp, not a real world one.
    The JNLPSigningException must have been written my the same guys at Microsoft that did the "An Unknown Error As Occurred".
    I've had to clear the cache at every test, seems that the JNLP Template check didn't get the new updated JNLP from the web server.
    /rant over
    I think I'll try to bypass that JNLP property mess and get javaws to download my own "jnlp name".xml.config...

  • Getnode returned null for uri error for caldav server

    Hello,
    I am trying to install the Oracle UCS ( SUN 7 update 2 ) server.
    https://wikis.oracle.com/display/CommSuite7U2/Communications+Suite+on+a+Single+Host+%28Linux%29#CommunicationsSuiteonaSingleHost%28Linux%29-InstallingtheExample
    So far, I have successfully:
    Checked the installation requirements
    Installed Communications Suite 7 Update 2 Software
    Installed and Configured the Directory Server
    Prepared the Directory under ( Configuring Communications Suite Components )
    Configured Delegated Administrator and Communications CLI
    Configured Messaging Server
    Configured MYSQL Server
    Configured Calendar Server
    I have just installed a caldav server. I checked that it was enabled by running:
    # asadmin list-components -p <admin-port> --type=web
    davserver <web-module>
    Command list-components executed successfully.
    # asadmin show-component-status -p <admin-port> davserver
    Status of davserver is enabled.
    Command show-component-status executed successfully.
    that was from this page:
    https://wikis.oracle.com/display/CommSuite7RR92909/Calendar+Server+7+Troubleshooting
    In Firefox, I try to hit the suggested pages under "Testing Calendar accounts". However, this errors out every time for me.
    http://domain.com/davserver/dav/h/myDomain.com/myusername/calendar
    wheremyDdomain.com is my actual domain that I will not list here
    and myUsername is my actual username which I will not list here
    ( I edited both of these in the logs below )
    I checked my log in /var/opt/sun/comms/davserver/logs:
    INFO [2012-02-11T11:46:02.729-0500] <...DavServer.<init>> Server Startup succeeded
    INFO [2012-02-11T11:46:02.730-0500] <...DavServer.loadBackend> Loading backend defaultbackend with backendid defaultbackend
    INFO [2012-02-11T11:46:02.730-0500] <...DavServer.loadBackend>      JDBC JNDI Name = jdbc/defaultbackend
    INFO [2012-02-11T11:46:09.033-0500] <...DavServer.loadBackend> Loading backend ischedulebackend with backendid ischedulebackend
    INFO [2012-02-11T11:46:09.033-0500] <...DavServer.loadBackend>      JDBC JNDI Name = jdbc/ischedulebackend
    INFO [2012-02-11T11:46:09.427-0500] <...DavServer.loadBackends> iSchedule enabled
    INFO [2012-02-11T11:46:09.439-0500] <...DavServer.loadBackends> modified ischedule collection at /ischedule/
    INFO [2012-02-11T13:33:18.967-0500] <...URIInfoManagerImpl.getEntryFromSearchFilter> found 0 corresponding to: (uid=caldav)
    INFO [2012-02-11T13:33:59.844-0500] <...URIInfoManagerImpl.getEntryFromSearchFilter> found 0 corresponding to: (uid=caldav)
    FINE [2012-02-11T13:42:39.157-0500] <...DavServerServlet.service> [REQ] GET /davserver/browse/h/myDomainName/myUserName/calendar 127.0.0.1 myDomainName
    FINE [2012-02-11T13:42:39.808-0500] <...LDAPSingleHostPool.getConnection> got connection from getConnection() for pool Pool number:0. Host=myDomainName
    FINE [2012-02-11T13:42:41.441-0500] <...LDAPSingleHostPool.getConnection> got connection from getConnection() for pool Pool number:0. Host=myDomainName
    FINE [2012-02-11T13:42:41.460-0500] <...LoginModuleHelper.checkIfUserInAdminGroup> user: admin; isMemberOf = cn=Service Administrators, ou=Groups, o=isp
    FINE [2012-02-11T13:42:41.684-0500] <...DavBrowserServlet.service> Got a non standard condition: getNode returned null for uri /davserver/browse/h/myDomainName/myUserName/calendar
    FINE [2012-02-11T13:42:41.684-0500] <...DavServerServlet.service> [RES] [404] Command execution time: 2.527 secs
    I can hit this page from the browser:
    http://myDomainName:4848
    From my understanding, that is the admin port. That brings up the GlassFish server admin page.
    I do not remember creating a calendar account anywhere is my first thought. I followed the example deployment step by step so far and nowhere does it have me create a calendar user account. So, maybe there is no account at this point?
    So, my first question would be:
    How can I verify that I have a calendar account to begin with? ( or is this what I am doing by trying to log into the sites suggested under 'Test Calendar Accounts').
    My next question would be:
    What does this error mean: "getnode returned null for uri error for caldav server"?
    Spin off question from that:
    What should I do to fix that error?
    Thanks in advance!

    I did not put a slash at the end of the uris I was testing
    http://myDomain.com:80/davserver/browse/h/myDomain/myUserName/calendar
    http://myDomain.com:80/davserver/dav/h/myDomain/myUserName/calendar
    Once I put the slash at the end of the uri, the configuration page appeared and the error was not displayed about getNode anymore:
    http://myDomain.com:80/davserver/browse/h/myDomain/myUserName/calendar/
    http://myDomain.com:80/davserver/dav/h/myDomain/myUserName/calendar/

  • ImageIcon.getImage() returning null

    Hi,
    I have a class, say ABC, which extends ImageIcon....when I do .getImage() ...its returning null...any idea why? I know the ABC icon exists, b/c i can add it to a JLabel and see it...but when I do getImage its null...
    thanks

    Take a look at what I did in the last few lines...
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    public class CompoundIcon implements Icon {
        private Icon left, right;
        private int gap;
        public CompoundIcon(Icon left, Icon right, int gap) {
            if (left == null || right == null)
                throw new NullPointerException();
            this.left = left;
            this.right = right;
            this.gap = gap;
        public int getIconHeight() {
            return Math.max(left.getIconHeight(), right.getIconHeight());
        public int getIconWidth() {
            return left.getIconWidth()+ gap + right.getIconWidth();
        public Icon getLeft() {
            return left;
        public Icon getRight() {
            return right;
        public void paintIcon(Component c, Graphics g, int x, int y) {
            int h = getIconHeight();
            left.paintIcon(c, g, x, y+ (h-left.getIconHeight())/2);
            right.paintIcon(c, g, x+left.getIconWidth()+gap, y+ (h-right.getIconHeight())/2);
        public static void main(String[] args) throws MalformedURLException {
            JPanel p = new JPanel(new GridLayout(0,1));
            URL url1 = new URL("http://forum.java.sun.com/images/toolbox_settings.gif");
            URL url2 = new URL("http://forum.java.sun.com/images/toolbox_watches.gif");
            URL url3 = new URL("http://forum.java.sun.com/images/toolbox_dukedollars.gif");
            Icon radioIcon = UIManager.getIcon("RadioButton.icon");
            ButtonGroup bg = new ButtonGroup();
            add(url1, p, bg, radioIcon);
            add(url2, p, bg, radioIcon);
            add(url3, p, bg, radioIcon);
            JFrame f = new JFrame("Example");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(p);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
        static void add(URL url, JPanel p, ButtonGroup bg, Icon radioIcon) {
            CompoundIcon icon = new CompoundIcon(radioIcon, new ImageIcon(url), 3);
            ImageIcon right = (ImageIcon) icon.getRight();
            System.out.println("right width = " + right.getImage().getWidth(null));
            JRadioButton btn = new JRadioButton(icon);
            p.add(btn);
            bg.add(btn);
    }

  • Target Unreachable, 'firstField' returned null

    Hi everybody!
    Before I begin, I'm sorry but my english is bad.
    I'm using JDeveloper 11.1.1.3 to develop an application.
    My application is linked with database.
    I created a Train with 2 pages: In the first, you can fill out the form. And in the second, we see the data filled
    in the first, and there you can click a button to submit the form.
    Then I create a method in my class "TestServiceImpl.java" which is the method of application module. This method
    add a new row in a table in the database.
    And finally, I'd drag and drop this method in my "confirmationPage". The value of each field of this method is that
    of the corresponding fields the first page where the form was completed (example: # {} backingBeanScope.backing_firstPage.firstField.value).
    I have hidden filds so they are not visible to the user, and I left the button in this method visible (to create item).
    When I run the application, I fill the fields in the form, I click Next, I preview my form;
    BUT when I click on the button (which is the method that I have hidden filelds), I have the following error:
    Target Unreachable, 'firstField' returned null
    Any help is welcome.
    Thank's

    Yes, but it still seems that the value is null when the method attempts to retrieve it.
    Unless there is some other problem in your page or the bindings.
    If you were to try using pageFlowScope parameters, all that you would have to do would be to set the component values in the virst page equal to the pageFlowScope parameter it corresponds to
    something like this:
    <af:inputText id="var1"/>
    value="#{pageFlowScope.variable1}"
    />then you could get the values in the second page using #{pageFlowScope.variable1}.
    Gabriel.

Maybe you are looking for

  • New late November 2013 MBP retina goes blank

    My new MBP 15 retina - late 2013 goes blank screen for no reason. Comes back on when lifting the unit up or just tilting the laptop - then the screen comes back on. I have to re-enter the password and it works fine.This does not happen a lot. Had the

  • Related to TAXINN

    Dear All, While doing the setting for tax code in FV11, I have created two Tax codes               L0- JMOP 0%(BED),JMOC 0% and JMOS 0%               I1-JMOP 16%(BED),JMOC 2% and JMOS 1% in condition record for same vendor,plant and material combinat

  • SQL Server 2000 Driver for JDBC SP3 and J2SE 5.0?

    Hi. On http://www.microsoft.com/downloads/details.aspx?FamilyID=07287b11-0502-461a-b138-2aa54bfdc03a&DisplayLang=en it says JDK versions up to 1.4 are supported (I guess that probably means NO), but I'm wondering if anyone knows if it's possible to u

  • Loosing internet connection after Mountain Lion update

    Hi, I'm working with a MBP 2012 model. After the update to Mountain Lion, the MBP is loosing the internet connection now and then. I've did a PRAM reset, but the issue is still present. Are there any tips oder way to solve the issue? Thank so far

  • Compensation Model for Benefits

    Hi All, I am new to benefits. I would like to know, some information about compensation model in benefits. We have 401k salary,hourly,catchup,Deferredcompensation Bonus and Salary Plans in infotype 169. I am  using /102 wagetype as Technical base. Ca