• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] open dialog box for file chooice

#1 2009-02-26 16:14:47

kzone
Member
Company: Synotis
Registered: 2008-07-06
Posts: 911
Website

[resolved] open dialog box for file chooice

hi,

I've to let the choice to user for a file !
So I've tried a simple JFrame with JfileChooser object in a routine call by tjavaflex ...

But I haven't got the time to choice anything smile
The frame still open a very short time to disappear ...

problem of thread !??
I'm not enought java coder to find the reason why !!

here the code :

Code:

public class FileChooser extends JFrame implements ActionListener{
    private JButton bouton = null;
    private JPanel panel = null;
    private String thePath = null;
    
    public FileChooser(){
        panel = new JPanel();
        bouton = new JButton();
        
        panel.setLayout(new FlowLayout());
        bouton.addActionListener(this);

        this.setVisible(true);
        this.setSize(new Dimension(400,200));
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
    }


    public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub
        Object source = e.getSource();
        JFileChooser chooser = new JFileChooser();
        File theFile = null;
        
        if(source == bouton){
            int returnVal = chooser.showOpenDialog(this);
            if(returnVal == JFileChooser.APPROVE_OPTION){
                theFile = chooser.getSelectedFile();
            }
        }
        
        thePath =  theFile.toURI().toString();
    }
    
    public String getPath(){
        return thePath;
    }
}

Hope it's not too long !
Why frame close just as it open !??

thanks for your help or suggestion


do Svg your graphical language !!!

Offline

#2 2009-02-27 11:49:22

kzone
Member
Company: Synotis
Registered: 2008-07-06
Posts: 911
Website

Re: [resolved] open dialog box for file chooice

any idea so !?

I've tested by launching job like a script (.sh) ... but no more time to hope clicling on anything smile

stay and wait for any suggestion (except do not smile

++


do Svg your graphical language !!!

Offline

#3 2009-02-27 16:46:34

kzone
Member
Company: Synotis
Registered: 2008-07-06
Posts: 911
Website

Re: [resolved] open dialog box for file chooice

try with JOPtionPanel ( have a look on wich class is used on tMsgBox ) in a routines !

Can have a dialog box .... and still open
Just have to add a jfilechooser ...!!

more just play with Talend than work with it ! smile


do Svg your graphical language !!!

Offline

#4 2010-01-14 15:19:35

Ximeroni
New member
Company: NEXE Grupa
Registered: 2009-11-30
Posts: 4

Re: [resolved] open dialog box for file chooice

Use component tJavaFlex.

Under Advanced settings enter: import javax.swing.JFileChooser;

Under Basic settings you can add code like:

      JFileChooser chooser = new JFileChooser();
      chooser.showOpenDialog(null);

Offline

#5 2010-01-14 15:37:42

kzone
Member
Company: Synotis
Registered: 2008-07-06
Posts: 911
Website

Re: [resolved] open dialog box for file chooice

hi

and thanks for your reply.

On the other hand there is a excellent and helpfully component on Talend Exchange.

Regards
laurent


do Svg your graphical language !!!

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] open dialog box for file chooice

Board footer

Powered by FluxBB