Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

com.dukascopy.api.JFException: Incorrect thread
 Post subject: com.dukascopy.api.JFException: Incorrect thread Post rating: 0   New post Posted: Mon 11 Jun, 2012, 08:02 

User rating: 1
Joined: Fri 04 May, 2012, 21:03
Posts: 5
Hi support,

I prepare this code

public class Position{      
        public IOrder Order;
        public IHorizontalLineChartObject StopLine;
        public double TempTakeProfit;
        public double StopDistance;
        public int offset;
        public double target;
        public double stop;
        public double pl;
        private JPanel myTab;
        public Position(IOrder order, JPanel tab, int defaultoffset, double defaulttarget, double defaultstop){
                Order=order;
                StopLine=null;
                pl=0;
                offset=defaultoffset;
                target=defaulttarget;
                stop=defaultstop;
                setTab(tab,defaultoffset,defaulttarget,defaultstop);
        }   
        public Position(IOrder order){
                Order=order;
                StopLine=null;
                pl=0;
                offset=0;
                target=0;
                stop=0;
                myTab=null;         
        }   
        public Boolean HasTab(){
            return myTab!=null;   
        } 
        public void setTab(JPanel tab, int defaultoffset, double defaulttarget, double defaultstop){
            try{
                myTab=tab;
                JLabel lblOffset= new JLabel("Offset (in pips)");
                final JTextField txtOffset=new JTextField(Integer.toString(defaultoffset));
                JLabel lblTarget= new JLabel("TargetProfit (in pips)");
                final JTextField txtTarget=new JTextField(Double.toString(defaulttarget));
                JLabel lblStop= new JLabel("CumulativeStop (in pips)");
                final JTextField txtStop=new JTextField(Double.toString(defaultstop));
                JButton btnSubmit = new JButton("Submit");
                JButton btnClose=new JButton("Close");
                myTab.add(lblOffset);
                myTab.add(txtOffset);
                myTab.add(lblTarget);
                myTab.add(txtTarget);
                myTab.add(lblStop);
                myTab.add(txtStop);
                myTab.add(btnSubmit);
                myTab.add(btnClose);
                btnSubmit.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    offset=Integer.parseInt( txtOffset.getText());
                    target=Double.parseDouble(txtTarget.getText());
                    stop=Double.parseDouble(txtStop.getText());
                    console.getInfo().println("Submit: offset"+txtOffset.getText()+"; target " + target +"; stop " + stop);
                }
                });
                btnClose.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    if(StopLine!=null){
                        DeletePriceLine(Order.getInstrument(),StopLine);       
                    }
                    String id=Order.getId();
                    if(Order!=null){
                        try{
                            Order.close();   
                        }catch(JFException ex){
                            console.getInfo().println("btnClose: errore: "+ex);   
                        }
                    }
                    userInterface.removeBottomTab(id);
                }
                });
            }
            catch(Exception e){
                console.getInfo().println("Position: errore: "+e);   
            }
               
        }
    }


When I press on close button i have this error:

com.dukascopy.api.JFException: Incorrect thread

What is wrong?

Thank's


 
 Post subject: Re: com.dukascopy.api.JFException: Incorrect thread Post rating: 0   New post Posted: Mon 11 Jun, 2012, 11:31 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please see this post https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=65&t=45527&p=59612&hilit=Incorrect+thread#


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com