:- use_module(library(jpl)).

jpl_jlist_demo :-
    jpl_new('javax.swing.JFrame', ['modules'], F),
    jpl_new('javax.swing.DefaultListModel', [], DLM),
    jpl_new('javax.swing.JList', [DLM], L),
    jpl_call(F, getContentPane, [], CP),
    jpl_call(CP, add, [L], _),
    (       current_module(M),
            jpl_call(DLM, addElement, [M], _),
            fail
    ;       true
    ),
    jpl_call(F, pack, [], _),
    jpl_call(F, getHeight, [], H),
    jpl_call(F, setSize, [150,H], _),
    jpl_call(F, setVisible, [@(true)], _).


% this directive runs the above demo

:- jpl_jlist_demo.

