JOptionPane event blocking problem

Hi,
JOptionPane is causing me a problem.
I have a simple frame that contains a text field and a button.
Pressing the button should write something to the standard output.
When the text field loses focus a JOptionPane in poped to the user.
The following scenario is problematic:
1. The text field owns the focus.
2. The user presses the button.
Expected result:
The JOptionPane appears due to the lost focus event on the text field.
After closing it some text is written to the standard output due to the action event on the button.
The actual result:
The JOptionPane does appears but after closing it nothing is written to the standard output. The button stays in a curious state (when the mouse hovers over the button the button looks pressed, and when the mouse doesn't hover over the button the button looks unpressed).
Probable reason for this behaviour:
The JOptionPane blocks all awt/swing events while it is opened. Some of the button code is perfomed due to the button press, but the ActionListener's actionPerformed method is not invoked.
I need the actionPerfomed method to be invoked.
Can anyone help me?
Here is the source code:
package test;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
public class Test {
public Test() {
public static void main(String[] args) {
//Test test1 = new Test();
final JFrame f = new JFrame("Test");
JButton b = new JButton("Click Here");
JTextField tField = new JTextField("Text", 10);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Button pressed!");
tField.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
if (e.isTemporary()) return;
JOptionPane.showMessageDialog(f,
"Focus lost",
"Title",
JOptionPane.INFORMATION_MESSAGE);
JPanel content = (JPanel)f.getContentPane();
content.setLayout(new BoxLayout(content, BoxLayout.X_AXIS));
content.add(tField);
content.add(Box.createHorizontalStrut(5));
content.add(b);
f.pack();
f.show();
Thanks,
Shai

Hello Shai.
The JOptionPane seems to consume all events when its shown. (Check the stack after JOptionPane is shown.) I've solved a similar problem with the SwingUtilities.invokeLater() method. Maybe the following example will help:
Runnable doDlgError = new Runnable() {
public void run() {
JOptionPane.showMessageDialog(this, "Error", "Error",
JOptionPane.ERROR_MESSAGE);
SwingUtilities.invokeLater(doDlgError);
-Olaf

Similar Messages

  • Delicate ProgressMonitor/ event handling problem

    Hi,
    I have a delicate ProgressMonitor / event handling problem.
    There exists some solution on similiar problems here in the forums, but no solution to my special problem, hope anybody can help me out.
    I have a rather big project, an applet, that I've written a separate JarLoader class that will load specific jar's if the ClassLoader encounter a unloaded class, all ok so far.
    But, during loading, I would like to display a ProgressBar. And here is the problem. If my custom ClassLoader intercepts a findClass -request that needs to load the class from a jar from a normal thread, this is no problem, but if the ClassLoader intercepts a findClass that needs loading a jar when inside the EventQueue -thread, this is becomming tricky!
    The catch is that an event posted on the EventQueue finally needs a class that needs to be loaded, but I cannot dispatch a thread to do this and end that particular event before the class itself is loaded.
    So how do I hold the current EventQueue -event needing a jar -load, Pop up a ProgressBar, then process events in the EventQueue to display the ProgressBar and update repaints in it? then return from the event that now have loaded needed class-files.
    I've tried a tip described earlier in the forums by trying to handle events with this code when loading the Jar:
        /** process any waiting events - use during long operations
         * to update UI */
        static public void doEvents() {
            // need to derive from EventQueue otherwise
            // don't have access to protected method dispatchEvent()
            class EvtQueue extends java.awt.EventQueue {
                public void doEvents() {
                    Toolkit toolKit = Toolkit.getDefaultToolkit();
                    EventQueue evtQueue = toolKit.getSystemEventQueue();
                    // loop whilst there are events to process
                    while (evtQueue.peekEvent() != null) {
                        try {
                            // if there are then get the event
                            AWTEvent evt = evtQueue.getNextEvent();
                            // and dispatch it
                            super.dispatchEvent(evt);
                        catch (java.lang.InterruptedException e) {
                            // if we get an exception in getNextEvent()
                            // do nothing
            // create an instance of our new class
            EvtQueue evtQueue = new EvtQueue();
            // and call the doEvents method to process the events.
            evtQueue.doEvents();       
        }Then, the loader checks
    java.awt.EventQueue.isDispatchThread()to see if its' inside the eventqueue, and runs doEvents after updating the ProgressMonitor with new setProgress and setNote values.
    More precise;
    The loader is loading the jar like this:
    (this is pseudo code, not really usable, but outlines the vital parts)
    public void load() {
      monitor = new ProgressMonitor(null, "Loading " + jarName, ""+jarSize + " bytes", 0, jarSize);
      monitor.setMillisToDecideToPopup(0);
      monitor.setMillisToPopup(0);
      // reading jar info code here ...
      JarEntry zip = input.getNextJarEntry();
      for (;zip != null;) {
         // misc file handling here... total = current bytes read
         monitor.setProgress(total);
         monitor.setNote(note);
         if (java.awt.EventQueue.isDispatchThread()) {
            doEvents();
         zip = input.getNextJarEntry();
      monitor.close();
    }When debugging doEvents(), there is never any events pending in peekEvents(), even if I tries to put a invokeLater() to run the setProgress on the monitor, why? If it had worked, the doEvents() code would have saved my day...
    So, this is where I'm totally stuck...

    Just want to describe how I did this using spin from http://spin.sourceforge.net
    This example is not pretty, but it can probably help others understanding spin. Cancelling the ProgressMonitor is not implemented, but can easily be done by checking on ProgressMonitor.isCanceled() in
    the implementation code.
    First, I create a bean for displaying and run a ProgressMonitor:
    Spin requires an Interface and an Implementation, but that's just nice programming practice :-)
    import java.util.*;
    public interface ProgressMonitorBean {
        public void start(); // start spinning
        public void cancel(); // cancel
        public int getProgress(); // get the current progress value 
        public void setProgress(int progress); // set progress value
        public void addObserver(Observer observer); // observer on the progressValue
    }Then, I created the implementation:
    import java.util.*;
    import javax.swing.ProgressMonitor;
    import java.awt.*;
    public class ProgressMonitorBeanImpl extends Observable implements ProgressMonitorBean {
        private ProgressMonitor monitor;
        private boolean cancelled;
        private int  progress = 0;
        private int  currentprogress = 0;
        public ProgressMonitorBeanImpl(Component parent, Object message, String note, int min, int max) {
            monitor = new ProgressMonitor(parent, message, note, min, max);
            monitor.setMillisToDecideToPopup(0);
            monitor.setMillisToPopup(0);       
        public void cancel() {
            monitor.close();
        public void start() {
            cancelled = false;
            progress = 0;
            currentprogress = 0;
            while (progress < m_cMonitor.getMaximum()) {
                try {
                    synchronized (this) {
                        wait(50); // Spinning with 50 ms delay
                    if (progress != currentprogress) { // change only when different from previous value
                        setChanged();
                        notifyObservers(new Integer(progress));
                        monitor.setProgress(progress);
                        currentprogress = progress;
                } catch (InterruptedException ex) {
                    // ignore
                if (cancelled) {
                    break;
        public int getProgress() {
            return progress;
        public void setProgress(int progress) {
            this.progress = progress;
    }in my class/jarloader code, something like this is done:
    public void load() {
      ProgressMonitorBean monitor = (ProgressMonitorBean)Spin.off(new ProgressMonitorBeanImpl(null, "Loading " + url,"", 0, jarSize));
      Thread t = new Thread() {
        public void run() {
          JarEntry zip = input.getNextJarEntry();
          for (;zip != null;) {
            // misc file handling here... progress = current bytes read
         monitor.setProgress(progress);
      t.start(); // fire off loadin into own thread to do time consuming work
      monitor.start(); // this will spin events on monitor and block until progress = max
      monitor.cancel(); // Just make sure ProgressMonitor is closed
    }The beautiful thing here is that Spin is taking care of weither the load() is inside the dispatch thread or not, making the code much simpler and cleaner to understand.
    The ProgressMonitorBeanImplementation could been made much nicer and more complete, but I was in a hurry to check if it worked out. And it did! This will be applied on a lot of gui -components that blocks the event-queue in our project, making it much more responsive.
    Hope this will help others in similiar situations! Thanks again svenmeier for pointing me to the spin -project.

  • Delphi  7 - UI API Event pVal problem

    Dear community,
    I've setup the UI API in Delphi 7 by using the generated SAPbouiCOM_TLB, most seem to work but I have a blocking problem with the eventhandling of the UI API. The pVal parameters are not passed correctly back by the event and, when accesed, cause access violations.
    There are some other threads about this problem.
    There are two answers given:
    1: Use another program then Delphi which is not an option for me.
    2: Change the parameters to Olevariants. This is what I am trying to do.
    I changed the class names in SAPbouiCOM_TLB to prevent naming problems
    TApplicationItemEvent --> TSUI_ApplicationItemEvent
    I changed my procedure declaration
    from:
    procedure SBO_Application_ItemEvent(ASender: TObject;
                                        const FormUID: WideString;
                                        var pVal: IItemEvent;
                                        out BubbleEvent: WordBool) of object;
    to:
    procedure SBO_Application_ItemEvent(ASender: TObject;
                                        const FormUID: OleVariant;
                                        var pVal: OleVariant;
                                        out BubbleEvent: OleVariant);
    This has to be changed in SAPbouiCOM_TLB to so I did
    from:
    TSUI_ApplicationItemEvent = procedure(ASender: TObject; const FormUID: WideString;
                                          var pVal: IItemEvent;
                                          out BubbleEvent: WordBool) of object;
    to:
    TSUI_ApplicationItemEvent = procedure(ASender: TObject; const FormUID: OleVariant;
                                          var pVal: OleVariant;
                                          out BubbleEvent: OleVariant) of object;
    Now the only thing there has to be done is changing the typecasting in TSUI_Application.InvokeEvent.
    Here a TVariantArray is converted to the WideString, IItemEvent and WordBool.
    And here is my problem. I don't know how to change this typecasting to OleVariants.
    procedure TApplication.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
    begin
      case DispID of
        -1: Exit;  // DISPID_UNKNOWN
        100: if Assigned(FOnItemEvent) then
             FOnItemEvent(Self,
                          Params[0] {const WideString},
                          IItemEvent((TVarData(Params[1]).VPointer)^) {var IItemEvent},
                          WordBool((TVarData(Params[2]).VPointer)^) {out WordBool});
    How do I change IItemEvent((TVarData(Params[1]).VPointer)^) to the correct way?
    Thanks in advance,
    Sandra

    Hi
    I've got the Same Problem
    Has Anyone Fixed this problem.. Running Delphi 7 with SAP SBO 8.81 with the UI

  • What is Event queue problem?

    HI,
    I have come across JSF document, they mentioned that Event queue
    Problem ins SUN's JSF implementation. what is that?

    You're going to have to be a little more specific.

  • GUI event handling problems appear in 1.4.1 vs. 1.3.1?

    Hi,
    Has anyone else experienced strange event handling problems when migrating from 1.3.1 to 1.4.1? My GUI applications that make use of Swing's AbstractTableModel suddenly don't track mouse and selection events quickly anymore. Formerly zippy tables are now very unresponsive to user interactions.
    I've run the code through JProbe under both 1.3 and 1.4 and see no differences in the profiles, yet the 1.4.1 version is virtually unusable. I had hoped that JProbe would show me that some low-level event-handling related or drawing method was getting wailed on in 1.4, but that was not the case.
    My only guess is that the existing installation of 1.3.1 is interfering with the 1.4.1 installation is some way. Any thoughts on that before I trash the 1.3.1 installation (which I'm slightly reluctant to do)?
    My platform is Windows XP Pro on a 2GHz P4 with 1GB RAM.
    Here's my test case:
    import javax.swing.table.AbstractTableModel;
    import javax.swing.*;
    import java.awt.*;
    public class VerySimpleTableModel extends AbstractTableModel
    private int d_rows = 0;
    private int d_cols = 0;
    private String[][] d_data = null;
    public VerySimpleTableModel(int rows,int cols)
    System.err.println("Creating table of size [" + rows + "," + cols +
    d_rows = rows;
    d_cols = cols;
    d_data = new String[d_rows][d_cols];
    int r = 0;
    while (r < d_rows){
    int c = 0;
    while (c < d_cols){
    d_data[r][c] = new String("[" + r + "," + c + "]");
    c++;
    r++;
    System.err.println("Done.");
    public int getRowCount()
    return d_rows;
    public int getColumnCount()
    return d_cols;
    public Object getValueAt(int rowIndex, int columnIndex)
    return d_data[rowIndex][columnIndex];
    public static void main(String[] args)
    System.err.println( "1.4..." );
    JFrame window = new JFrame();
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    Dimension size = new Dimension(500,500);
    panel.setMinimumSize(size);
    panel.setMaximumSize(size);
    JTable table = new JTable(new VerySimpleTableModel(40,5));
    panel.add(table);
    window.getContentPane().add(panel);
    window.setSize(new Dimension(600,800));
    window.validate();
    window.setVisible(true);
    Thanks in advance!!
    - Dean

    Hi,
    I've fixed the problem by upgrading to 1.4.1_02. I was on 1.4.1_01.
    I did further narrow down the symptoms more. It seemed the further the distance from the previous mouse click, the longer it would take for the table row to highlight. So, clicking on row 1, then 2, was much faster than clicking on row 1, then row 40.
    If no one else has seen this problem -- good! I wouldn't wish the tremendous waste of time I've had on anyone!
    - Dean

  • Labview slider event handling problems - revisited

    This topic asked a question that was very close to a problem I am having:
    Labview slider event handling problems
    That is, how do I, using an event structure and/or other means, only read out the value of a slider control after the value change is finalized?
    The extra constraint I'd like to place on this, which I believe will invalidate the answer given in the thread above, is that my slider control also has a digital display which can also be used to change the value without ever using the mouse. I cannot look for a value change followed by a mouse-up event if the mouse was not used to change the value.
    Any ideas how this might be accomplished? FWIW, I am using LabVIEW 7.0

    Each and every incremental value-change event generated by the movement of the slider is still detected and queued up for use by the event structure and the event structure loop wades through them all before it's done.
    I have come up the attached "fix" (LV v7.0) for this problem. While it is not as clean a solution as I had hoped it would be, it's the best I can manage given what LabVIEW offers me to work with and it does work in the situation where I need to use it.
    Now, within the Finalize Slider Events subVI, I'm keeping track of the most-recent values seen by the subVI, checking to see if they have changed, and reporting out that fact. That gives me a Changed/Not-Changed bit within the event case that I can use to control what code then gets executed. If the event case is just playing catch-up to the real value of the control, I can now see that fact and ignore it.
    In this version I've also dumped the variant output and limited the VI to using DBL values. I decided it added complication to something that was too complicated already and I wanted the output terminals for other purposes anyway (reporting of the correct "OldVal" of the control).Message Edited by Warren Massey on 04-28-2005 03:56 AM
    Attachments:
    slider_events[5].llb ‏77 KB

  • JOptionPane blocking problem

    I have the following code in my 1.4.1 applet:
    int response = JOptionPane.showConfirmDialog(NewJabber.mainFrame,"Receive message from unregistered user: "+jid.getName()+" over the "+JID.SHOWNAMES[jid.getHostType()]+" transport. Accept and add user to roster?","Message Received",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE);
    if(response == JOptionPane.YES_OPTION){
    The dialog seems to work like a charm, but after it's been open for about 3 seconds, it somehow enters an infinite loop because IE starts to use 100% of my processor. I don't want users to have their computer DRASTICALLY slow until they respond to the dialog.(which does work and stops the processor usage)
    this only seems to be a problem with showConfirmDialog(). The following code works fine and so do my classes that extend JDialog.
    public static String getInput(String show){
    return JOptionPane.showInputDialog(show);
    }

    I assume you mean: JOptionPane.showConfirmDialog(this, ...)
    problem is that 'this' isn't a Component.

  • JOptionPane.showMessageDialog BLOCKS my application

    ohhhhhhhh, this one drives me crazy.
    The code below will show the message "msg: 884R, Chcek your account!" when the user log to the system.
    THE PROBLEM: say the user activate the application and recieved this message, and then he switches to a different application (e.g, IE) and returns to the application - HE DOESN'T SEE THE MESSAGE, hence, the application is BLOCKED!!! :-(
    ANYONE???!?!?!
    if (secDB.pendingUsers())
    Component c = SwingUtilities.getRoot((Component)e.getSource());
    JFrame parentFrame = (JFrame)c;                              JOptionPane.showMessageDialog(parentFrame, "msg: 884R, Chcek your account!");
    }

    It works for meimport java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test3 extends JFrame {
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        JButton jb = new JButton("Show Optionpane");
        content.add(jb, BorderLayout.SOUTH);
        jb.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            JOptionPane.showMessageDialog(SwingUtilities.getRoot((Component)ae.getSource()),
                                          "This is a message");
        setSize(300,300);
        setVisible(true);
      public static void main(String[] args) { new Test3(); }
    }

  • MT100 Header Blocks problem

    Hello expert,
    I have a problem in MT100 generation.
    File is generated with the correct payment information but I don't have headr block i mean tags 01, 02, 03, 04, 05, 06 and 07.
    There is an option that i should set to print also header block?
    Thank you in advance.

    Thank you Gaurav.
    I checked all MF of all events. There is no tags 1,2..7. In the event 30, the MF creates tags 20 until 72.
    The bank sent me the file format MT100 expected. There are two blocks: header Block  (Tag from 1 to 7) and payment information  block  (Tag from 20 to 72). I have no problem with the payment  block is what generate SAP and i found those tags in event 30.
    by cons I do not know how to enable the generation of header block?
    1- This block could be generated by standard SAP ? What i must to set?
    2- Or i must use MF to add myself this header block? (Specific dev)
    Just for information, header block is like that:
    :01:  Refrence    --> YYMMDDNN when NN is the file number --> Mandatory for the bank
    :02: Total amount                                                                      --> Mandatory for the bank
    :03: No orders                                                                          --> Mandatory for the bank
    :04: Paying Bank --> SWIFT                                                     --> Mandatory for the bank
    :05: Ordering party --> Ordering party name and adress       --> Mandatory for the bank
    :06: User No --> User No at the paying bank                         -->optional
    :07: File name                                                                         -->optional
    Thank you very much for your help.

  • JTable Awt -Event Queue problem

    Hi
    I've been looking everywhere for a solution to this, but can't seem to find one. I've got a JTable with an underlying model that is being continuously updated (every 100ms or so). Whenever I try to sort the JTable using TableRowSorter while the model is being added to I get
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
    at java.util.Vector.elementAt(Vector.java:430)
    at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:277)
    I don't understand this as in my custom table model I've added the fireTableChanged etc. in a SwingUtilities.invokeLater( ...) thread.
    Has anyone else encountered this problem and found a solution? I'd be really grateful!
    Thanks

    Hi
    Thanks for responding, I'm still a little confused. I've posted the code below for both the JTable and the TableModel. The tablemodel simply gets values from a vector which is being dynamically updated from outside the table - but whenever the vector is added to
    The problem seems to only occur when I press the column header to sort the tables during the updates. My understanding is that the method refresh() should create a threadsafe update of the table - but somehow it refreshes the binding to the tablemodel and during this time the table returns a defaulttablemodel that doesn't correspond to the actual underlying data....I thought this kind of problem would be solved by invoking all updates on the swing event thread, but it seems to still produce the effect and I'm stumped!!
    (The data is in an array called turns, and the addElement() in another class calls the refresh() method)
    many thanks, in the hope that someone has the kindness and and benevolence to wade through the following code!
    public class JContiguousTurnsListTable extends JTable {
    private JContiguousTurnsListTableModel jctltm;
    public JContiguousTurnsListTable(Conversation c) {
    super();
    jctltm = new JContiguousTurnsListTableModel(this,c);
    this.setModel(jctltm);
    setSize();
    //this.setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);
    //this.setAutoCreateRowSorter(true);
    TableRowSorter <TableModel> sorter = new TableRowSorter <TableModel>(jctltm);
    //sorter.setSortsOnUpdates(true);
    this.setRowSorter(sorter);
    System.err.println("Setting up ");
    private void setSize(){
    TableColumn column = null;
    for (int i = 0; i <11; i++) {
    column = this.getColumnModel().getColumn(i);
    if(i==1||i==2||i==3||i==4||i==8||i==9){
    column.setPreferredWidth(50);
    else if (i==0||i==5){
    column.setPreferredWidth(180);
    else if (i == 6) {
    column.setPreferredWidth(150);
    else if(i==10){
    column.setPreferredWidth(250);
    else
    column.setPreferredWidth(100);
    //column.setPreferredWidth(100);
    //column.setMinWidth(100);
    //column.setMaxWidth(100);
    public String getColumnName(int column){
    return jctltm.getColumnName(column);
    public void refresh(){
    this.jctltm.refresh();
    ----------------And the table model:
    public class JContiguousTurnsListTableModel extends AbstractTableModel {
    private Conversation c;
    public JContiguousTurnsListTableModel(JTable jt,Conversation c) {
    super();
    this.c=c;
    public void refresh(){
    //System.out.println("Refresh");
    SwingUtilities.invokeLater(new Runnable(){public void run(){fireTableDataChanged();fireTableStructureChanged();} });
    public boolean isCellEditable(int x, int y){
    return false;
    public String getColumnName(int column){
    if(column==0){
    return "Sender";
    else if(column==1){
    return "Onset";
    else if (column==2){
    return "Enter";
    else if(column ==3){
    return "E - O";
    else if(column ==4){
    return "Speed";
    else if(column ==5){
    return "Spoof Orig.";
    else if(column ==6){
    return "Text";
    else if(column ==7){
    return "Recipients";
    else if(column ==8){
    return "Blocked";
    else if(column ==9){
    return "Dels";
    else if(column ==10){
    return "TaggedText";
    else if(column ==11){
    return "ContgNo";
    else if(column ==12){
    return "Inconcistency";
    else{
    return " ";
    public Object getValueAt(int x, int y){
    try{ 
    //System.out.println("GET VALUE AT "+x+" "+y);
    Vector turns = c.getContiguousTurns();
    if(x>=turns.size())return " ";
    ContiguousTurn t = (ContiguousTurn)turns.elementAt(x);
    if(y==0){
    return t.getSender().getUsername();
    else if(y==1){
    return t.getTypingOnset();
    else if(y==2){
    return t.getTypingReturnPressed();
    else if(y==3){
    return t.getTypingReturnPressed()-t.getTypingOnset();
    else if(y==4){
    long typingtime = t.getTypingReturnPressed()-t.getTypingOnset();
    if(typingtime<=0)return 0;
    return ((long)t.getTextString().length())/typingtime;
    else if(y==5){
    return t.getApparentSender().getUsername();
    else if(y==6){
    return t.getTextString();
    else if(y==7){
    //System.out.println("GETTINGRECIP1");
    Vector v = t.getRecipients();
    String names ="";
    // System.out.println("GETTINGRECIP3");
    for(int i=0;i<v.size();i++){
    Conversant c = (Conversant)v.elementAt(i);
    // System.out.println("GETTINGRECIP4");
    names = names+", "+c.getUsername();
    // System.out.println("GETTINGRECIP5");
    return names;
    else if (y==8){
    if (t.getTypingWasBlockedDuringTyping())return "BLOCKED";
    return "OK";
    else if(y==9){
    return t.getNumberOfDeletes();
    else if(y==10){
    String returnText="";
    Vector v = t.getWordsAsLexicalEntries();
    for(int i=0;i<v.size();i++){
    LexiconEntry lxe= (LexiconEntry)v.elementAt(i);
    returnText = returnText+lxe.getWord()+" ("+lxe.getPartOfSpeech()+") ";
    return returnText;
    else if(y==11){
    return t.getNumberOfTurns();
    else if(y==12){
    // System.out.println("CONTIGUOUS1");
    String value ="";
    boolean hasSameRecipients = t.getTurnsHaveSameRecipients();
    boolean hasSameApparentOrigin = t.getTurnsHaveSameApparentOrigin();
    if (hasSameRecipients&hasSameApparentOrigin){
    value = "OK";
    else if (hasSameRecipients&!hasSameApparentOrigin){
    value = "Diff. O";
    else if(!hasSameRecipients&hasSameApparentOrigin){
    value = "Diff. Recip";
    else {
    value = "Diff O&R";
    //System.out.println("CONTIGUOUS2");
    return value;
    return " ";
    }catch (Exception e){
    return "UI ERROR";
    public Class getColumnClass(int column) {
    Class returnValue;
    if ((column >= 0) && (column < getColumnCount())) {
    returnValue = getValueAt(0, column).getClass();
    } else {
    returnValue = Object.class;
    return returnValue;
    public int getRowCount(){
    return this.c.getContiguousTurns().size();
    public int getColumnCount(){
    return 13;
    }

  • BAPI inside WF event trigger problem

    Hi Guys,
    Here's my problem:
    I'm triggering a WF from the Business objects BUS2032, event CHANGED (for sales orders). But the first step in the workflow is to block the order for delivery, so I'm using the BAPI BAPI_SALESORDER_CHANGE to modify the field delivery block of that sales order.
    The problem is that when the BAPI is executed, the event CHANGED from the BO BUS2032 is triggered, so the WF is triggered again, and so on...it's like a loop.
    So my question is, is there a way to modify the sales order inside the WF without triggering any event inside the WF?
    Thanks!

    Hi MatiasAZ,
      Change standard code to not trigger the event is not recommended.
      Alternatively,You can put a check in your workflow to complete itself if there is another workflow is running for the same sales order.
       Or you can also put filter function module on the event linkage via transaction SWETYPV not to trigger the event if there is a workflow running for that sales order.
      Transaction SWI6 can tell you that any workflow with specific object is running.
    Chaiphon

  • Button event handler problem

    Hello,
    I need to add an Event handler to a button on my JSP page. The page refreshes very three seconds for other use.
    First, I added the following segment to the page.
    <head>
    <title>Event handler test</title>
    <script type="text/javascript">
    <!--
    function funAdd()
    alert("Your name is already in the list.");
    //-->
    </script>
    <meta http-equiv="refresh" content="3">
    </head>
    <input type = "button" name = "add" value = "Add" onclick="funAdd()" />
    Every time I clicked the Add button, the alert message appeared. It showed the expected result.
    Then, I replaced alert("Your name is already in the list."); with
    <%
    JOptionPane.showMessageDialog(null, "Your name is already in the list.", "Error message", JOptionPane.ERROR_MESSAGE);
    %>
    in funAdd().
    But, the error message showed automatically every three seconds when the page refreshed without clicking the Add button.
    Does any one know the reason, and how to solve the problem?
    Thanks in advance.
    Dan

    You said it yourself, you refresh your page each 3 seconds so each 3 seconds you do a request to your server where you show a messagedialog.

  • Glasspane event handling problem when window is deactivated - activated

    Hello everyone!
    I have a strange problem concerning glasspane used to block user input. The situation is the following:
    I use a JDesktopPane inside a JFrame. In the desktop pane there are placed multiple JInternalFrames. I use a JPanel as glasspane with dummy listeners to block the controls in one of the internal frames. This all works without problems.
    Now if the JFrame becomes inactive (for example the user switches to a browser window) and the I go back to the java application (frame becoming active again), the blocking no longer works. This also happens if a JDialog pops up - so in general this happens if the DesktopPanes host window becomes inactive and active again.
    The glass pane is still there (see it as it is translucent coloured), gets the events (I can see this from debug output in the dummy listeners) but also the controls underneath the glass panes do react now to user input.
    I already tried to watch the JFrame with a WindowListener and reinstall (a new) glass pane when it becomes active again - no effect. Now I am really helpless - maybe there is something very obvious I am doing wrong?
    I appreciate any hint :-) Thank you in advance!

    New problem :-) Also this worked to block the user input, I now get these:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicInternalFrameUI$Handler.forwardMouseEvent(BasicInternalFrameUI.java:1375)
         at javax.swing.plaf.basic.BasicInternalFrameUI$Handler.mouseEntered(BasicInternalFrameUI.java:1327)
         at java.awt.Component.processMouseEvent(Component.java:5497)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4017)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3874)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Exceptions when I open another JInternalFrame afterwards and then move the mouse into the first internal frame (whose input was blocked by twith the button on glasspane) area.
    Any ideas?

  • JOptionPane, EventQueue & WToolkit Problem

    I have a swing 1.2 application where I have a customized EventQueue which checks to see how long something proceses. If the event is too long, it turns the cursor to an hourglass and then turns it back to the default cursor when complete. The problems comes in whenever I have a JOptionPane (and JDialog for that matter).
    If I'm processing a button event and I throw up a JOptionPane to ask a question, I want to continue processing the original button logic. This works fine. However, I notice I get a
    sun.awt.windows.WToolkit object in my SystemEventQueue. I really need to get the component instead so I can set the hourglass. Does anyone have an idea on how to do this? TIA!

    First of all, thanks for taking the time to look at my problem.
    Here's some answers to the previous questions.
    1. The hourglass cursor is displayed until the JOptionPane or JDialog is displayed. Then the default cursor is displayed. Once a user clicks on a yes/no/cancel button, my program will do some tasks like updating and reading records. During this updating and reading process, I want to display the hourglass. Since I know I get an object back to the event queue, I can time the actions and set the cursor - well, in every case but JOptionPane & JDialog. I really hate the thought of having to code the cursor logic in every method that calls a JOptionPane/JDialog. Just goes against the grain. There has to be a better way.
    2. Usually, I get component objects sent back to the event queue. However, whenever a JDialog or JOptionPane is displayed, I get a WToolkit object. I have no idea why. Anything else will send back components like the button,etc.
    FYI... my event queue is very similar to the one listed in Java World Tip #87 (see link http://www.javaworld.com/javatips/jw-javatip87.html). I just modified it to use a glasspane.

  • Appraisals & training and event management problem

    Hi gurus.
    I'm trying to configured the integration between Appraisal and Training & Event management (Appraising a Business Event and Attendee Appraisal
    I set an attribute HAP00 REPLA = A .
    But two problems occurred.
    1.
    The definition of Appraisal catalog for employees is no problem. But I have a problem with definition of Appraisal catalog for Business event and for Attendees.
    Through the definition of Appraisal catalog via SPRO (Training and Event Management/Recurring Activities/Appraisals/Edit Appraisals Catalog) its possible to create an appraisal templates only for employees (it looks like that, because there is only Category group Personnel Appraisals and it’s not possible to add new category for example Attendee Appraisal).
    Can somebody help me where I can define appraisal templates for Event management or how can I get the Appraisal catalog category groups - Appraising a Business Event and Attendee Appraisal?
    2.
    I set the attributes SEMIN EVAEV/EVAPA to the values 2/3 in connection with table T77BF.
    When I run tcode PV33 or PV34 the matchcode of appraisal templates contains the list of all object type VA. The problem is that when I run tcode PV33 I don’t want to see all appraisal templates, but only for appraising a Business Event.
    It is possible to configure that so? If yes, how.
    Thanks in advance.
    Regards

    Hi,
    1. transaction LSO_CATALOG
    Regards and Groetjes,
    Maurice Hagen

Maybe you are looking for

  • One track is always truncated when I try to import

    This is the weirdest thing. I am running iTunes 7.7 on my MacBook, although this problem appears to have occurred ages ago when I originally ripped this CD. It's a store-bought classical CD, which I very much like. When I put it in the drive, it show

  • Change Tab Description

    Dear Friend,            I add one Customize Tab in Purchase order using user exit on item level but the name (Description) of that tab its showing 'Customer Data' . that description how we can change ?. Thanks in advance.

  • Cisco Agent Error - 'A referral was returned from the server.'

    Running agent 8.0.2.9 on Windows 7. I have one person that is having trouble launching the agent software. They are getting a popup that says, 'A referral was returned from the server.' As of yesterday they were having no issues. So fare we have trie

  • Rounding a float to an integer in this program

    Hello, I would like to be able to use floats in this program. If i input say 50.5 at the moment i get an error (the program compiles ok). What I want to happen is that i enter say 50.5, the program rounds this to 51 and then uses 51 thus not getting

  • Interface controller example

    I created simple example of interface controller. I embedded view of used web dynpro component in the main web dynpro component I get the error on deploying : The initial exception that caused the request to fail, was:    java.lang.UnsupportedClassVe