Example usage for weka.gui PropertyDialog PropertyDialog

List of usage examples for weka.gui PropertyDialog PropertyDialog

Introduction

In this page you can find the example usage for weka.gui PropertyDialog PropertyDialog.

Prototype

public PropertyDialog(Frame owner, PropertyEditor pe, int x, int y) 

Source Link

Document

Creates the editor dialog at the given position.

Usage

From source file:meka.gui.goe.GenericObjectEditor.java

License:Open Source License

/**
 * For testing only./*  w  w w.  j  a  v a  2 s  .c  o m*/
 *
 * @param args   ignored
 */
public static void main(String[] args) {
    Project.initialize();
    try {
        registerAllEditors();
        GenericObjectEditor ce = new GenericObjectEditor(true);
        ce.setClassType(MultiLabelClassifier.class);
        Object initial = new meka.classifiers.multilabel.BR();
        if (args.length > 0) {
            ce.setClassType(Class.forName(args[0]));
            if (args.length > 1) {
                initial = Class.forName(args[1]).newInstance();
                ce.setValue(initial);
            } else {
                ce.setDefaultValue();
            }
        } else {
            ce.setValue(initial);
        }

        PropertyDialog pd = new PropertyDialog((Frame) null, ce, 100, 100);
        pd.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                PropertyEditor pe = ((PropertyDialog) e.getSource()).getEditor();
                Object c = pe.getValue();
                String options = "";
                if (c instanceof OptionHandler)
                    options = Utils.joinOptions(((OptionHandler) c).getOptions());
                System.out.println(c.getClass().getName() + " " + options);
                System.exit(0);
            }
        });
        pd.setVisible(true);
    } catch (Exception ex) {
        ex.printStackTrace();
        System.err.println(ex.getMessage());
    }
}