Processing ActionListener in panel_class.

Hi,
My application has:
1) JMenuBar
2) panel with cardlayout having 2 cards (screens)
on a contentpane.
The application is referred to as c1.
It is build with the use of seperate classes.
c2 = menubuilder
c3 = detailscreenbuilder
c4 = listscreenbuilder
All ActionListeners are created inside these classes.
So, C1 initializes and 'calls' C2, C3, C4 to build its screen.
When user selects a menu-item, the corresponding ActionListener is executed.
But how do I link this with an action in the applicationclass C1?
Example:
- User starts application
==> CardLayout shows default screen (c4)
==> JMenuBar is shown also
- User selects MenuItem:List.
==> an ActionListener, linked to the JMenuItem is triggered
This ActionListener is coded in the menubuilder (c2)
I would like to change the card_panel so that the detailscreen (c3) is shown.
This is done by executing: cardlayout.show("screen3");
Problem is... none of the objects used in the applicationclass are known to the menubuilder so how can I execute this?
Now I can

sorry, maybe the description is a bit difficult to understand without any code.
So, herewith you'll find the testcode (four classes)
Put them in a package called 'testscreenbuilder' and it should work.
The application starts with a menu and welcomescreen shown.
When selecting 'File - List', the 'ListPanel' should be displayed...
* Application
package testscreenbuilder;
import javax.swing.UIManager;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class myApplication
     extends JFrame {
     private Container c;
     private CardLayout cardlayout = new CardLayout();
     private JPanel pCards = new JPanel();
     boolean packFrame = false;
     private JPanel pNorth, pCenter, pSouth;
     private JLabel lNorth, lSouth, lCenter, lEast, lWest;
     // Variables
     private String titleScreen1, titleScreen2;
     private String gui = "J";
     private ActionListener al;
     //Construct the application
     public myApplication() {
          // Create View
          setTitle("myApplications");
          setSize(800, 550);
          c = getContentPane();
          c.setLayout(new BorderLayout());
          // add HomePanel
          pCards.setLayout(cardlayout);
          WelcomePanel cWelcome = new WelcomePanel(this, "welcome");
          pCards.add("welcome", cWelcome);
          ListPanel cList = new ListPanel();
          pCards.add("list", cList);
          cardlayout.show(pCards, "welcome");
          c.add(pCards, BorderLayout.CENTER);
          // add Menu
          Menu mMenu = new Menu();
          setJMenuBar(mMenu.getMenu());
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setVisible(true);
     // MenuFrame1 frame = new MenuFrame1();
     //Validate frames that have preset sizes
     //Pack frames that have useful preferred size info, e.g. from their layout
     if (packFrame) {
          this.pack();
     else {
          this.validate();
     //Center the window
     Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
     Dimension frameSize = this.getSize();
     if (frameSize.height > screenSize.height) {
          frameSize.height = screenSize.height;
     if (frameSize.width > screenSize.width) {
          frameSize.width = screenSize.width;
     this.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
     //Main method
     public static void main(String[] args) {
     try {
          UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
     catch(Exception e) {
          e.printStackTrace();
     new myApplication();
     class MenuHandlerList implements ActionListener{
          public void actionPerformed(ActionEvent e){
               cardlayout.show(pCards, "list");
* MenuBar
package testscreenbuilder;
import java.awt.event.*;
import javax.swing.*;
* @author pgo
public class Menu
     extends JFrame {
     private JMenuBar mMyMenu;
     // Menu
     private JMenu[] arMenu;
     private String arMenuText[] = {     
               "File", "Help"};
     // MenuItems
     private JMenuItem[] arMenuItem0;
     private String arMenuItem0Text[] = {
               "New", "List", "Exit"};
          private JMenuItem[] arMenuItem1;
     private String arMenuItem1Text[] = {
          "Help", "About..."};
public Menu() {
public JMenuBar getMenu() {
     if (arMenuText!=null)
          arMenu = new JMenu[arMenuText.length];
          // Menu 0 (File)
          if (arMenuItem0Text!=null)
               arMenu[0] = new JMenu(arMenuText[0]);
               arMenuItem0 = new JMenuItem[arMenuItem0Text.length];
               for (int si = 0;si<arMenuItem0Text.length;si++)
                    arMenuItem0[si] = new JMenuItem(arMenuItem0Text[si]);
                    switch(si)
                         case 0:     //New
                              arMenuItem0[si].addActionListener(new MenuHandler());
                              break;
                         case 1: //Properties
                              arMenuItem0[si].addActionListener(new MenuHandlerList());
                              break;
                         case 2: //Exit
                              arMenuItem0[si].addActionListener(new MenuHandlerExit());
                              break;
                         default:
                              arMenuItem0[si].addActionListener(new MenuHandler());
                              break;
                    arMenu[0].add(arMenuItem0[si]);
          // Menu 1 (Help)
          if (arMenuItem1Text!=null)
               arMenu[1] = new JMenu(arMenuText[1]);
               arMenuItem1 = new JMenuItem[arMenuItem1Text.length];
               for (int si = 0;si<arMenuItem1Text.length;si++)
                    arMenuItem1[si] = new JMenuItem(arMenuItem1Text[si]);
                    switch(si)
                         case 0: //Help
                              arMenuItem1[si].addActionListener(new MenuHandler());
                              break;
                         case 1: //About
                              arMenuItem1[si].addActionListener(new MenuHandlerAbout());
                              break;
                         default:
                              arMenuItem1[si].addActionListener(new MenuHandler());
                              break;
                    arMenu[1].add(arMenuItem1[si]);
     // Set MenuBar
     mMyMenu = new JMenuBar();
     if (arMenu != null)
          for (int i = 0;i<arMenu.length;i++){
               mMyMenu.add(arMenu);
     setJMenuBar(mMyMenu);
     return mMyMenu;
class MenuHandler implements ActionListener{
     public void actionPerformed(ActionEvent e){
     JMenuItem keuze = (JMenuItem)e.getSource();
     String tekst = keuze.getText();
     JOptionPane.showMessageDialog(null, "Function: '"+tekst+"' is under construction");
class MenuHandlerAbout implements ActionListener{
public void actionPerformed(ActionEvent e){
     JOptionPane.showMessageDialog(null, "My Application.\n\nVersion 1.0\nRelease Date June 2005");
class MenuHandlerExit implements ActionListener{
     public void actionPerformed(ActionEvent e){
     int response = JOptionPane.showConfirmDialog(null, "Are you sure that you wish to exit this application?", "Confirm Exit", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
     if (response==0){
     System.exit(0);
class MenuHandlerList implements ActionListener{
     public void actionPerformed(ActionEvent e){
* Welcome Panel
package testscreenbuilder;
import java.awt.*;
import javax.swing.*;
* @author pgo
public class WelcomePanel
     extends JPanel {
     private JPanel pNorth, pCenter, pSouth, pEast, pWest;
     private JLabel lNorth, lSouth, lCenter, lEast, lWest;
     WelcomePanel(){
     WelcomePanel(myApplication application, String title)
     setLayout(new BorderLayout());
     pNorth = new JPanel();
     lNorth = new JLabel();
     lNorth.setText("Welcome Title");
     pNorth.add(lNorth);
     pEast = new JPanel();
     lEast = new JLabel("Welcome (East)");
     pEast.add(lEast);
     pCenter = new JPanel();
     lCenter = new JLabel("Welcome (Center)");
     pCenter.add(lCenter);
     pWest = new JPanel();
     lWest= new JLabel("Welcome (West)");
     pWest.add(lWest);
     pSouth = new JPanel();
     lSouth = new JLabel("Welcome South");
     pSouth.add(lSouth);
     add(pNorth, BorderLayout.NORTH);
     add(pEast, BorderLayout.EAST);
     add(pCenter, BorderLayout.CENTER);
     add(pWest, BorderLayout.WEST);
     add(pSouth, BorderLayout.SOUTH);
* ListPanel
package testscreenbuilder;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ListPanel
     extends JPanel {
     private String listTitle = new String("");
     private JLabel lblTitle;
     private JButton bListOK, bListNOK;
     private JPanel dpNorth, dpCenter, dpSouth;
     private JLabel dlNorth, dlSouth, dlCenter, dlEast, dlWest;
public ListPanel() {
     setLayout(new BorderLayout());
     dpNorth = new JPanel();
     dpNorth.setLayout(new FlowLayout());
     dpCenter = new JPanel();
     dpCenter.setLayout(new FlowLayout());
     dpSouth = new JPanel();
     dpSouth.setLayout(new FlowLayout());
     lblTitle = new JLabel("Properties");
     bListOK = new JButton("OK");
     bListOK.addActionListener(new ActionListenerOK());
     bListNOK = new JButton("Cancel");
     bListNOK.addActionListener(new ActionListenerNOK());
     dpNorth.add(lblTitle);
     dpSouth.add(bListOK);
     dpSouth.add(bListNOK);
     add(dpNorth, BorderLayout.NORTH);
     add(dpCenter, BorderLayout.CENTER);
     add(dpSouth, BorderLayout.SOUTH);
class ActionListenerOK implements ActionListener{
     public void actionPerformed(ActionEvent e){
class ActionListenerNOK implements ActionListener{
     public void actionPerformed(ActionEvent e){

Similar Messages

  • Change Thread Priority

    Hi,
    I would like to implement a server code and change the priority value for each type of messages that receive from each client, simply I have two type of messages send it by the client the client will send multiple messages say 10 messages and receive the answer from the server OK or NO, each message will take 100 millisecond to process. I identify timer for low priority message that will increase the priority by one each second if that message still not process. My code as the following
    import java.io.*;                 
    import java.awt.*;                    
    import java.awt.event.*;          
    import java.net.*;                       
    import java.util.*;           
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import java.lang.Object;
    import java.io.Serializable;
    import javax.swing.Timer;
    class Serve extends Thread {
      private  Socket socket;
      private  ObjectInputStream  in;
      private  ObjectOutputStream out;
      private static int p1;
      private Timer t ;
      public Serve(Socket ss,ObjectInputStream  objin, ObjectOutputStream  objout
                        )throws IOException
                       in =objin ;
                       out = objout;
                       socket =ss;                       
                       start();
              }//end constructor
      public synchronized void run() {
            final int DELAY = 1000;
        try {
          while (true) { 
              try{
            Object str = in.readObject();
            if (str.equals("END")){
                  break;
                   if ( str.equals("message1"))
                                try{
                                       Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
                                         Thread.sleep((int) (Math.random() * 100 + 1));//time to process
                                             out.writeObject("OK");
                                         out.flush();
                                     }catch(Exception ioEx1){}  
                   Thread.currentThread().setPriority(Thread.NORM_PRIORITY);//return to norm priority after process
                    }      //end if payment requests 
                    else if(str.equals("message2"))
                             Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
                                 p1=Thread.currentThread().getPriority();
                                 //give chance to increase the priority every second if still not process
                                 ActionListener listener = new  ActionListener()
                                          public void actionPerformed(ActionEvent event)
                                               System.out.println("increase priority ");
                                            Thread.currentThread().setPriority(p1+1);
                                       t = new Timer(DELAY, listener);
                                       t.start();
                                               try{
                                                         Thread.sleep((int) (Math.random() * 100 + 1));
                                                     out.writeObject("NO");
                                                   }catch(Exception ioEx1){}
                    }catch(Exception e) {}
          }//end while
          System.out.println("closing...");
         }//end try
          catch(Exception e) {}
               finally {
          try {
            socket.close();
            t.stop();
             System.out.println(",,,,,,Socket closed...");
          } catch(IOException e) {
            System.err.println("Socket not closed");
    public class s { 
        public static Thread t;
        public static int x=0;//number of client
        public static void main(String[] args) throws IOException {
        ObjectOutputStream   out;
        ObjectInputStream in;
        ServerSocket s = new ServerSocket(3555);
        System.out.println("Server Started");
         try{
          while(true) {
            // Blocks until a connection occurs:
            Socket socket = s.accept();
             x++;
            System.out.println("after s.accept");
            try {
                         out= new ObjectOutputStream(socket.getOutputStream());
                          in =  new ObjectInputStream(socket.getInputStream());
                          t= new Serve (socket, in, out);  
              System.out.println("new ServerOne ");
            } catch(IOException e) {
              // If it fails, close the socket,
              // otherwise the thread will close it:
              socket.close();
            }//end catch
          }//end while
         finally {
          s.close();
      } The priority here will not become more than 5 even I put static in p1 definition ,and the timer will continue although I stop him after I close the socket. please any help???

    Doubly posted [On this site|http://forums.sun.com/thread.jspa?threadID=5390894] and cross posted [On another site|http://en.allexperts.com/q/Adobe-Framemaker-1523/2009/6/Timer-mulltiple-threads.htm].
    We asked you to be clear and open when multi-posting. We told you why. Yet you still do it without being forthright.

  • Calling ADF page Custom Listener (Ex: ActionListener) from BPM Process Task (APPROVE/REJECT)

    Hi All,
    Jdeveloper version - 11.1.1.7
    I am very new to BPM / SOA development, but I have very good development skills on ADF.
    I am not using ADF BC, using EJB for business services and also using custom ADF pages for HumanTasks.
    Usecase:
    From the BPM Process task, when process submission (APPROVE / REJECT) , I need to invoke a Custom listener (Ex.Action Listener - a EJB call) in the ADF page.
    I am trying to use BPM APIs.
    Please clarify me how this will achieve using BPM APIs. I need detail guidelines to do it. Please make to understand this process.
    Provide some useful documentation or links to understand the following:
    1. Custom Human task pages
    2. BPM APIs - 11.1.1.7
    3. Call a BPM process task from ADF Listener and Call a ADF Listener from BPM Process task - Using BPM APIs.
    Please revert more clarifications needed.
    Thanks and Regards
    Mohanraj N

    Hi Joonas.
    Plese let me explain me better for your understanding
    A big summary for what I meant it's the following:
    1- In the procces you made, when you add the HT activity, you have to implement it, this means declare the input(s) parameters you want. This implementation create the .task file.
    2- Create an application, and projects as HT you have. Each poject are based on the .task file, and automatically create a Data Control (for each project based on a .task) with all you need.
    This w'll be an empty application, so you can customize it all you want. The task selected should have all the parameters previously defined. Those parameters can change if you want.
    2- Create a page(s) in the task flow for the task implementation. You can even split the the payload of the task in differents pages, create your custom pages and any logic you need.
    3- An important aspect is how to match these application with the HT implemented in the process. It's possible, it's a configuration en the Enterprise Manager.
    4- Deploy your application
    All these are explain in the book I mentioned
    Th book you can find it here:
    https://blogs.oracle.com/soacommunity/entry/oracle_soa_suite_11g_handbook_1
    Regards Dariel.
    PS: Please, let me know if you need more details.

  • Strange error while using ActionListener with RichCommandLink

    Hi,
    I am using Technology preview 3.
    I have RichTable bound to af:table in my JSF page.
    I am showing database contents inside richTable.
    Inside richTable i have one extra column in which i am showing remove link. So every row of table will have remove link. I have added ActionListener as inner class for the backing bean. and this actionlistener i am adding into RichCommandLink(remove link)
    But when i click on remove link I am getting weired exception. And i am not able to get why this error is coming.
    This problem occures whenever I use contentDelivery parameter with <af:table>
    Here is the stack trace of the error.
    java.lang.InstantiationException: com.backingBean.UpdateSampleTypeB
    ackingBean$MyLinkActionListener
    at java.lang.Class.newInstance0(Class.java:335)
    at java.lang.Class.newInstance(Class.java:303)
    at org.apache.myfaces.trinidad.bean.util.StateUtils$Saver.restoreState(S
    tateUtils.java:286)
    at org.apache.myfaces.trinidad.bean.util.StateUtils.restoreStateHolder(S
    tateUtils.java:202)
    at org.apache.myfaces.trinidad.bean.util.StateUtils.restoreList(StateUti
    ls.java:257)
    at org.apache.myfaces.trinidad.bean.PropertyKey.restoreValue(PropertyKey
    .java:231)
    at org.apache.myfaces.trinidad.bean.util.StateUtils.restoreState(StateUt
    ils.java:148)
    at org.apache.myfaces.trinidad.bean.util.FlaggedPropertyMap.restoreState
    (FlaggedPropertyMap.java:194)
    at org.apache.myfaces.trinidad.bean.FacesBeanImpl.restoreState(FacesBean
    Impl.java:358)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.restoreState(U
    IXComponentBase.java:881)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestore
    State(UIXComponentBase.java:861)
    at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeStat
    e.java:96)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestore
    State(UIXComponentBase.java:855)
    at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeStat
    e.java:96)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestore
    State(UIXComponentBase.java:855)
    at javax.faces.component.UIComponentBase.processRestoreState(UIComponent
    Base.java:1154)
    at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeStat
    e.java:96)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestore
    State(UIXComponentBase.java:855)
    at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeStat
    e.java:96)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestore
    State(UIXComponentBase.java:855)
    at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeStat
    e.java:96)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestore
    State(UIXComponentBase.java:855)
    at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeStat
    e.java:96)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestore
    State(UIXComponentBase.java:855)
    at javax.faces.component.UIComponentBase.processRestoreState(UIComponent
    Base.java:1154)
    at org.apache.myfaces.trinidadinternal.application.StateManagerImpl.rest
    oreView(StateManagerImpl.java:487)
    at com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl
    .java:287)
    at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWra
    pper.java:193)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.resto
    reView(ViewHandlerImpl.java:258)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._restoreView(Li
    fecycleImpl.java:438)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(L
    ifecycleImpl.java:229)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(Lifecyc
    leImpl.java:155)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterC
    hain.java:65)
    at oracle.adfinternal.view.faces.webapp.rich.SharedLibraryFilter.doFilte
    r(SharedLibraryFilter.java:135)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterL
    istChain.doFilter(TrinidadFilterImpl.java:284)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter
    (RegistrationFilter.java:69)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterL
    istChain.doFilter(TrinidadFilterImpl.java:284)
    at oracle.adfinternal.view.faces.activedata.ADSFilter.doFilter(ADSFilter
    .java:74)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterL
    istChain.doFilter(TrinidadFilterImpl.java:284)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invoke
    DoFilter(TrinidadFilterImpl.java:208)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilt
    erImpl(TrinidadFilterImpl.java:165)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilte
    r(TrinidadFilterImpl.java:138)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFi
    lter.java:92)
    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterC
    hain.java:15)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:1
    18)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
    stDispatcher.java:611)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
    vletRequestDispatcher.java:362)
    at com.evermind.server.http.HttpRequestHandler.doDispatchRequest(HttpReq
    uestHandler.java:915)
    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequ
    estHandler.java:821)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
    tHandler.java:626)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
    tHandler.java:599)
    at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpReque
    stHandler.java:383)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:161)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
    va:142)
    at oracle.oc4j.network.ServerSocketReadHandler$ClientRunnable.run(Server
    SocketReadHandler.java:275)
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(Server
    SocketAcceptHandler.java:237)
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocket
    AcceptHandler.java:29)
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(
    ServerSocketAcceptHandler.java:878)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
    utor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
    .java:675)
    Can anybody please provide any help on this?
    Regards,
    Hiren

    Hi Simon,
    I am using addActionListener method of RichCommandLink
    Here is how i am trying to use it.
    public class backingBean {
         private RichTable table;
         public backingBean() {
         RichColumn rc = new RichColumn();
         RichCommandLink cmd = new RichCommandLink();
         MyActionListener listener = new MyActionListener();
         cmd.addActionListener(listener);
         public RichTable getTable() {
         return table;
         class MyActionListener implements ActionListener {
              public void processAction (ActionEvent actionEvent) throws AbortProcessingException {
              // Processing related to edit components of backing bean
    Hiren

  • Using Runtime exec() to open and close process like java or javac

    Hi, I m a student who is learning IT and is wondering if
    Runtime exec() can run and stop commands like java and javac?
    Can someone post the code to do so here?Thank you

    Well, Here is my complete code:
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class StreamGobbler extends Thread
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.type = type;
    public void run()
    try
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null)
    System.out.println(type + ">" + line);
    } catch (IOException ioe)
    ioe.printStackTrace();
    class Program implements Runnable
         Process proc;
    String args[];
         String[] cmd = new String[4];
         boolean isGone=false;
         public Program(String args[])
              this.args=args;
         public void run()
              if (isGone==true)
                   try
                        Runtime.getRuntime().exec(cmd).destroy();
                   catch(IOException e)
                        System.out.println("Error: "+e.toString());
                   System.out.println("User abort");
         public void start(String args[])
              if (args.length < 1)
    System.out.println("USAGE: java GoodWindowsExec <cmd>");
    System.exit(1);
    try
    String osName = System.getProperty("os.name" );
    if( osName.equals( "Windows NT" ) )
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[3] = args[0];
    else if( osName.equals( "Windows 95" ) ||osName.equals( "Windows 98" ))
    cmd[0] = "command.com" ;
    cmd[1] = "/C" ;
    cmd[2] = args[0];
                        cmd[3]=args[1];
    Runtime rt = Runtime.getRuntime();
    // System.out.println("Execing " + cmd[0] + " " + cmd[1]
    // + " " + cmd[2]+" "+args[1]);                                    
    proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    StreamGobbler outputGobbler = new
    StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    // int exitVal = proc.waitFor();
    //System.out.println("ExitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();
         public void destroy()
              isGone=true;
    class test1 implements ActionListener
         String s[]={"c:\\jdk1.3\\bin\\java.exe","ContactProcessor1"};
         GUI g=new GUI();
              Program p=new Program(s);
         public test1()
              //didnt work
              g.getStart().addActionListener(this);
              g.getStop().addActionListener(this);
              g.show();
         public void actionPerformed(ActionEvent e)
              if (e.getSource()==g.getStart())
                   p.start(s);
                   p.run();
              if (e.getSource()==g.getStop())
                   p.destroy();
                   p.run();
         public static void main(String args[])
              test1 t = new test1();
    class GUI extends JFrame
         JButton start;
         JButton stop;
         public GUI()
              super();
              getContentPane().setLayout(new FlowLayout());
              start=new JButton("start");
              stop=new JButton("stop");
              getContentPane().add(start);
              getContentPane().add(stop);
              setSize(100,100);
         public JButton getStart()
              return start;
         public JButton getStop()
              return stop;
    }

  • How can I change the default process of VK_ENTER in JTable

    Now I have met a requirment to process the "enter" key event in JTable. But it is found that the JTable has a default process on the ENTER key press, and it will select the next row. Even the worse, the default process is invoked before the KeyListener I registered.
    How can I remove that?
    I have tried the follow ways: 1.remove several keys, such as "selectNextRow","selectNextRowExtendSelection", from the actionMap,
    2.invoke processKeyBinding() in the constructor of my subclass of JTable.
    But both lead to failure.
    And I can't find the default process to the VK_ENTER in the java source code. I need help on this.
    BTW, does anyone know how to eliminate the focus traversal between cells. When I press left arrow or right arrow, the focus traverses in the scope of the selected row.

    thanks
    i also found solution for my poblem:
    i have this code:
    jMenuItem jMnItEdit;
    jMnItEdit.setAccelerator( KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER, 0));
    also i had ActionListener bounded to this JMenuItem
    but Ialso had in form JTable and it always grabbed my VK_ENTER event and that menu item wasn't working at all
    but when i overrode that input map for JTable and set
    tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), "none");
    everything started to work perfectly,
    thanks a lot

  • [Workaround] Calling BPEL process from jspx causes DCA-40012 error on AS

    Hi!
    I've created a DataControl for my BPEL process in my application (ADF BC 10.1.3.3).
    I've created command button on my jspx page that has ActionListener binded to a backing bean method that calls commit and than my BPEL process through the bindings.
    The process consists of reading some DB data, creating XML message and saving it to disk.
    If I run my application from JDeveloper, everything is working fine, the file is written to desired folder. But after I deploy my application to AS 10.1.3.3 and try to call the same process, it doesn't get executed. I see this error in log files:
    Exception:
    oracle.adf.model.adapter.AdapterException: DCA-40012: Failed to create a connection to the Web Service.
         at oracle.adfinternal.model.adapter.webservice.WSDefinition.loadFromMetadata(WSDefinition.java:659)
         at oracle.adf.model.adapter.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:163)
         at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:76)
         at oracle.adf.model.BindingContext.get(BindingContext.java:457)
         at oracle.adf.model.BindingContext.findDataControl(BindingContext.java:308)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.getDataControl(JUCtrlActionBinding.java:489)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:625)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:378)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:128)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:105)
         at myClass.myMethod(MyClass.java:1220)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at oracle.adf.view.faces.component.UIXComponentBase.__broadcast(UIXComponentBase.java:1087)
         at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:204)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:228)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:197)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:123)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:103)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    I read about bug 5878326 and tried applying the patch Patch for 6404865(Base bug 5878326) in my JDeveloper (on my local machine, not on AS, since there is no JDev on the server).
    But this patch doesn't solve my problems. Is there another patch for this or this behavior isn't the same as in bug 5878326?
    Thanks, BB.

    Hi BB,
    It's Phil again.
    Thanks for the follow up, especially you aren't working on this subject any more. This is indeed a bug in 10.1.3.3, but not on 10.1.3.1 Application Server. Embedded OC4J server in JDeveloper 10.1.3.3 doesn't produce this error at all. Patch for 5878326 does NOT solve this issue.
    However, I have found a walk-around for this issue. Most if it has already being documented.
    Oracle recommend two options to access a Web Service, by creating a Web Service Data Control or a Web Service Proxy.
    See more info: http://www.oracle.com/technology/products/jdev/howtos/1013/wsadf/adfcomplexwstypes.html?_template=/ocom/print
    Both approaches work on JDeveloper 10.1.3.3, but the prior option will fail on App Server 10.1.3.3 due to the bug being discussed in this thread.
    For the time being, we can opt for the second option. A quick example is provided below.
    - Construct a Web Service Proxy by right-click on chosen project, select New ... | Business Tier -> Web Services | Web Service Proxy, provide WSDL URL and complete the wizard. a Web Service Proxy is generated for you at (your package).proxy under Application Sources folder.
    - Select this proxy, switch to Struture view, you will see a list of classes contained in the proxy. Look for a class with name (Web Service Name)Client.java. In my case, it is called __soap_getCustomerDB_getCustomerDB_pttClient.java. This class is of particular interest to you, as it provides an interface to invoke Web Service calls, in this case, getCustomerDBSelect_id(GetCustomerDBSelect_id id).
    - Now create a new class, which you may extend from the example class below.
    /********************** CODE BEGIN *********************************/
    package oracle.srdemo.datamodel;
    import java.rmi.RemoteException;
    import oracle.srdemo.datamodel.proxy.__soap_getCustomerDB_getCustomerDB_pttClient;
    import oracle.srdemo.datamodel.proxy.types.com.oracle.xmlns.pcbpel.adapter.db.top.getcustomerdb.GetCustomerDBSelect_id;
    import oracle.srdemo.datamodel.proxy.types.com.oracle.xmlns.pcbpel.adapter.db.top.getcustomerdb.CustomerCollection;
    public class WsCustomer {
    __soap_getCustomerDB_getCustomerDB_pttClient myPort = null;
    public WsCustomer() {
    try {
    myPort = new __soap_getCustomerDB_getCustomerDB_pttClient();
    } catch (Exception e) {
    e.printStackTrace();
    * @param customerId
    * @return
    public CustomerCollection getCustomer(int customerId) throws RemoteException {
    GetCustomerDBSelect_id id = new GetCustomerDBSelect_id();
    id.setId(String.valueOf(customerId));
    return myPort.getCustomerDBSelect_id(id);
    /********************** CODE FINISH *********************************/
    - Save the class, rebuild the project.
    - Right-click on this class and select 'Create Data Control'. You should find a new Data Control named (Your Class Name)DataControl is generated on Data Control Palette.
    - You can drag-and-drop available methods from the data control onto you jspx page, rebuild and test it on embedded OC4J Server.
    - Deploy the ear or war file on App Server.
    Hope this helps.
    Regards,
    Phil

  • JSP actionListener doesn't work

    I am new to JSP and all this web application stuff. (Sorry if I am in the wrong forum).
    I have created a jsp "webpage" with a few textfields and a button. I want the jsp to send the information from the textfields to a mySQL table via JDBC Connection. The connection works(I have tested it in my init() meyhode and it worked), but if I add an action Event (with NetBeans and Sun Studio Creater) to the button, and I press the button nothing happens.
    I have tried to put diffrent code into the methode, like change the text of a lable or give a popup frame, but if I press the button nothing happens.
    Here is the listener for the button, it has been added to the button:
        private static final String DRIVER = "com.mysql.jdbc.Driver";
        private static final String DATABASE_URL = "jdbc:mysql://localhost/P";
        private static final String USER = "jhtp7";
        private static final String PASS = "jhtp7";
        private static Connection connection = null;
        private static PreparedStatement insert = null;
        private int __placeholder;
        private void _init() throws Exception {               //the init methode
             Class.forName(DRIVER);
             connection =DriverManager.getConnection(DATABASE_URL, USER, PASS);
            insert = connection.prepareStatement("insert into pp (Number, Name) values (?, ?)");
    public String button3_action() {         //the action event for the button
            try{ 
            insert.setInt(1,4);
            insert.setString(2, "fghfghfghfghfgh");
            insert.executeUpdate();
            }catch (SQLException ee){
            return null;
        }Can anyone tell me what I have done wrong, or how to write a normal ActionListener(like in normal java) and add it to the button???

    You can't. The code that is produced by JSP is HTML, not Swing and not AWT. Which means you can't use the Java Event Dispatching to work with the GUI.
    You will need to put the input into an HTML <form> with an action to a servlet. You will need to submit the form using an <input type="submit"> and you will need a servlet that processes the incoming parameters and makes the JDBC call. Read the [JEE 5 Tutorial|http://java.sun.com/javaee/5/docs/tutorial/doc/], particularly the first few chapters, and learn HTML.

  • TextArea append information during process?

    I have a system that append information in one textarea, I would like that textarea shows the information being appended in the moment.
    To start the append, I click in a button. Then I click in the button, the information shows in the textarea when the process finished only and not during process.
    Below is one similar code with the problem.
    Thanks by help.
    import javax.swing.*;
    import java.awt.event.*;
    public class test extends JFrame implements ActionListener {
        public test() {
            cmdStartCapture.addActionListener(this);
            pnlGeral.setLayout(null);
            cmdStartCapture.setBounds(30,40, 200, 26);
            pnlGeral.add(cmdStartCapture); 
            scpDataCaptured.setBounds(50,200, 200, 300);
            scpDataCaptured.setViewportView(txaDataCaptured);
            pnlGeral.add(scpDataCaptured);
            pnlGeral.setBounds(0,0, 800, 700);
            pnlGeral.setLayout(null);
            getContentPane().add(pnlGeral);
            setBounds(10,10, 800, 700);
            setVisible(true);   
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitSystem();
           // IF I ENABLE THIS LINE TO THE PROCESS RUN WITH SYSTEM
          // INITIALIZATION, THE INFORMATION IS SHOW DURING PROCESS
           //cmdStartCapture.doClick();
        private void exitSystem() {
           setVisible(false);
            dispose();
            System.exit(0);
        public static void main(String[] args) {
            test system = new test();
        public void actionPerformed(ActionEvent event) {
            Object selobj = event.getSource();      
            if (selobj == cmdStartCapture) {
               // IF THE PROCESS RUN THROUGH BUTTON CLICK
              // THE TEXTAREA SHOW INFORMATION WHEN PROCESS
             //  FINISHED.
                cmdStartCapture() ;
        private void cmdStartCapture() {         
                int i = 0, cont=200000;           
                while (i<cont) {         
                    txaDataCaptured.append("\n test " + i );                 
                    i = i + 1;               
        private JPanel pnlGeral = new JPanel();
        private JButton cmdStartCapture = new JButton("Start");
        public static JTextArea txaDataCaptured = new JTextArea();
        private JScrollPane scpDataCaptured = new JScrollPane();
    }

    where is thread part ?
    import javax.swing.*;
    import java.util.*;
    import java.awt.event.*;
    public class testThis extends JFrame implements ActionListener,Runnable {
        public testThis() {
            cmdStartCapture.addActionListener(this);
            pnlGeral.setLayout(null);
            cmdStartCapture.setBounds(30,40, 200, 26);
            pnlGeral.add(cmdStartCapture);
            scpDataCaptured.setBounds(50,200, 200, 300);
            scpDataCaptured.setViewportView(txaDataCaptured);
            pnlGeral.add(scpDataCaptured);
            pnlGeral.setBounds(0,0, 800, 700);
            pnlGeral.setLayout(null);
            getContentPane().add(pnlGeral);
            setBounds(10,10, 800, 700);
            setVisible(true);
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitSystem();
           // IF I ENABLE THIS LINE TO THE PROCESS RUN WITH SYSTEM
          // INITIALIZATION, THE INFORMATION IS SHOW DURING PROCESS
           //cmdStartCapture.doClick();
        private void exitSystem() {
           setVisible(false);
            dispose();
            System.exit(0);
        public static void main(String[] args) {
            testThis system = new testThis();
        public void actionPerformed(ActionEvent event) {
            Object selobj = event.getSource();
            if (selobj == cmdStartCapture) {
               // IF THE PROCESS RUN THROUGH BUTTON CLICK
              // THE TEXTAREA SHOW INFORMATION WHEN PROCESS
             //  FINISHED.
        //        cmdStartCapture() ;
              new Thread(this).start();
        private void cmdStartCapture() {
    /*            int i = 0, cont=200000;
                while (i<cont) {
                    txaDataCaptured.append("\n test " + i );
                    i = i + 1;
        private JPanel pnlGeral = new JPanel();
        private JButton cmdStartCapture = new JButton("Start");
        public static JTextArea txaDataCaptured = new JTextArea();
        private JScrollPane scpDataCaptured = new JScrollPane();
            public void run()
                int i = 0, cont=200000;
                while (i<cont) {
                    txaDataCaptured.append("\n test " + i );
                    i = i + 1;
    Hope This helps

  • Add a actionlistener to JTextArea and print out string when  the user input

    Hello:
    I got a problem to add a actionlistener to JTextArea and print out string which from the user input a sentence and after the user press the "enter".
    Could anyone help me please?
    Thanks
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.JScrollBar;
    public class PanelDemo extends JFrame {
       private static JTextArea tAreaUp, tAreaDown;
       private BorderLayout layout;
       private static String strings;
       public PanelDemo()
          super( " test " );
          Container container = getContentPane();
          layout = new BorderLayout();
          container.setLayout( layout );
          tAreaUp = new JTextArea(2,1);
          tAreaUp.setLineWrap(true);
          tAreaUp.setWrapStyleWord(true);
          tAreaUp.setEditable(false);
          tAreaUp.append("I am testing ");
          tAreaUp.append("I am testing");
           JScrollPane scrollPane = new JScrollPane(tAreaUp);
           scrollPane.setVerticalScrollBarPolicy(
                            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
           scrollPane.setPreferredSize(new Dimension(250, 250));
          tAreaDown =new JTextArea(2,1);
          tAreaDown.setLineWrap(true);
          tAreaDown.setWrapStyleWord(true);
          tAreaDown.addActionListener(new TextAreaHandler());
          JScrollPane scrollPane2 = new JScrollPane(tAreaDown);
          scrollPane2.setVerticalScrollBarPolicy(
                            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
          container.add( scrollPane, layout.CENTER );
          container.add( scrollPane2, layout.SOUTH );
          setSize( 300, 300 );
          setVisible( true );
         //private inner class for event handling
         private class TextAreaHandler implements ActionListener{
              //process textArea events
            public void actionPerformed(ActionEvent e){
               strings=e.getActionCommand();
                System.out.println(strings);
       public static void main( String args[] )
          PanelDemo application = new PanelDemo();
          application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }

    Thanks for your help, but I still got a question for you.
    Do you think the way I register the even handler to the TextArea is correct?
    Because the compailer complains about that which like
    "D:\101\fig13_27\PanelDemo.java:43: cannot resolve symbol
    symbol  : method addActionListener (PanelDemo.TextAreaHandler)
    location: class javax.swing.JTextArea
          tAreaDown.addActionListener(new TextAreaHandler());

  • How to put main process to sleep??

    Hi experts
    I have another problem in my ajav application , When I press execute button, it creates a process which run a bat file. the bat file actuallty run something and produce the output file. then main process read that output file and show the content in the result panel . Now in order to finish the process, I put the main process to sleep, other wise it cant find the file or it shows incomplete file/empty file. I use Thread.sleep(2000). But this is not appropriate , sometimes the files might be big or the bat file might need much time to finish which is common senario , In that case,I wont get appropriate output. My question is how can I put the main process to sleep until the the other process finish creating the file.
    Any clue is helpful. Pls help. I am stucking at this point.
    public class ButtonHandler implements ActionListener {
         GUIPanel guiPanel;
         ButtonHandler(GUIPanel gp){
              guiPanel=gp;
          public void actionPerformed (ActionEvent e){                    
              JButton button = (JButton)e.getSource();
              if(button == guiPanel.excButton){
                   runBatFile(); // run the batch file
                   try { // put main process to sleep
                        Thread.sleep(4000);
                   } catch (InterruptedException ex) {
                        System.out.println("Too much Caffine! Cant Sleep..");
                        System.out.println("Error:" +ex);
                   }//end of catch
                   parseResult();     //show the output               
              if(button == guiPanel.closeButton){
                   System.exit(0);
          }//end of fucntion
         public void runBatFile(){
              Process p=null;
              try {
                    //p = Runtime.getRuntime().exec("test.bat");                 
              } catch (IOException e1) {
                       System.err.println(e1);     
              }//end of catch      
         }//end of function
         public void parseResult(){
              try {
                   BufferedReader in=new BufferedReader(new FileReader("test.txt"));
                   String s1;
                   JTextArea jta=new JTextArea();     
                   jta.setFont(new Font("Serif", Font.BOLD, 14));
                     jta.setEditable(false);
                   JScrollPane jsp = new JScrollPane( jta,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                               JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
                   jta.append(" ");     
                   int lineCount=0;
                      while((s1=in.readLine())!=null){
                        System.out.println(s1);
                        lineCount++;
                        jta.append(s1);
                        jta.append("\n");
                   }//end of while
                   in.close();
                   jta.append("\n\nI am done with it:"+ lineCount+"\n");
                   resultPanel.removeAll();                                
                         resultPanel.add(jsp);
                   resultPanel.revalidate();
              } catch (IOException e1) {
                       System.err.println(e1);               
                       System.exit(1);
              }//end of catch      
         }//end of function
    }//end of class 'ButtonHandler'

    pkwooster
    Thanks for ur explanation. I I added invokelater and get some exception: "Cannot call invoke and wait from evene dispatcher thread." How can I eleminate that. Pls reply.
    public class ButtonHandler implements ActionListener {
         GUIPanel guiPanel;
         ButtonHandler(GUIPanel gp){
              guiPanel=gp;
          public void actionPerformed (ActionEvent e){                    
              JButton button = (JButton)e.getSource();
              if(button == guiPanel.excButton){
                   JTextArea jta = new JTextArea();
                   jta.setFont(new Font("Serif", Font.BOLD, 14));
                     jta.setEditable(false);
                   JScrollPane jsp = new JScrollPane( jta,
                   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
                   resultPanel.removeAll();     
                   jta.append("Please wait while we retrive the Information... ");
                   resultPanel.add(jsp);
                   resultPanel.revalidate();
                   runBatFile(); // run the batch file
                            parseResult();     //show the output               
              if(button == guiPanel.closeButton){
                   System.exit(0);
          }//end of fucntion
         public void runBatFile(){
              try {
                   SwingUtilities.invokeAndWait(new Runnable() {
                   public void run() {                
                        Process p=null;
                        try {             
                               p = Runtime.getRuntime().exec("abaqus_license.bat");               
                        } catch (IOException e1) {System.err.println(e1);}//end of catch
               } catch(Exception e) {;}
              }//end of function
         public void parseResult(){
              ;//do something
         }//end of function
    }//end of class 'ButtonHandler'

  • Multiple request processing on action of commandLink

    Hi,
    I am working on a transaction based screen where on submit the transaction is done. On submit I have used action parameter of commandLink to perform a transaction. However I am facing a problem. Once submit is clicked, during the processing of the request, If I click Submit again, multiple transaction are done.
    I suspect this is due to action. Is if I use actionListener will this not be happened?
    Please advice.

    I have another screens which do not have this problem. They have used actionListener rather that action.
    My observation are during the processing of the request, on multiple requests made there is an additional transaction happened regardless of number of more request. I mean once you click on Submit, if you click more then 2 times, even though transaction takes place exactly 2 times.

  • How can I change the default process priority for plugin-container?

    I'm on Windows XP and using Firefox 16.0.2.
    While browsing the web I often listen to pandora, but the music playback is always choppy or jerky. It especially occurs when scrolling pages up/down on other tabs. I saw on another question - https://support.mozilla.org/en-US/questions/930496 - that one solution is to change the plugin-container.exe priority to AboveNormal. I've done this several times and it works really well!!
    I also tried changing the firefox.exe priority up and down, but this is ineffective (choppy playback problem still occurs). It is very much related to the plugin-container priority.
    Please could you provide an about:config option to set the default process priority for the plugin-container. It would make a big difference for those users who have the problem. Thanks!

    thanks
    i also found solution for my poblem:
    i have this code:
    jMenuItem jMnItEdit;
    jMnItEdit.setAccelerator( KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER, 0));
    also i had ActionListener bounded to this JMenuItem
    but Ialso had in form JTable and it always grabbed my VK_ENTER event and that menu item wasn't working at all
    but when i overrode that input map for JTable and set
    tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), "none");
    everything started to work perfectly,
    thanks a lot

  • Process train - doesn't navigate backwards

    I'm using JDev10.1.3.3, and I am trying to implement an 8 node multipage process train. The problem is it will sequential move forward through the nodes, but never back. I'm using the default "PlusOne" scenario, so I'm expecting that I can move back, for example: node1 to node 2 to node3 back to node 2. I have navigation rules for the forward and the back for all 8 jspx pages. I've re-read the framework tutorial a few times and I'm following it closely. It says the default JSF actionListener mechanism uses the outcome values to handle page navigation, so what am I missing? Where does it recognize the back outcome if the forward actions are in the managed bean? Any help is much appreciated!

    I apologize for not mentioning the version. Yes, I am using Jdeveloper 10.1.3 for this test case.
    What I am trying to achieve:
    I have a startup page which is used to call the application. Depending on the logic based on the Parameters passed, I need to navigate to a selective page.
    I have several sessionScope variable in the application-version on production. I wish to convert these to processScope variables to resolve the confliction of multple calls to the application from the same machine/ browser.
    Some additional information I missed out to mention:
    If we navigate with the navigate() method, the processScope value will persist. I tried adding a javascript to pg1 to auto navigate. This worked fiine too.
    <script type="text/javascript">
    function navBtnAct() {
    var evnt4Comp = document.all('btn1');
    var newEvt = document.createEventObject();
    try {
    evnt4Comp.fireEvent("onclick", newEvt);
    } catch (e) {
    alert('error '+e.description);
    </script>
    <afh:body onload="navBtnAct();">
    However I would be happy to find a solution for redirect() as this would reduce some of juggling work

  • ActionListener problem with the String and TextField in different packages.

    i have the following string in the first file. This String text is changing values with the execution of the file
    class Baby {
    public static String Update="";
    void tata() {
    Update="Connecting...";
    Update="Authenticating...";
    Update="Getting data...";
    ....I want with the help (obviously) by an Action Listener to update constantly the value of a TextField. The Action Listener and the TextField are located both in another file and class.
    UpdateTextField.addActionListener(actionListener);
    UpdateTextField.setText(Baby.Update);Is it possible? I cant find a solution.
    Any help would be appreciated.

    Well that is really something... If it wasn't for the<tt> Click here and press <Enter>, </tt>the GUI would have been soooo counter-ituitive. :)
    I was actually trying to steer OP away from the ActionEvents in the first place. Frankly, I just see no need for it in his app. I was thinking along the lines of ...
    import javax.swing.*;
    public class Test
      JLabel label;
      public Test(){
        label = new JLabel("Initializing...");
        JFrame f = new JFrame();
        f.getContentPane().add(label, "Center");
        f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
        f.setBounds(0, 0, 200, 60);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
        LongProcess process = new LongProcess();
        process.start();
      class LongProcess extends Thread
        int[] waitTimes = new int[]{
          2000, 500, 2000, 500, 5000, 1000};
        String[] operations = new String[]{
          "Starting", "Connecting", "Connected",
          "Reading", "Processing", "Done"};
        public void run(){
          try{
            for(int i = 0; i < waitTimes.length; i++){
              sleep(waitTimes);
    updateLabel(i);
    catch(InterruptedException ioe){
    ioe.printStackTrace();
    updateLabel(operations.length-1);
    protected void updateLabel(final int index){
    SwingUtilities.invokeLater(new Runnable(){
    public void run(){
    label.setText(operations[index] + "...");
    public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    new Test();
    }... see how this approach rids the application from any Events being fired? See how OP can put his network connections and file reads on a separate thread -- then update the JLabel via SwingUtilities.invokeLater()? In my opinion, this would be a much better outline to OP's situation.
    Disclaimer: I'm not saying this is the only approach, I'm sure there are other solutions -- and may even be better than this.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • P0rn4Mac & 1032.dmg trojans (misspelled so it won't ****)

    *4mac is something very bad. I just got it. very nasty. It won't let me use time machine to get rid of it. It won't let me delete it. I got it on an imac running up to date 10.5 leopard. I got it from a web page that appeared on a google search resul

  • Misconfiguration error coming while installing adobe air update version exe

    Hi friends, I need clarification regarding the follwing issue: I already installed my application  0.3 version  in my system.now i created 0.4 version of my application.but while i am trying to install 0.4 version exe. It thorw a alert box like this:

  • Problem with Xsan Admin

    Hello I have a big problem with my Xsan Admin. Yesterday by mistake my configuration of xsan admin from Application Support are gone. Only config files from /Library/Filesystems/Xsan/config survive, but without one client in config.plist Now i cant m

  • Dropped Frames in the Xsan environment

    Hello Everyone, I have just setup a SAN network and have been experiencing dropped frames when capturing HD Pro Res 422 on my two client computer at the same time. I have been successful capturing on one computer at a time and playing the same captur

  • Oracle Database Express Edition 11g Release2 11.2.0 silent Installation failing with port8081 error

    Hi everyone, We are trying to create silent(unattended) install package to install Oracle database 11g express edition 11.2.0 silently on our machines. We modified the provided .iss file as per the requirement and tried to install with below command,