Example usage for javax.swing JList JList

List of usage examples for javax.swing JList JList

Introduction

In this page you can find the example usage for javax.swing JList JList.

Prototype

public JList(final Vector<? extends E> listData) 

Source Link

Document

Constructs a JList that displays the elements in the specified Vector.

Usage

From source file:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java

public COSMOSACDialog() {
    super("JCOSMO Simple");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLayout(new BorderLayout());

    db = COSMOSACDataBase.getInstance();

    COSMOSAC models[] = new COSMOSAC[5];
    models[0] = new COSMOSAC();
    models[1] = new COSMOPAC();
    models[2] = new COSMOSAC_SVP();
    models[3] = new COSMOSAC_G();
    models[4] = new PCMSAC();
    modelBox = new JComboBox(models);
    modelBox.addActionListener(this);

    JPanel north = new JPanel(new GridLayout(0, 2));
    add(north, BorderLayout.NORTH);
    JPanel northAba1 = new JPanel(new GridLayout(0, 4));
    JPanel northAba2 = new JPanel(new GridLayout(0, 2));

    //Where the GUI is created:
    JMenuBar menuBar;/* www .jav a 2 s  .co  m*/
    JMenu file, help;
    JMenuItem menuItem;

    //Create the menu bar.
    menuBar = new JMenuBar();

    // the file menu
    file = new JMenu("File");
    file.setMnemonic(KeyEvent.VK_F);
    menuBar.add(file);
    menuItem = new JMenuItem("Quit", KeyEvent.VK_Q);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));
    menuItem.setActionCommand(QUIT);
    menuItem.addActionListener(this);
    file.add(menuItem);

    // the help menu
    help = new JMenu("Help");
    file.setMnemonic(KeyEvent.VK_H);
    menuBar.add(help);
    menuItem = new JMenuItem("About", KeyEvent.VK_A);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    menuItem.setActionCommand(ABOUT);
    menuItem.addActionListener(this);
    help.add(menuItem);

    setJMenuBar(menuBar);

    listModel = new DefaultListModel();
    list = new JList(listModel);
    list.setBorder(BorderFactory.createTitledBorder("compounds"));
    list.setVisibleRowCount(2);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane listScrollPane = new JScrollPane(list);

    JButton addButton = new JButton("Add");
    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new AddCompoundDialog(COSMOSACDialog.this);
        }
    });

    removeButton = new JButton("Remove");
    removeButton.addActionListener(this);
    visibRemove(false);

    JButton calcButton = new JButton("Calculate");
    calcButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rebuildChart();
            rebuildSigmaProfiles();
        }
    });

    JButton refreshButton = new JButton("Refresh");
    refreshButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rebuildSigmaProfiles();
        }
    });

    ignoreSGButton = new JCheckBox("Ignore SG");
    ignoreSGButton.setToolTipText("Toogles the ignore flag for the Staverman-Guggenheim term");
    ignoreSGButton.addActionListener(this);

    JPanel but = new JPanel(new GridLayout(0, 1));
    but.add(addButton, BorderLayout.EAST);
    but.add(removeButton, BorderLayout.EAST);
    but.add(modelBox);
    north.add(listScrollPane);
    north.add(but);

    northAba1.add(new JLabel("Temperature [K]"));
    northAba1.add(temperature = new JTextField(10));
    temperature.setText("298");

    northAba1.add(new JLabel("Sigma HB"));
    northAba1.add(sigmaHB = new JTextField(10));
    northAba1.add(new JLabel("Sigma HB2"));
    northAba1.add(sigmaHB2 = new JTextField(10));
    northAba1.add(new JLabel("Sigma HB3"));
    northAba1.add(sigmaHB3 = new JTextField(10));

    northAba1.add(new JLabel("Charge HB"));
    northAba1.add(chargeHB = new JTextField(10));

    northAba1.add(new JLabel("Sigma Disp"));
    northAba1.add(sigmaDisp = new JTextField(10));
    northAba1.add(new JLabel("Charge Disp"));
    northAba1.add(chargeDisp = new JTextField(10));

    northAba1.add(new JLabel("Beta"));
    northAba1.add(beta = new JTextField(10));
    northAba1.add(new JLabel("fpol"));
    northAba1.add(fpol = new JTextField(10));
    northAba1.add(new JLabel("Anorm"));
    northAba1.add(anorm = new JTextField(10));

    northAba1.add(ignoreSGButton);
    northAba1.add(calcButton);
    northAba2.add(new JLabel(""));
    northAba2.add(refreshButton);

    //      chart = new JLineChart();
    //      add(chart, BorderLayout.CENTER);
    //      chart.setTitle("Gamma Plot");
    //      chart.setSubtitle("");
    //      chart.setXAxisLabel("Mole Fraction, x_1");
    //      chart.setYAxisLabel("ln gamma, gE/RT");
    //      chart.setSource(getTitle());
    //      chart.setLegendPosition(LegendPosition.BOTTOM);
    //      chart.setShapesVisible(true);

    JFreeChart chart = ChartFactory.createXYLineChart(null, "Mole Fraction, x_1", "ln gamma, gE/RT", null,
            PlotOrientation.VERTICAL, true, true, false);
    plot = (XYPlot) chart.getPlot();
    plot.getDomainAxis().setAutoRange(false);
    plot.getDomainAxis().setRange(new Range(0.0, 1.0));

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer();
    r.setUseFillPaint(true);
    r.setBaseFillPaint(Color.white);
    r.setBaseShapesVisible(true);

    JFreeChart sigmaProfileChart = ChartFactory.createXYLineChart(null, "sigma", "P^x", null,
            PlotOrientation.VERTICAL, true, true, false);
    sigmaProfilePlot = sigmaProfileChart.getXYPlot();
    sigmaProfilePlot.getDomainAxis().setAutoRange(false);
    sigmaProfilePlot.getDomainAxis().setRange(new Range(-0.025, 0.025));

    //      sigmaProfilePlot.setBackgroundPaint(Color.lightGray);
    //      sigmaProfilePlot.setDomainGridlinePaint(Color.white);
    //      sigmaProfilePlot.setRangeGridlinePaint(Color.white);

    JFreeChart chartSegGamma = ChartFactory.createXYLineChart(null, "sigma", "Segment Gamma", null,
            PlotOrientation.VERTICAL, true, true, false);
    plotSegGamma = (XYPlot) chartSegGamma.getPlot();

    JPanel south = new JPanel();
    south.setLayout(new FlowLayout());
    south.add(new JLabel("<html>ln &gamma;<sup>&infin;</sup><sub>1</sub>:</html>"));
    south.add(lnGammaInf1Label = new JLabel());
    south.add(new JLabel("<html>ln &gamma;<sup>&infin;</sup><sub>2</sub>:</html>"));
    south.add(lnGammaInf2Label = new JLabel());
    south.add(Box.createHorizontalStrut(20));
    south.add(new JLabel("<html>&gamma;<sup>&infin;</sup><sub>1</sub>:</html>"));
    south.add(gammaInf1Label = new JLabel());
    south.add(new JLabel("<html>&gamma;<sup>&infin;</sup><sub>2</sub>:</html>"));
    south.add(gammaInf2Label = new JLabel());

    JPanel aba1 = new JPanel(new BorderLayout());
    aba1.add(northAba1, BorderLayout.NORTH);
    JPanel chartsPanel = new JPanel(new GridLayout(0, 2));
    aba1.add(chartsPanel, BorderLayout.CENTER);
    chartsPanel.add(new ChartPanel(chart));
    chartsPanel.add(new ChartPanel(chartSegGamma));
    aba1.add(south, BorderLayout.SOUTH);

    JPanel aba2 = new JPanel(new BorderLayout());
    aba2.add(northAba2, BorderLayout.NORTH);
    aba2.add(chartPanel = new ChartPanel(sigmaProfileChart), BorderLayout.CENTER);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("gamma", aba1);
    tabbedPane.addTab("sigma", aba2);
    add(tabbedPane, BorderLayout.CENTER);

    //      cosmosac.setAEffPrime(6.596176570595075);
    //      cosmosac.setCoord(11.614599507917934);
    //      cosmosac.setVnorm(56.36966406129967);
    //      cosmosac.setAnorm(41.56058649432742);
    //      cosmosac.setCHB(65330.19484947528);
    //      cosmosac.setSigmaHB(0.008292411048046008);

    //Display the window.
    setSize(800, 600);
    setLocationRelativeTo(null);
    modelBox.setSelectedIndex(0);
    setVisible(true);

    // test for a mixture
    //      addList("WATER");
    //      addList("H3O+1");
    //      addList("OH-1");
    //      addList("CL-1");
    //      addList("OXYGEN");
    //      addList("sec-butylamine");
    //      addList("hydrogen-fluoride");
    //      addList("ACETONE");
    //      addList("METHANOL");
    //      addList("ACETONE.opt");
    //      addList("METHANOL.opt");
    //      addList("METHYL-ETHYL-KETONE");
    //      addList("ETHANOL");
    //      addList("N-HEPTANE");
    //      addList("PROPIONIC-ACID");
    //      addList("EMIM");
    //      addList("NTF2");
    //      addList("DCA");
    //      addList("N-OCTANE");
    addList("ETHYLENE CARBONATE");
    addList("BENZENE");
    addList("TOLUENE");
    removeButton.setEnabled(true);
}

From source file:fr.eurecom.hybris.demogui.HybrisDemoGui.java

private void initializeGUI() {
    frame = new JFrame("Hybris Demo GUI");
    frame.setIconImage(new ImageIcon(getClass().getResource("/clouds.png")).getImage());
    frame.setBounds(100, 100, 650, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new GridBagLayout());

    JPanel cloudParentPanel = new JPanel(new GridLayout(1, 2, 10, 10));
    JPanel hybrisPanel = new JPanel(new GridBagLayout());
    JPanel cloudsPanel = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;/*from  w w  w .  ja va  2 s .co  m*/
    gbc.weighty = 1.0;
    gbc.insets = new Insets(5, 5, 5, 5);

    gbc.anchor = GridBagConstraints.NORTH;
    gbc.fill = GridBagConstraints.BOTH;

    gbc.gridwidth = 3;
    gbc.gridheight = 1;
    gbc.gridx = 0;
    gbc.gridy = 0;
    hybrisPanel.add(new JLabel("<html><b>Hybris</b></html>"), gbc);

    gbc.gridwidth = 3;
    gbc.gridheight = 3;
    gbc.gridx = 0;
    gbc.gridy = 1;

    lstHybris = new JList<String>(lmHybris);
    lstHybris.setPreferredSize(new java.awt.Dimension(100, 500));
    lstHybris.setMinimumSize(new java.awt.Dimension(100, 440));
    hybrisPanel.add(lstHybris, gbc);

    gbc.anchor = GridBagConstraints.SOUTH;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = 1;
    gbc.gridx = 0;
    gbc.gridy = 4;
    btnPut = new JButton("Put");
    hybrisPanel.add(btnPut, gbc);
    gbc.gridx = 1;
    gbc.gridy = 4;
    btnGet = new JButton("Get");
    hybrisPanel.add(btnGet, gbc);
    gbc.gridx = 2;
    gbc.gridy = 4;
    btnDelete = new JButton("Delete");
    hybrisPanel.add(btnDelete, gbc);

    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    cloudsPanel.add(new JLabel("<html><b>Amazon S3</b></html>"), gbc);

    gbc.gridheight = 2;
    gbc.gridy = 1;
    lstAmazon = new JList<String>(lmAmazon);
    lstAmazon.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lstAmazon.setPreferredSize(new java.awt.Dimension(100, 100));
    cloudsPanel.add(lstAmazon, gbc);

    gbc.gridy = 3;
    gbc.gridheight = 1;
    cloudsPanel.add(new JLabel("<html><b>Microsoft Azure</b></html>"), gbc);

    gbc.gridheight = 2;
    gbc.gridy = 4;
    lstAzure = new JList<String>(lmAzure);
    lstAzure.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lstAzure.setPreferredSize(new java.awt.Dimension(100, 100));
    cloudsPanel.add(lstAzure, gbc);

    gbc.gridy = 6;
    gbc.gridheight = 1;
    cloudsPanel.add(new JLabel("<html><b>Google Cloud Storage</b></html>"), gbc);

    gbc.gridheight = 2;
    gbc.gridy = 7;
    lstGoogle = new JList<String>(lmGoogle);
    lstGoogle.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lstGoogle.setPreferredSize(new java.awt.Dimension(100, 100));
    cloudsPanel.add(lstGoogle, gbc);

    gbc.gridy = 9;
    gbc.gridheight = 1;
    cloudsPanel.add(new JLabel("<html><b>Rackspace Cloud Files</b></html>"), gbc);

    gbc.gridheight = 2;
    gbc.gridy = 10;
    lstRackspace = new JList<String>(lmRackspace);
    lstRackspace.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lstRackspace.setPreferredSize(new java.awt.Dimension(100, 100));
    cloudsPanel.add(lstRackspace, gbc);

    cloudParentPanel.add(hybrisPanel);
    cloudParentPanel.add(cloudsPanel);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    frame.add(cloudParentPanel, gbc);

    gbc.gridx = 0;
    gbc.gridy = 1;
    JTextArea jt = new JTextArea(10, 30);
    JScrollPane scrollPane = new JScrollPane(jt);
    frame.add(scrollPane, gbc);

    PrintStream printStream = new PrintStream(new CustomOutputStream(jt));
    System.setOut(printStream);
    System.setErr(printStream);

    frame.pack();
    frame.setSize(550, 800);
    frame.setResizable(false);

    lstAmazon.addKeyListener(this);
    lstAzure.addKeyListener(this);
    lstGoogle.addKeyListener(this);
    lstRackspace.addKeyListener(this);
    lstHybris.addKeyListener(this);

    lstAmazon.setCellRenderer(this.new MyListRenderer("amazon"));
    lstGoogle.setCellRenderer(this.new MyListRenderer("google"));
    lstAzure.setCellRenderer(this.new MyListRenderer("azure"));
    lstRackspace.setCellRenderer(this.new MyListRenderer("rackspace"));

    btnGet.addActionListener(this);
    btnPut.addActionListener(this);
    btnDelete.addActionListener(this);
}

From source file:net.sourceforge.doddle_owl.ui.InputDocumentSelectionPanel.java

public InputDocumentSelectionPanel(InputTermSelectionPanel iwsPanel, DODDLEProject p) {
    project = p;//from  w  w w.j a  v  a  2s  .com
    inputTermSelectionPanel = iwsPanel;
    termInfoMap = new HashMap<String, TermInfo>();
    stopWordSet = new HashSet<String>();
    docList = new JList(new DefaultListModel());
    docList.addListSelectionListener(this);
    JScrollPane docListScroll = new JScrollPane(docList);
    inputDocList = new JList(new DefaultListModel());
    inputDocList.addListSelectionListener(this);
    JScrollPane inputDocListScroll = new JScrollPane(inputDocList);

    DefaultComboBoxModel docLangBoxModel = new DefaultComboBoxModel(new Object[] { "en", "ja" });
    docLangBox = new JComboBox(docLangBoxModel);
    docLangBox.addActionListener(this);
    addDocButton = new JButton(new AddDocAction(Translator.getTerm("AddDocumentButton")));
    removeDocButton = new JButton(new RemoveDocAction(Translator.getTerm("RemoveDocumentButton")));
    DefaultComboBoxModel inputDocLangBoxModel = new DefaultComboBoxModel(new Object[] { "en", "ja" });
    inputDocLangBox = new JComboBox(inputDocLangBoxModel);
    inputDocLangBox.addActionListener(this);
    addInputDocButton = new JButton(new AddInputDocAction(Translator.getTerm("AddInputDocumentButton")));
    removeInputDocButton = new JButton(
            new RemoveInputDocAction(Translator.getTerm("RemoveInputDocumentButton")));

    inputDocArea = new JTextArea();
    inputDocArea.setLineWrap(true);
    JScrollPane inputDocAreaScroll = new JScrollPane(inputDocArea);

    JPanel docButtonPanel = new JPanel();
    docButtonPanel.setLayout(new BorderLayout());
    docButtonPanel.setLayout(new GridLayout(1, 3));
    docButtonPanel.add(docLangBox);
    docButtonPanel.add(addDocButton);
    docButtonPanel.add(removeDocButton);
    JPanel docPanel = new JPanel();
    docPanel.setLayout(new BorderLayout());
    docPanel.add(docListScroll, BorderLayout.CENTER);
    docPanel.add(docButtonPanel, BorderLayout.SOUTH);

    punctuationField = new JTextField(10);
    punctuationField.setText(PUNCTUATION_CHARS);
    setPunctuationButton = new JButton(Translator.getTerm("SetPunctuationCharacterButton"));
    setPunctuationButton.addActionListener(this);

    JPanel punctuationPanel = new JPanel();
    punctuationPanel.add(punctuationField);
    punctuationPanel.add(setPunctuationButton);

    JPanel inputDocButtonPanel = new JPanel();
    inputDocButtonPanel.setLayout(new GridLayout(1, 3));
    inputDocButtonPanel.add(inputDocLangBox);
    inputDocButtonPanel.add(addInputDocButton);
    inputDocButtonPanel.add(removeInputDocButton);

    JPanel southPanel = new JPanel();
    southPanel.setLayout(new BorderLayout());
    southPanel.add(inputDocButtonPanel, BorderLayout.WEST);
    southPanel.add(punctuationPanel, BorderLayout.EAST);

    JPanel inputDocPanel = new JPanel();
    inputDocPanel.setLayout(new BorderLayout());
    inputDocPanel.add(inputDocListScroll, BorderLayout.CENTER);
    inputDocPanel.add(southPanel, BorderLayout.SOUTH);

    termExtractionButton = new JButton(Translator.getTerm("InputTermExtractionButton"),
            Utils.getImageIcon("input_term_selection.png"));
    termExtractionButton.addActionListener(this);

    genSenCheckBox = new JCheckBox(Translator.getTerm("GensenCheckBox"));
    genSenCheckBox.setSelected(false);
    cabochaCheckBox = new JCheckBox(Translator.getTerm("CabochaCheckBox"));
    cabochaCheckBox.setSelected(true);
    showImportanceCheckBox = new JCheckBox("??");
    nounCheckBox = new JCheckBox(Translator.getTerm("NounCheckBox"));
    nounCheckBox.setSelected(true);
    verbCheckBox = new JCheckBox(Translator.getTerm("VerbCheckBox"));
    verbCheckBox.setSelected(false);
    otherCheckBox = new JCheckBox(Translator.getTerm("OtherPOSCheckBox"));
    oneWordCheckBox = new JCheckBox(Translator.getTerm("OneCharacterCheckBox"));

    JPanel morphemeAnalysisPanel = new JPanel();
    morphemeAnalysisPanel.add(genSenCheckBox);
    morphemeAnalysisPanel.add(cabochaCheckBox);
    morphemeAnalysisPanel.add(nounCheckBox);
    morphemeAnalysisPanel.add(verbCheckBox);
    morphemeAnalysisPanel.add(otherCheckBox);
    morphemeAnalysisPanel.add(oneWordCheckBox);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BorderLayout());
    buttonPanel.add(morphemeAnalysisPanel, BorderLayout.WEST);
    buttonPanel.add(termExtractionButton, BorderLayout.EAST);

    mainViews = new View[2];
    ViewMap viewMap = new ViewMap();
    // mainViews[0] = new View(Translator.getTerm("DocumentList"), null,
    // docPanel);
    mainViews[0] = new View(Translator.getTerm("InputDocumentList"), null, inputDocPanel);
    mainViews[1] = new View(Translator.getTerm("InputDocumentArea"), null, inputDocAreaScroll);

    for (int i = 0; i < mainViews.length; i++) {
        viewMap.addView(i, mainViews[i]);
    }
    rootWindow = Utils.createDODDLERootWindow(viewMap);
    setLayout(new BorderLayout());
    add(rootWindow, BorderLayout.CENTER);
    add(buttonPanel, BorderLayout.SOUTH);
}

From source file:edu.ucla.stat.SOCR.analyses.gui.AnovaTwoWay.java

protected void setMappingPanel() {
    listIndex = new int[dataTable.getColumnCount()];
    for (int j = 0; j < listIndex.length; j++)
        listIndex[j] = 1;/*from w w w  .  j a v  a 2 s.c  om*/

    bPanel = new JPanel(new BorderLayout());
    bPanel.add(mappingPanel, BorderLayout.CENTER);
    mappingPanel.add(mappingInnerPanel, BorderLayout.CENTER);

    addButton1.addActionListener(this);
    addButton2.addActionListener(this);
    removeButton1.addActionListener(this);
    removeButton2.addActionListener(this);

    lModel1 = new DefaultListModel();
    lModel2 = new DefaultListModel();
    lModel3 = new DefaultListModel();

    int cellWidth = 10;

    listAdded = new JList(lModel1);
    listAdded.setSelectedIndex(0);
    listDepRemoved = new JList(lModel2);
    listIndepRemoved = new JList(lModel3);

    paintTable(listIndex);
    listAdded.setFixedCellWidth(cellWidth);
    listDepRemoved.setFixedCellWidth(cellWidth);
    listIndepRemoved.setFixedCellWidth(cellWidth);
    dependentPane = new JScrollPane(listDepRemoved);
    FIRST_BUTTON_LABEL = "DEPENDENT";
    SECOND_BUTTON_LABEL = "INDEPENDENT";
    depLabel = new JLabel(FIRST_BUTTON_LABEL);
    indLabel = new JLabel(SECOND_BUTTON_LABEL);
    tools1.add(depLabel);
    tools2.add(indLabel);

    tools1.add(addButton1);
    tools1.add(removeButton1);
    tools2.add(addButton2);
    tools2.add(removeButton2);

    tools1.setFloatable(false);
    tools2.setFloatable(false);

    //
    JPanel choicesPanel = new JPanel();
    choicesPanel.setLayout(new BoxLayout(choicesPanel, BoxLayout.Y_AXIS));
    interactionOnSwitch = new JRadioButton("On");
    interactionOnSwitch.addActionListener(this);
    interactionOnSwitch.setActionCommand(INTERACTIONON);
    interactionOnSwitch.setSelected(false);
    interactionOn = false;

    interactionOffSwitch = new JRadioButton("Off");
    interactionOffSwitch.addActionListener(this);
    interactionOffSwitch.setActionCommand(INTERACTIONOFF);
    interactionOffSwitch.setSelected(true);

    ButtonGroup group = new ButtonGroup();
    group.add(interactionOnSwitch);
    group.add(interactionOffSwitch);
    choicesPanel.add(new JLabel("Turn the interaction:"));
    choicesPanel.add(interactionOnSwitch);
    choicesPanel.add(interactionOffSwitch);
    choicesPanel.setPreferredSize(new Dimension(200, 100));

    JPanel emptyPanel = new JPanel();
    //mappingInnerPanel.setBackground(Color.RED);
    mappingInnerPanel.add(new JScrollPane(listAdded));
    mappingInnerPanel.add(tools1);
    mappingInnerPanel.add(dependentPane);
    // mappingInnerPanel.add(emptyPanel);
    mappingInnerPanel.add(choicesPanel);
    mappingInnerPanel.add(tools2);
    mappingInnerPanel.add(new JScrollPane(listIndepRemoved));
    //listIndepRemoved.setBackground(Color.GREEN);
}

From source file:org.gumtree.vis.hist2d.Hist2DChartEditor.java

private JPanel createHelpPanel(JFreeChart chart) {
    JPanel wrap = new JPanel(new GridLayout(1, 1));

    JPanel helpPanel = new JPanel(new GridLayout(1, 1));
    helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //       helpPanel.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Help Topics"));

    SpringLayout spring = new SpringLayout();
    JPanel inner = new JPanel(spring);
    inner.setBorder(BorderFactory.createEmptyBorder());

    final IHelpProvider provider = new Hist2DHelpProvider();
    final JList list = new JList(provider.getHelpMap().keySet().toArray());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    //      list.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane listPane1 = new JScrollPane(list);
    inner.add(listPane1);//  w  ww  .  jav a  2  s  .  c om
    listPane1.setMaximumSize(new Dimension(140, 0));
    listPane1.setMinimumSize(new Dimension(70, 0));
    //      JPanel contentPanel = new JPanel(new GridLayout(2, 1));
    //      inner.add(list);
    final JTextField keyField = new JTextField();
    keyField.setMaximumSize(new Dimension(400, 20));
    keyField.setEditable(false);
    //      keyField.setMaximumSize();
    //      keyArea.setLineWrap(true);
    //      keyArea.setWrapStyleWord(true);
    //      keyArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(keyField);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    final JTextArea helpArea = new JTextArea();
    JScrollPane areaPane = new JScrollPane(helpArea);
    helpArea.setEditable(false);
    helpArea.setLineWrap(true);
    helpArea.setWrapStyleWord(true);
    //      helpArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(areaPane);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    //      inner.add(contentPanel);
    spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner);
    spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField);
    spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField);
    spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner);
    spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane);
    spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner);

    list.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Object[] selected = list.getSelectedValues();
            if (selected.length >= 0) {
                HelpObject help = provider.getHelpMap().get(selected[0]);
                if (help != null) {
                    keyField.setText(help.getKey());
                    helpArea.setText(help.getDiscription());
                }
            }
        }
    });

    helpPanel.add(inner, BorderLayout.NORTH);
    wrap.setName("Help");

    wrap.add(helpPanel, BorderLayout.NORTH);
    return wrap;

}

From source file:net.mariottini.swing.JFontChooser.java

/**
 * Construct a font chooser with the specified fonts, optionally showing a sample to the user. The
 * sample text is a default text, you can change it by calling <code>setSampleText</code>.
 * //w ww.j  a v  a 2 s. c o  m
 * @param fontNames
 *          the font family names to show to the user.
 * @param showSample
 *          true to show a sample of the selected font to the user.
 * @see #setSampleText
 */
public JFontChooser(String[] fontNames, boolean showSample) {
    setLayout(new BorderLayout());

    JPanel centerPanel = new JPanel(new BorderLayout());

    // Uncomment one of the two lines below to use a standard layout manager
    // instead of my MeshLayout manager. The result is ugly.
    // JPanel listsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));/*
    // JPanel listsPanel = new JPanel(new GridLayout(0, 3));/*
    net.mariottini.layout.MeshLayout mesh = new net.mariottini.layout.MeshLayout(0, 3, 0);
    mesh.setExpandColumn(0);
    JPanel listsPanel = new JPanel(mesh);// */

    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    panel.add(new JLabel("Family name:"), BorderLayout.NORTH);
    fontList = new JList<>(fontNames);
    fontList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    fontList.setVisibleRowCount(7);
    fontList.setSelectedIndex(0);
    panel.add(new JScrollPane(fontList), BorderLayout.CENTER);
    listsPanel.add(panel);

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 8));
    panel.add(new JLabel("Style:"), BorderLayout.NORTH);
    styleList = new JList<>(STYLE_NAMES);
    styleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    styleList.setVisibleRowCount(7);
    styleList.setSelectedIndex(0);
    panel.add(new JScrollPane(styleList), BorderLayout.CENTER);
    listsPanel.add(panel);

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 8));
    panel.add(new JLabel("Size:"), BorderLayout.NORTH);
    JPanel sizePanel = new JPanel(new BorderLayout());
    sizeText = new JTextField(String.valueOf(SIZES[0]), 4);
    sizePanel.add(sizeText, BorderLayout.NORTH);
    sizeList = new JList<>(ArrayUtils.toObject(SIZES));
    sizeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    sizeList.setVisibleRowCount(6);
    sizePanel.add(new JScrollPane(sizeList), BorderLayout.CENTER);
    panel.add(sizePanel, BorderLayout.CENTER);
    listsPanel.add(panel);

    centerPanel.add(listsPanel, BorderLayout.NORTH);

    samplePanel = new JPanel(new BorderLayout());
    samplePanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 4, 8));
    samplePanel.add(new JLabel("Sample:"), BorderLayout.NORTH);
    sampleLabel = new JLabel(DEFAULT_SAMPLE_TEXT, JLabel.CENTER);
    sampleLabel.setMinimumSize(new Dimension(64, 48));
    sampleLabel.setOpaque(true);
    sampleLabel.setBackground(sizeList.getBackground());
    sampleLabel.setBorder(sizeText.getBorder());
    samplePanel.add(sampleLabel, BorderLayout.CENTER);
    samplePanel.setVisible(showSample);
    centerPanel.add(samplePanel, BorderLayout.CENTER);

    add(centerPanel, BorderLayout.CENTER);

    accessoryPanel = new JPanel(new BorderLayout());
    accessoryPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 4, 8));
    accessoryComponent = new JLabel("Accessory");
    accessoryComponent.setOpaque(true);
    accessoryComponent.setBackground(sizeList.getBackground());
    accessoryPanel.add(accessoryComponent, BorderLayout.CENTER);
    accessoryPanel.setVisible(false);
    add(accessoryPanel, BorderLayout.EAST);

    JPanel southPanel = new JPanel(new BorderLayout());
    southPanel.add(new JLabel(), BorderLayout.CENTER);
    JPanel buttonsPanel = new JPanel();
    ActionListener actionListener = new ButtonActionListener();
    JButton button = new JButton("OK");
    button.addActionListener(actionListener);
    button.setActionCommand(APPROVE_SELECTION);
    buttonsPanel.add(button);
    button = new JButton("Cancel");
    button.addActionListener(actionListener);
    button.setActionCommand(CANCEL_SELECTION);
    buttonsPanel.add(button);
    southPanel.add(buttonsPanel, BorderLayout.EAST);
    add(southPanel, BorderLayout.SOUTH);

    // * Fix list size (optional)
    Dimension d = fontList.getPreferredSize();
    d.width += 6;
    fontList.setPreferredSize(d);
    d = styleList.getPreferredSize();
    d.width += 6;
    styleList.setPreferredSize(d);
    d = sizeList.getPreferredSize();
    d.width += 6;
    sizeList.setPreferredSize(d);
    // */

    // Fix sample size
    Dimension pref = sampleLabel.getPreferredSize();
    Dimension min = sampleLabel.getMinimumSize();
    pref.width += 16;
    pref.height += 12;
    if (pref.width < min.width) {
        pref.width = min.width;
    }
    if (pref.height < min.height) {
        pref.height = min.height;
    }
    sampleLabel.setPreferredSize(pref);

    // set listener
    SampleListener pl = new SampleListener();
    fontList.addListSelectionListener(pl);
    styleList.addListSelectionListener(pl);
    sizeList.addListSelectionListener(pl);
    sizeList.addListSelectionListener(new SizeListListener());
    sizeText.getDocument().addDocumentListener(new SizeTextListener());
    sizeText.addFocusListener(new SizeTextFocusListener());
    sizeList.setSelectedIndex(5);
}

From source file:ca.phon.app.session.editor.TranscriberSelectionDialog.java

/** Init display and listeners */
private void initDialog() {
    // setup layout

    // layout will be seperated into two sections, existing
    // and new transcripts
    FormLayout outerLayout = new FormLayout("3dlu, pref, right:pref:grow, 3dlu",
            "pref,  3dlu, top:pref:noGrow, 3dlu, pref, 3dlu, fill:pref:grow, 3dlu, pref");
    this.getContentPane().setLayout(outerLayout);

    // create the 'new' panel first
    FormLayout newLayout = new FormLayout("left:pref:noGrow, 3dlu, fill:pref:grow",
            "bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, 3dlu, bottom:pref:noGrow, fill:pref:grow");
    JPanel newPanel = new JPanel(newLayout);

    this.newTranscriptButton = new JRadioButton();
    this.newTranscriptButton.setText("New Transcriber");
    this.newTranscriptButton.setSelected(true);
    this.newTranscriptButton.addActionListener(new ActionListener() {

        @Override/*from  w w w.j ava 2  s . c om*/
        public void actionPerformed(ActionEvent arg0) {
            realNameField.setEnabled(true);
            usernameField.setEnabled(true);
            passwordRequiredBox.setEnabled(true);

            if (passwordRequiredBox.isSelected()) {
                passwordField.setEnabled(true);
                checkField.setEnabled(true);
            }

            existingUserList.setEnabled(false);
        }

    });

    this.existingTranscriptButton = new JRadioButton();
    this.existingTranscriptButton.setText("Existing Transcriber");
    this.existingTranscriptButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            realNameField.setEnabled(false);
            usernameField.setEnabled(false);
            passwordRequiredBox.setEnabled(false);
            passwordField.setEnabled(false);
            checkField.setEnabled(false);

            existingUserList.setEnabled(true);
        }

    });

    ButtonGroup bg = new ButtonGroup();
    bg.add(this.newTranscriptButton);
    bg.add(this.existingTranscriptButton);

    this.realNameField = new JTextField();

    this.usernameField = new JTextField();

    this.passwordRequiredBox = new JCheckBox();
    this.passwordRequiredBox.setText("Use password");
    this.passwordRequiredBox.setSelected(false);
    this.passwordRequiredBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            passwordField.setEnabled(passwordRequiredBox.isSelected());
            checkField.setEnabled(passwordRequiredBox.isSelected());
        }

    });

    this.passwordField = new JPasswordField();
    this.passwordField.setEnabled(false);

    this.checkField = new JPasswordField();
    this.checkField.setEnabled(false);

    CellConstraints cc = new CellConstraints();

    newPanel.add(new JLabel("Full Name:"), cc.xy(1, 1));
    newPanel.add(this.realNameField, cc.xy(3, 1));

    newPanel.add(new JLabel("Username:"), cc.xy(1, 3));
    newPanel.add(this.usernameField, cc.xy(3, 3));

    newPanel.add(this.passwordRequiredBox, cc.xyw(1, 5, 3));

    newPanel.add(new JLabel("Password:"), cc.xy(1, 7));
    newPanel.add(this.passwordField, cc.xy(3, 7));
    newPanel.add(this.checkField, cc.xy(3, 9));

    // create the 'existing' panel
    FormLayout existingLayout = new FormLayout(
            // just a list
            "fill:pref:grow", "fill:pref:grow");
    JPanel existingPanel = new JPanel(existingLayout);

    List<String> existingUserData = new ArrayList<String>();
    for (Transcriber t : session.getTranscribers())
        existingUserData.add(t.getRealName() + " - " + t.getUsername());
    this.existingUserList = new JList(existingUserData.toArray());
    this.existingUserList.setEnabled(false);

    existingPanel.add(this.existingUserList, cc.xy(1, 1));

    // create the button panel
    this.okButton = new JButton("OK");
    this.okButton.setDefaultCapable(true);
    this.okButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (checkDialog()) {
                okHandler();
            }
        }

    });
    getRootPane().setDefaultButton(okButton);

    this.cancelButton = new JButton("Cancel");
    this.cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            cancelHandler();
        }

    });

    final JComponent bar = ButtonBarBuilder.buildOkCancelBar(okButton, cancelButton);
    this.getContentPane().add(bar, cc.xy(3, 9));

    this.getContentPane().add(this.newTranscriptButton, cc.xy(2, 1));
    this.getContentPane().add(newPanel, cc.xyw(2, 3, 2));
    this.getContentPane().add(this.existingTranscriptButton, cc.xy(2, 5));
    this.getContentPane().add(new JScrollPane(existingPanel), cc.xyw(2, 7, 2));
}

From source file:fr.free.hd.servers.gui.FaceView.java

private JList CreateList() {
    Collection<Face> faces = facesDAO.getFaces();
    final JList list = new JList(faces.toArray());
    list.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override/*from  w w  w. j a v  a2 s  .  co m*/
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting() == false) {
                face = (Face) list.getSelectedValue();
            }
        }

    });
    return list;
}

From source file:net.sf.taverna.t2.workbench.cagrid.CaGridComponent.java

private void addResultPanel() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;// ww w .  j  a v  a 2  s  .c  o m
    c.gridy = ++row;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0.01;
    c.weighty = 0.01;
    c.anchor = GridBagConstraints.SOUTHEAST;
    c.gridwidth = GridBagConstraints.REMAINDER;
    resultPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    resultPanel.setDividerLocation(200);
    resultPanel.setBorder(null);
    runListModel = new DefaultListModel();
    runList = new JList(runListModel);
    runList.setBorder(new EmptyBorder(5, 5, 5, 5));
    runList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    runListPanel = new JPanel(new BorderLayout());
    runListPanel.setBorder(LineBorder.createGrayLineBorder());

    JLabel worklflowRunsLabel = new JLabel("Workflow Runs");
    worklflowRunsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
    removeCaGridRunsButton = new JButton("Remove"); // button to remove previous workflow runs
    removeCaGridRunsButton.setAlignmentX(JComponent.RIGHT_ALIGNMENT);
    removeCaGridRunsButton.setEnabled(false);
    removeCaGridRunsButton.setToolTipText("Remove caGrid run(s)");
    removeCaGridRunsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int[] selected = runList.getSelectedIndices();
            for (int i = selected.length - 1; i >= 0; i--) {
                CaGridRun cr = (CaGridRun) runListModel.get(selected[i]);

                //delete the EPR file
                File file = new File(new File(System.getProperty("user.home")), cr.workflowid + ".epr");
                file.delete();
                System.out.println(cr.workflowid + ".epr deleted");
                runListModel.remove(selected[i]);
            }
            // Set the first item as selected - if there is one
            if (runListModel.size() > 0) {
                runList.setSelectedIndex(0);
            } else {
                resultText.setText("");
                resultText.revalidate();

            }
        }
    });
    runListPanel.add(worklflowRunsLabel, BorderLayout.NORTH);
    runListPanel.add(removeCaGridRunsButton, BorderLayout.BEFORE_FIRST_LINE);

    JScrollPane scrollPane = new JScrollPane(runList);
    scrollPane.setBorder(null);
    runListPanel.add(scrollPane, BorderLayout.CENTER);
    // loadWorkflowRunsFromStoredEPRFiles(): add CaGridRun to runList for each EPR
    // add two buttons: remove and refresh status
    runList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                Object selection = runList.getSelectedValue();
                if (selection instanceof CaGridRun) {
                    removeCaGridRunsButton.setEnabled(true);
                    CaGridRun dataflowRun = (CaGridRun) selection;
                    // update status and refresh outputPanel
                    String resultDisplayString = updateResultDisplayString(dataflowRun);
                    resultText.setText(resultDisplayString);
                    resultText.setLineWrap(true);
                    resultText.setEditable(false);
                    outputPanel.revalidate();
                    revalidate();
                } else {
                    removeCaGridRunsButton.setEnabled(false);
                    revalidate();

                }
            }
        }
    });

    resultPanel.setTopComponent(runListPanel);

    //each output should be a (xml) string
    outputPanel = new JScrollPane();

    resultText = new JTextArea();
    outputPanel = new JScrollPane(resultText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    //outputPanel = new JPanel(new BorderLayout());
    outputPanel.setBorder(LineBorder.createGrayLineBorder());
    outputPanel.setBackground(Color.WHITE);
    //outputPanel.add(new JLabel("Workflow Execution Outputs shows here.", JLabel.CENTER), null);
    resultPanel.setBottomComponent(outputPanel);
    add(resultPanel, c);

    //add runComponent to the GUI
    ArrayList<CaGridRun> loadedRunList = loadWorkflowRunsFromStoredEPRFiles(null,
            (String) services.getSelectedItem());
    if (loadedRunList != null) {
        for (int m = 0; m < loadedRunList.size(); m++) {
            CaGridRun cr = (CaGridRun) loadedRunList.get(m);
            runListModel.add(0, cr);
        }
        System.out.println(loadedRunList.size() + " EPR loaded.");
        runList.setSelectedIndex(0);
    }

}

From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingFrame.java

/**
 * Constructor./*from  ww  w .  ja v a  2  s .co  m*/
 */
public GapFillingFrame(final AbstractTabView atv, final Instances dataSet, final Attribute attr,
        final int dateIdx, final int valuesBeforeAndAfter, final int position, final int gapsize,
        final StationsDataProvider gcp, final boolean inBatchMode) {
    super();

    setTitle("Gap filling for " + attr.name() + " ("
            + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position).value(dateIdx)) + " -> "
            + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position + gapsize).value(dateIdx)) + ")");
    LogoHelper.setLogo(this);

    this.atv = atv;

    this.dataSet = dataSet;
    this.attr = attr;
    this.dateIdx = dateIdx;
    this.valuesBeforeAndAfter = valuesBeforeAndAfter;
    this.position = position;
    this.gapsize = gapsize;

    this.gcp = gcp;

    final Instances testds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0,
            dataSet.numAttributes() - 1, Math.max(0, position - valuesBeforeAndAfter),
            Math.min(position + gapsize + valuesBeforeAndAfter, dataSet.numInstances() - 1));

    this.attrNames = WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(testds);

    this.isGapSimulated = (this.attrNames.contains(attr.name()));
    this.originaldataSet = new Instances(dataSet);
    if (this.isGapSimulated) {
        setTitle(getTitle() + " [SIMULATED GAP]");
        /*final JXLabel fictiveGapLabel=new JXLabel("                                                                        FICTIVE GAP");
        fictiveGapLabel.setForeground(Color.RED);
        fictiveGapLabel.setFont(new Font(fictiveGapLabel.getFont().getName(), Font.PLAIN,fictiveGapLabel.getFont().getSize()*2));
        final JXPanel fictiveGapPanel=new JXPanel();
        fictiveGapPanel.setLayout(new BorderLayout());
        fictiveGapPanel.add(fictiveGapLabel,BorderLayout.CENTER);
        getContentPane().add(fictiveGapPanel,BorderLayout.NORTH);*/
        this.attrNames.remove(attr.name());
        this.originalDataBeforeGapSimulation = dataSet.attributeToDoubleArray(attr.index());
        for (int i = position; i < position + gapsize; i++)
            dataSet.instance(i).setMissing(attr);
    }

    final Object[] attrNamesObj = this.attrNames.toArray();

    this.centerPanel = new JXPanel();
    this.centerPanel.setLayout(new BorderLayout());
    getContentPane().add(this.centerPanel, BorderLayout.CENTER);

    //final JXPanel algoPanel=new JXPanel();
    //getContentPane().add(algoPanel,BorderLayout.NORTH);
    final JXPanel filterPanel = new JXPanel();
    //filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.Y_AXIS));      
    filterPanel.setLayout(new GridBagLayout());
    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(10, 10, 10, 10);
    getContentPane().add(filterPanel, BorderLayout.WEST);

    final JXComboBox algoCombo = new JXComboBox(Algo.values());
    algoCombo.setBorder(new TitledBorder("Algorithm"));
    filterPanel.add(algoCombo, gbc);
    gbc.gridy++;

    final JXLabel infoLabel = new JXLabel("Usable = with no missing values on the period");
    //infoLabel.setBorder(new TitledBorder(""));
    filterPanel.add(infoLabel, gbc);
    gbc.gridy++;

    final JList<Object> timeSeriesList = new JList<Object>(attrNamesObj);
    timeSeriesList.setBorder(new TitledBorder("Usable time series"));
    timeSeriesList.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    final JScrollPane jcpMap = new JScrollPane(timeSeriesList);
    jcpMap.setPreferredSize(new Dimension(225, 150));
    jcpMap.setMinimumSize(new Dimension(225, 150));
    filterPanel.add(jcpMap, gbc);
    gbc.gridy++;

    final JXPanel mapPanel = new JXPanel();
    mapPanel.setBorder(new TitledBorder(""));
    mapPanel.setLayout(new BorderLayout());
    mapPanel.add(gcp.getMapPanel(Arrays.asList(attr.name()), this.attrNames, true), BorderLayout.CENTER);
    filterPanel.add(mapPanel, gbc);
    gbc.gridy++;

    final JXLabel mssLabel = new JXLabel(
            "<html>Most similar usable serie: <i>[... computation ...]</i></html>");
    mssLabel.setBorder(new TitledBorder(""));
    filterPanel.add(mssLabel, gbc);
    gbc.gridy++;

    final JXLabel nsLabel = new JXLabel("<html>Nearest usable serie: <i>[... computation ...]</i></html>");
    nsLabel.setBorder(new TitledBorder(""));
    filterPanel.add(nsLabel, gbc);
    gbc.gridy++;

    final JXLabel ussLabel = new JXLabel("<html>Upstream serie: <i>[... computation ...]</i></html>");
    ussLabel.setBorder(new TitledBorder(""));
    filterPanel.add(ussLabel, gbc);
    gbc.gridy++;

    final JXLabel dssLabel = new JXLabel("<html>Downstream serie: <i>[... computation ...]</i></html>");
    dssLabel.setBorder(new TitledBorder(""));
    filterPanel.add(dssLabel, gbc);
    gbc.gridy++;

    final JCheckBox hideOtherSeriesCB = new JCheckBox("Hide the others series");
    hideOtherSeriesCB.setSelected(DEFAULT_HIDE_OTHER_SERIES_OPTION);
    filterPanel.add(hideOtherSeriesCB, gbc);
    gbc.gridy++;

    final JCheckBox showErrorCB = new JCheckBox("Show error on plot");
    filterPanel.add(showErrorCB, gbc);
    gbc.gridy++;

    final JCheckBox zoomCB = new JCheckBox("Auto-adjusted size");
    zoomCB.setSelected(DEFAULT_ZOOM_OPTION);
    filterPanel.add(zoomCB, gbc);
    gbc.gridy++;

    final JCheckBox multAxisCB = new JCheckBox("Multiple axis");
    filterPanel.add(multAxisCB, gbc);
    gbc.gridy++;

    final JCheckBox showEnvelopeCB = new JCheckBox("Show envelope (all algorithms, SLOW)");
    filterPanel.add(showEnvelopeCB, gbc);
    gbc.gridy++;

    final JXButton showModelButton = new JXButton("Show the model");
    filterPanel.add(showModelButton, gbc);
    gbc.gridy++;

    showModelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            final JXFrame dialog = new JXFrame();
            dialog.setTitle("Model");
            LogoHelper.setLogo(dialog);
            dialog.getContentPane().removeAll();
            dialog.getContentPane().setLayout(new BorderLayout());
            final JTextPane modelTxtPane = new JTextPane();
            modelTxtPane.setText(gapFiller.getModel());
            modelTxtPane.setBackground(Color.WHITE);
            modelTxtPane.setEditable(false);
            final JScrollPane jsp = new JScrollPane(modelTxtPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            jsp.setSize(new Dimension(400 - 20, 400 - 20));
            dialog.getContentPane().add(jsp, BorderLayout.CENTER);
            dialog.setSize(new Dimension(400, 400));
            dialog.setLocationRelativeTo(centerPanel);
            dialog.pack();
            dialog.setVisible(true);
        }
    });

    algoCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
                showModelButton.setEnabled(gapFiller.hasExplicitModel());
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    timeSeriesList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(final ListSelectionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
                mapPanel.removeAll();
                final List<String> currentlySelected = new ArrayList<String>();
                currentlySelected.add(attr.name());
                for (final Object sel : timeSeriesList.getSelectedValues())
                    currentlySelected.add(sel.toString());
                mapPanel.add(gcp.getMapPanel(currentlySelected, attrNames, true), BorderLayout.CENTER);
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    hideOtherSeriesCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (final Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    showErrorCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    zoomCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    showEnvelopeCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    multAxisCB.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            try {
                refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()),
                        timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(),
                        showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(),
                        multAxisCB.isSelected());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    });

    this.inBatchMode = inBatchMode;

    if (!inBatchMode) {
        try {
            refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), new int[0],
                    DEFAULT_HIDE_OTHER_SERIES_OPTION, false, DEFAULT_ZOOM_OPTION, false, false);
            showModelButton.setEnabled(gapFiller.hasExplicitModel());
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }

    if (!inBatchMode) {
        /* automatically select computed series */
        new AbstractSimpleAsync<Void>(true) {
            @Override
            public Void execute() throws Exception {
                mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames,
                        false);
                mssLabel.setText("<html>Most similar usable serie: <b>" + mostSimilar + "</b></html>");

                nearest = gcp.findNearestStation(attr.name(), attrNames);
                nsLabel.setText("<html>Nearest usable serie: <b>" + nearest + "</b></html>");

                upstream = gcp.findUpstreamStation(attr.name(), attrNames);
                if (upstream != null) {
                    ussLabel.setText("<html>Upstream usable serie: <b>" + upstream + "</b></html>");
                } else {
                    ussLabel.setText("<html>Upstream usable serie: <b>N/A</b></html>");
                }

                downstream = gcp.findDownstreamStation(attr.name(), attrNames);
                if (downstream != null) {
                    dssLabel.setText("<html>Downstream usable serie: <b>" + downstream + "</b></html>");
                } else {
                    dssLabel.setText("<html>Downstream usable serie: <b>N/A</b></html>");
                }

                timeSeriesList.setSelectedIndices(
                        new int[] { attrNames.indexOf(mostSimilar), attrNames.indexOf(nearest),
                                attrNames.indexOf(upstream), attrNames.indexOf(downstream) });

                return null;
            }

            @Override
            public void onSuccess(final Void result) {
            }

            @Override
            public void onFailure(final Throwable caught) {
                caught.printStackTrace();
            }
        }.start();
    } else {
        try {
            mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        nearest = gcp.findNearestStation(attr.name(), attrNames);
        upstream = gcp.findUpstreamStation(attr.name(), attrNames);
        downstream = gcp.findDownstreamStation(attr.name(), attrNames);
    }
}