Java FX, TextField, Keyboard handling

I need to look for specific characters that may be typed in a text field and perform an action accordingly. For example if the user hits F1 key while inside a textfield, i need to popup a different panel. I am using FXML to do the form layout. Please help mw with some example code. If I can set these functions at a global level (Scene) it would be even better way, for example no matter which ever text field use is on, I need to handle F1 key the same way.
Thank you

What am I doing wrong?F1 key presses don't generate KeyTyped events, you need to handle KeyPressed events to receive the function key presses, so perhaps use onKeyPressed="#handleKeyInput" in your FXML instead.
I haven't used FXML, so perhaps there are other issues in the way you have defined the interaction between the FXML and the controller code, but I don't really know.
The code below will globally catch any F1 key presses for any TextFields in the scene, so maybe you could just install the keyfilter when you setup your scene rather than placing a reference to an onKeyPressed handler for each TextField in your FXML.
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TextFieldTrapper extends Application {
  public static void main(String[] args) { Application.launch(args); }
  @Override public void start(Stage primaryStage) {
    // create some controls.
    final Label eventText = new Label("Press F1 in any text field to capture a KeyEvent");
    TextField text1 = new TextField("Some Text"); text1.setId("text1");
    TextField text2 = new TextField("More Text"); text2.setId("text2");
    // layout the scene.
    final VBox root = new VBox(5);
    root.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
    root.getChildren().addAll(text1, text2, eventText);
    primaryStage.setScene(new Scene(root, 1000, 100));
    // monitor and respond to any F1 key presses sent to any text field in the scene.
    root.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
      @Override public void handle(KeyEvent event) {
        if (KeyCode.F1.equals(event.getCode()) && event.getTarget() instanceof TextField) {
          eventText.setText(event.toString());
    primaryStage.show();
}

Similar Messages

  • Help plz keyboard handler!!!!!!!!!!!!!!!!!

    till now i have this code but i need a keyboard handler. When i press r or o or g on the keyboard the stoplight needs to change color how can i do this???
    package knipperlicht;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    public class Knipperlicht extends Applet {
    private Stoplicht stoplicht;
    private Paneel paneel;
    public void init() {
    setLayout( new BorderLayout() );
    stoplicht = new Stoplicht();
    add( stoplicht, BorderLayout.CENTER );
    paneel = new Paneel( stoplicht );
    add( paneel, BorderLayout.SOUTH );
    class Stoplicht extends Canvas {
    private boolean rood = false,
    oranje = false,
    groen = false;
    public void reset() {
    rood = false;
    oranje = false;
    groen = false;
    public void setRood() {
    reset();
    rood = true;
    public void setOranje() {
    reset();
    oranje = true;
    public void setGroen() {
    reset();
    groen = true;
    public void paint( Graphics g ) {
    g.setColor( Color.gray );
    int midden = getBounds().width / 2;
    g.fillRect(midden - 30, 50, 60 ,160); /stoplicht
    g.fillRect(midden - 30, 50, 60 ,160); /paal
    if (rood){
    g.setColor(Color.red);
    g.fillOval(midden -20, 60, 40, 40);
    else if (oranje){
    g.setColor(Color.orange);
    g.fillOval(midden -20, 110, 40, 40);
    else if (groen){
    g.setColor(Color.green);
    g.fillOval(midden -20, 160, 40, 40);
    the one with the correct awnser gets al the dukes

    try this
    //<APPLET CODE="Knipperlicht.class" WIDTH="200" HEIGHT="200"></APPLET>
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    public class Knipperlicht extends Applet
         private Stoplicht stoplicht;
         private Panel paneel;
         public void init()
              setLayout(new BorderLayout());
              stoplicht = new Stoplicht();
              add( stoplicht, BorderLayout.CENTER );
              //paneel = new Panel();
              //paneel.add(stoplicht);
              //add(paneel,BorderLayout.SOUTH);
    class Stoplicht extends Canvas implements KeyListener
         private boolean rood = false,
         oranje = false,
         groen = false;
         Stoplicht()
              addKeyListener(this);
         public void reset()
              rood = false;
              oranje = false;
              groen = false;
         public void setRood()
              reset();
              rood = true;
              repaint();
         public void setOranje()
              reset();
              oranje = true;
              repaint();
         public void setGroen()
              reset();
              groen = true;
              repaint();
         public void paint( Graphics g )
              g.setColor( Color.gray );
              int midden = getBounds().width / 2;
              g.fillRect(midden - 30, 50, 60 ,160); //stoplicht
              g.fillRect(midden - 30, 50, 60 ,160); //paal
              if (rood)
                   g.setColor(Color.red);
                   g.fillOval(midden -20, 60, 40, 40);
              else if (oranje)
                   g.setColor(Color.orange);
                   g.fillOval(midden -20, 110, 40, 40);
              else if (groen)
                   g.setColor(Color.green);
                   g.fillOval(midden -20, 160, 40, 40);
         }//paint
         public void keyPressed(KeyEvent ke)
              if (ke.getKeyChar() == 'r' || ke.getKeyChar() == 'R' )
                   setRood();
                   System.out.println("Success Red");
              if (ke.getKeyChar() == 'o' || ke.getKeyChar() == 'O' )
                   setOranje();
                   System.out.println("Success Orange");
              if (ke.getKeyChar() == 'g' || ke.getKeyChar() == 'G' )
                   setGroen();
                   System.out.println("Success Green");
         }//pressed
         public void keyTyped(KeyEvent ke)
         public void keyReleased(KeyEvent ke)

  • Java.sql.SQLException: statement handle not executed

    hello,
    i am calling a stored procedure and its returns a REF CURSOR and i am getting intermittent exceptions below,
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxxx_pkg(?,?)}]; SQL state [99999]; error code [17144]; statement handle not executed; nested exception is java.sql.SQLException: statement handle not executed
    and
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxxx_pkg(?,?,?)}]; SQL state [99999]; error code [17009]; Closed Statement; nested exception is java.sql.SQLException: Closed Statement
    any clue what could be the issue,
    Regards
    GG

    its pretty simple have a java class calling hibernateTemplate's findByNamedQueryAndNamedParam method by passing the procedure name and binding parameters/values, and here is the stack
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxx_pkg(?,?)}]; SQL state [99999]; error code [17144]; statement handle not executed; nested exception is java.sql.SQLException: statement handle not executed
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
    at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
    at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1006)
    Caused by: java.sql.SQLException: statement handle not executed
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
    at oracle.jdbc.driver.T4CStatement.doDescribe(T4CStatement.java:701)
    at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3355)
    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:2009)
    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494)
    at org.hibernate.type.StringType.get(StringType.java:18)
    at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
    at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
    at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
    at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2091)
    at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
    at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
    at org.hibernate.loader.Loader.getRow(Loader.java:1206)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
    at org.hibernate.loader.Loader.doQuery(Loader.java:701)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
    at org.hibernate.loader.Loader.doList(Loader.java:2217)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2108)
    at org.hibernate.loader.Loader.list(Loader.java:2103)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1696)
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
    at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1015)
    at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)

  • Text  rendering in Java swing textfield is incorrect but works fine in awt

    Hi
    I am having a specific problem regarding
    Malayalam Language (An indian language) rendering in Java swing textfield rendering is incorrect for some specific malayalam chars
    റ്റ ട്ട
    But for awt text filed every thing looks fine
    Any clue regarding this issue
    Pl help
    John India

    Thank you
    I too think in the same way , but I am trying with very popular malayalam fonts and
    Windows 7 is works fine with default malayalam font karthika in apps like note pad ,word , iexplorerer
    I tried a set of other fonts also some problem or other is with swt but
    awt it works very nice
    Is there any tool available to check all glyphs are , available or not ,
    regards
    john
    Edited by: user3656685 on Jul 20, 2012 9:53 AM

  • Java.io.StreamCorruptedException: illegal handle value

    Hi
    I am using Oracle Coherence 3.3 in my application. I my application we are taking the objects from Webservices and storing them in the Cache(Replicated). And then retrieve them from the Cache.
    But now on our application Linux server we are getting "java.io.StreamCorruptedException: illegal handle value"
    Can anybody tell the reason of this. I am not sure whether it is a Coherence issue.
    The log of error which i am getting is this. Please do reply. Its really urgent.
    [6/7/08 11:23:36:287 EDT] 00004442 SystemErr R (Wrapped: CacheName=UMAChannelZipCache, Key=44120) java.io.StreamCorruptedException: illegal handle value
         at java.io.ObjectInputStream.readHandle(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
         at java.util.HashMap.readObject(HashMap.java(Compiled Code))
         at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
         at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java(Compiled Code))
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Compiled Code))
         at java.util.TreeMap.buildFromSorted(TreeMap.java(Inlined Compiled Code))
         at java.util.TreeMap.readTreeSet(TreeMap.java(Inlined Compiled Code))
         at java.util.TreeSet.readObject(TreeSet.java(Compiled Code))
         at sun.reflect.GeneratedMethodAccessor167.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
         at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java(Compiled Code))
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
         at java.util.HashMap.readObject(HashMap.java(Compiled Code))
         at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
         at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java(Compiled Code))
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java(Compiled Code))
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
         at com.tangosol.util.ExternalizableHelper.readSerializable(ExternalizableHelper.java(Inlined Compiled Code))
         at com.tangosol.util.ExternalizableHelper.readObject(ExternalizableHelper.java(Compiled Code))
         at com.tangosol.coherence.component.net.Message.readObject(Message.CDB(Inlined Compiled Code))
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.ReplicatedCache$ConverterFromInternal.convert(ReplicatedCache.CDB(Compiled Code))
         at com.tangosol.coherence.component.util.CacheHandler.getCachedResource(CacheHandler.CDB(Compiled Code))
         at com.tangosol.coherence.component.util.CacheHandler.get(CacheHandler.CDB(Compiled Code))
         at com.tangosol.coherence.component.util.SafeNamedCache.get(SafeNamedCache.CDB(Compiled Code))
         at com.att.uma.cache.ChannelCacheManager.checkCacheByZip(ChannelCacheManager.java(Compiled Code))
         at com.att.uma.channel.UMAChannelServices.getChannelsByZip(UMAChannelServices.java(Compiled Code))
         at com.att.uma.channel.RetrieveChannelLineup.performTask(RetrieveChannelLineup.java(Compiled Code))
         at com.att.uma.channel.RetrieveChannelLineup.doPost(RetrieveChannelLineup.java(Compiled Code))
         at com.att.uma.channel.RetrieveChannelLineup.doGet(RetrieveChannelLineup.java(Compiled Code))
         at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
         at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java(Compiled Code))
         at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java(Compiled Code))
         at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java(Compiled Code))
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java(Compiled Code))
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java(Compiled Code))
         at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

    Hi user628020,
    Since you are using standard Java serialization, the only two reasons I can think of are:
    1) a bug in serialization routines for any of the classes your objects use (e.g. TreeMap)
    2) concurrent modification of the same object by another thread at the same time
    With urgent support questions I would suggest using the Oracle Metalink.
    Regards,
    Gene

  • Using a Velocity Template in Java User Exit Custom Handler

    I would have thought it would be possible to use a Velocity template in combination with a custom handler in a Java user exit, but I can't seem to figure out how  to do it, and I'm not finding an example of doing this anywhere in the GoldenGate docs.
    For example, I can create a Velocity template and use it to output transactions in the desired format to a file by using a propeties file that looks something like this:
    gg.handlerlist=myhandler
    gg.handler.myhandler.mode=tx
    gg.handler.myhandler.format=./dirprm/my_template.vm
    gg.handler.myhandler.type=file
    gg.handler.myhandler.file=my_output.txt
    What I'm hoping to do is to have a custom handler, and some how  be able to get to the Velocity formatted transaction data in the "transactionCommit(DsEvent, DsTransaction)" method of my custom extension of AbstractHandler by having a properties file that looks like this (same as the above, except for the type, and no file property ... eg:
    gg.handlerlist=myhandler
    gg.handler.myhandler.mode=tx
    gg.handler.myhandler.format=./dirprm/my_template.vm
    gg.handler.myhandler.type=my.custom.GGHandler
    I've verified that I have a valid DsEvent and a DsTransaction with the desired information in by custom handler's transactionCommit method ... and I can even pull out the required data and re-format it there to the desired format so that it looks just like the format that my Velocity template outputs when I'm outputting to a file (as shown in the first properties file).  But shouldn't I somehow  be able to access the Velocity transformation for my DsTransaction in my custom handler?
    Thanks for any assistance / info provided.

    I would have thought it would be possible to use a Velocity template in combination with a custom handler in a Java user exit, but I can't seem to figure out how  to do it, and I'm not finding an example of doing this anywhere in the GoldenGate docs.
    For example, I can create a Velocity template and use it to output transactions in the desired format to a file by using a propeties file that looks something like this:
    gg.handlerlist=myhandler
    gg.handler.myhandler.mode=tx
    gg.handler.myhandler.format=./dirprm/my_template.vm
    gg.handler.myhandler.type=file
    gg.handler.myhandler.file=my_output.txt
    What I'm hoping to do is to have a custom handler, and some how  be able to get to the Velocity formatted transaction data in the "transactionCommit(DsEvent, DsTransaction)" method of my custom extension of AbstractHandler by having a properties file that looks like this (same as the above, except for the type, and no file property ... eg:
    gg.handlerlist=myhandler
    gg.handler.myhandler.mode=tx
    gg.handler.myhandler.format=./dirprm/my_template.vm
    gg.handler.myhandler.type=my.custom.GGHandler
    I've verified that I have a valid DsEvent and a DsTransaction with the desired information in by custom handler's transactionCommit method ... and I can even pull out the required data and re-format it there to the desired format so that it looks just like the format that my Velocity template outputs when I'm outputting to a file (as shown in the first properties file).  But shouldn't I somehow  be able to access the Velocity transformation for my DsTransaction in my custom handler?
    Thanks for any assistance / info provided.

  • Java.util.zip not handling Unicode filenames

    I have a zip file that contains files with Asian filenames. java.util.zip.ZipFile opens it, but the filenames are garbled. Is there any way to handle filenames that contain unicode characters?

    Of course, compression works on bytes, not some higher level constructs like Strings or files.
    You can use the ZipOutputStream or DeflaterOutputStream for compression.
    And the javadoc for Deflater even has a code example of compressing a String.
    Edited by: Kayaman on May 22, 2011 5:04 PM

  • Bursting with JAVA APIs / MultiThreading / Errors Handling

    We are trying to use the bursting JAVA APIs 10.1.3.3.1 Standalone) to burst huge XML files and generate PDF Files from RTF templates. Here are a list of our issues with this feature:
    1. We have some problems catching the errors when bursting. We have tried to use the "oracle.apps.xdo.common.log.Logger" class, but it is not always reacting like we think it should. Could you please give us an exemple of a clean bursting error catching or a brief description of how we could do it. We have a lot of difficulties to find information about using the JAVA APIs of BIP.
    2. Is it a clean way of catching the bursting errors to use the "oracle.apps.xdo.common.log.Logger" class?
    3. When using the 10.1.3.3.1 DocumentProcessor JAVA API, the process gets killed when the RTF template is not where the control file specified it. Even when using a finally clause containing the document processor, we can't fetch the error from the "oracle.apps.xdo.common.log.Logger" class. We did not find a way to catch this error which make our program crash.
    4. How can we enable multi-threading that is included in the DocumentProcessor JAVA APIs so it can take advantage of the multi-processors environnements?

    1. Check tim d. blog, you can use the bursting listners to get the errors. It's also in the documentation.
    First, on every exception, the Bursting APIs are dumping the error in the Logger. So I can't see how we can use the listeners to catch these. We can check the hasExceptions on the Logger but still, we have some problems with this. When we deploy our application as a MDB (Message driven bean), it seems that once the hasException flag has been raised, if we call the MDB again, it is still up. Is there documentation about that Logger class? Also, I'm worried that we won't be able to call our MDB twice to run simultaneously 2 different bursting process since it seems the Logger is something static, keeping every exception in memory... That's bad.. And show me where you have found documentation about this. All I see in documentation is how to call the DocumentProcessor in a couple of lines. I don't see anything about a clean way to catch errors.
    2. Yes/No/Depends. I think it's fine. If your changing the logger options in your program that could come back to haunt you.
    I guess so, I'm not changing anything and its already haunting me...
    3. When using the 10.1.3.3.1 DocumentProcessor JAVA API, the process gets killed when the RTF template is not where the control file specified it. Even when using a finally clause containing the document processor, we can't fetch the error from the "oracle.apps.xdo.common.log.Logger" class. We did not find a way to catch this error which make our program crash.
    Even worst, when we deploy the component has an MDB, when the error happens, it kills the whole oc4j container... please correct this quick.
    4. How can we enable multi-threading that is included in the DocumentProcessor JAVA APIs so it can take advantage of the multi-processors environnements?
    We got an answer from the dev team which is to add two properties to the document processor, something like:
    enable-multithreading: true
    thread-count: >2
    We did that and what we got is that the process started and it got stuck in a dead lock at the first document processing. How nice! :)
    We got a milestone in March and I'm really worried about all those problems... Not enough documentation, a pretty bad error handling, errors making crash the whole oc4j container, Logger seems not to be handling simultaneous calls/ threads, not even handling two subsequent calls... etc.
    If anyone has the magic answer, it would be pretty welcomed!
    Thanks

  • Java 2 console event handling

    Hi all,
    Is there any way to handle the console events? I need something like AWT's WindowListener but for handling console events - "on close" in particular. I've written basic server app for a game, and it does not have gui (it only listens on specific port and sends messages from point A to point B). As usually on any Java app launch I get a console window (if not disabled of course...). The problem is, when I shut down the server, users don't get notified that the server was shut down, and they "loose" connection with each other without knowing it. So, I need an event listener which would catch the "On Close" or "On Exit" event of the console window when I press the "X" and CTRL+C to close server, where I would add code to send messages to all users to inform off server offline status.
    Any help would be greatly appreciated,
    Oleg

    thanks, acneto. But then again, I would need a listener for keys for console events? Is there one? But even if there is, users won't bother themselves typing anything (they will have the server app too), they'll just close it by pressing the "X" or CTRL+C, and other users won't get notified, so it's better to have a console window listener or something... Well, if this is not possible then I guess it'll be easier to just create a simple gui and then I'd add usual AWT listener... just curious anyways. If anyone has any other suggestions, I'd gladly hear them.
    Oleg

  • Can java program simulate keyboard input?

    is it possible to create a java program or applet that simulates an end-user's keyboard input into another java applet? is it also possible to feed the output of that target applet to a file based on the different input combinations?
    and How?
    Thanks.

    Take a look at the API-docs for the class java.awt.Robot . This generates system-level input-events. Might not work in an applet, I do not know whether an applet has the right to do this.
    The second question is actually the more difficult one, since normal applets can not do file access.

  • New java update and keyboard function

    I just updated Java to the latest version in Software Update (version 7 update 25). Now my keyboard does not work in a Java application. †he mouse does but all keystrokes are not inputed. Other than waiting for the next update and hoping that it works better is there any other option?
    thanks
    Ken

    It's been a while since I posted the message but I am running OK now. I forgot if I switched to a browser other than Safari or upgraded Java but it has been working recently.

  • Any way to get Java Plug-In-like handling of jar versions?

    I have jars intended for use with the Java Plug-In with version #'s in properties files (computed by the various tooling for updating these on the server). The jars themselves have no notion of jar #.
    I would like to re-use these jars and version #'s with Java Web Start to avoid conditional GETs, but without jar diffing in this case (as I already have many small jars due to lack of jar diffing in the Java Plug-In).
    Is there any way I can get Java Web Start to act like the Java Plug-In in this regard (i.e. the jar version # is a statement from the server, the client does a normal GET against the jar URL if its own version is not that stated by the server)?
    [Don't get me wrong, jardiffing is cool, but having to do everything differently between Java Web Start and the Java Plug-In is [b]not cool.

    Best way IMO would be to create a Socket connection to it so that you could connect with a client app and feed in data that way

  • Looking for a java-based SDK that handles file conversion to PDF and TIF...

    Hi all,
    First off, this is my first posting so I'm not 100% sure where to post this topic. So please forgive me if I'm accidentally posting in the wrong location.
    My question deals with a project I am currently working on.
    I am looking for a java-based SDK that can meet the following requirements...
    1) convert all printable file-formats (i.e. JPEG, DOC, TXT, PPT, etc.) into PDF
    2) merge multiple PDFs into one PDF
    3) convert PDF to TIF or at least do some sort of conversion to TIF
    4) works in Java or some sort of web-based language
    5) free or relatively cheap
    Any advice/suggestions would be greatly appreciated.
    Thank you very much.

    I don't think you will get one API to do them all.
    Some helpful hints:
    [http://schmidt.devlib.org/java/libraries-pdf.html]
    [http://xmlgraphics.apache.org/fop/] (with the pdf-image extension, that I can't find now :shakefist)
    JAI

  • Java API for Error Handling

    There are some common error tables storing error IDs information ( IDs like error type, project id, interface id, message id etc.) in Operational Database (is not on source or target system) which we have to update using java API. We need to call java API (java code) whenever error occurs. We have to provide all the IDs to this function and then API will take care of DB updating. We can call java API in mapping program by creating user-defined java function, this will trap all the errors which are in source file as well as in mapping and mapping lookup. Query is:
    A-      A- Do we have any other place after the mapping to call this java API and trap the errors through it?
    B-      Can we call Java API using BPM and pass error IDs to it.

    Hi Anand,
    You Have to write Module For that(if you wanna call Java API after Mapping)at the receiver.
    To write Module Here is a link which will help you in.....
    ==>http://help.sap.com/saphelp_nw04s/helpdata/en/84/2e3842cd38f83ae10000000a1550b0/frameset.htm
    ==>http://help.sap.com/saphelp_nw04s/helpdata/en/e4/6019419efeef6fe10000000a1550b0/frameset.htm
    ==>http://help.sap.com/saphelp_nw04s/helpdata/en/f4/0a1640a991c742e10000000a1550b0/frameset.htm
    Enjoy Coding....:)
    Regards,
    Sundararamaprasad.

  • Does java have default exception handler or something

    Hi,
    I am getting a lot of SQLExceptions in my project, and I am fed up with try/catches everywhere in my project. I am doing exactly the same in every catch.
    So I was wondering if there is any way of default error handling, so if noone catches this exception, this will catch it.
    I know it excists in VB.NET.
    thanx guys!
    Bart

    Look at Thread.UncaughtExceptionHandler

Maybe you are looking for