Example usage for java.awt GridLayout setColumns

List of usage examples for java.awt GridLayout setColumns

Introduction

In this page you can find the example usage for java.awt GridLayout setColumns.

Prototype

public void setColumns(int cols) 

Source Link

Document

Sets the number of columns in this layout to the specified value.

Usage

From source file:FirstForm.java

private void initPanels() {
    GridLayout gL = new GridLayout();
    gL.setColumns(1);
    gL.setRows(1);//from   w  w w  . j a  va 2s  .  co  m
    portadoraPanel.setLayout(gL);
    portadoraPanel.setPreferredSize(new Dimension(60, 50));
    moduladoraPanel.setLayout(gL);
    moduladoraPanel.setPreferredSize(new Dimension(60, 50));
    moduladaPanel.setLayout(gL);
    moduladaPanel.setPreferredSize(new Dimension(60, 140));
    portadoraPanel.add(portadoraChart);
    moduladoraPanel.add(moduladoraChart);
    moduladaPanel.add(moduladaChart);
}

From source file:gtu._work.ui.ObnfInsertCreaterUI.java

private void initGUI() {
    try {//from  w w  w .  j  a  v  a2  s. c om
        JCommonUtil.defaultToolTipDelay();
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                jTabbedPane1.addTab("?schema", null, jPanel1, null);
                {
                    jLabel1 = new JLabel();
                    jPanel1.add(jLabel1);
                    jLabel1.setText("tableName");
                }
                {
                    tableNameText = new JTextField();
                    jPanel1.add(tableNameText);
                    tableNameText.setPreferredSize(new java.awt.Dimension(155, 22));
                }
                {
                    useDomainJarDefineChkBox = new JCheckBox();
                    jPanel1.add(useDomainJarDefineChkBox);
                    useDomainJarDefineChkBox.setText("\u4ee5dominJar\u70ba\u6e96");
                }
                {
                    dominJarFileText = new JTextField();
                    File currentFile = new File(PropertiesUtil.getJarCurrentPath(getClass()),
                            "sris-db-domain-2.5.0-SRIS-SNAPSHOT.jar");
                    if (currentFile.exists()) {
                        dominJarFileText.setText(currentFile.getAbsolutePath());
                    } else {
                        File cUserFile = new File("C:\\Users");
                        if (cUserFile.exists()) {
                            String domainJarPath = "C:/Users/%s/.m2/repository/tw/gov/sris-db-domain/2.5.0-SRIS-SNAPSHOT/sris-db-domain-2.5.0-SRIS-SNAPSHOT.jar";
                            for (File f : cUserFile.listFiles()) {
                                File jf = new File(String.format(domainJarPath, f.getName()));
                                if (jf.exists()) {
                                    dominJarFileText.setText(jf.getAbsolutePath());
                                    break;
                                }
                            }
                        }
                    }
                    jPanel1.add(dominJarFileText);
                    dominJarFileText.setPreferredSize(new java.awt.Dimension(219, 22));
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(dominJarFileText, false);
                }
                {
                    jLabel5 = new JLabel();
                    jPanel1.add(jLabel5);
                    jLabel5.setText("obnfString");
                    jLabel5.setPreferredSize(new java.awt.Dimension(83, 15));
                }
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel1.add(jScrollPane2);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(544, 76));
                    {
                        obnfArea = new JTextArea();
                        jScrollPane2.setViewportView(obnfArea);
                    }
                }
                {
                    jLabel6 = new JLabel();
                    jPanel1.add(jLabel6);
                    jLabel6.setText("sql");
                    jLabel6.setPreferredSize(new java.awt.Dimension(58, 15));
                }
                {
                    jScrollPane3 = new JScrollPane();
                    jPanel1.add(jScrollPane3);
                    jScrollPane3.setPreferredSize(new java.awt.Dimension(543, 116));
                    {
                        insertSqlArea = new JTextArea();
                        jScrollPane3.setViewportView(insertSqlArea);
                    }
                }
                {
                    executeBtn = new JButton();
                    jPanel1.add(executeBtn);
                    executeBtn.setText("\u8b80\u53d6ObnfString");
                    executeBtn.setPreferredSize(new java.awt.Dimension(146, 29));
                    executeBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeBtnAction();
                        }
                    });
                }
                {
                    processSqlBtn = new JButton();
                    jPanel1.add(processSqlBtn);
                    processSqlBtn.setText("\u7522\u751fSQL");
                    processSqlBtn.setPreferredSize(new java.awt.Dimension(135, 29));
                    processSqlBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            processSqlBtnAction();
                        }
                    });
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("?", null, jPanel2, null);
                {
                    jPanel3 = new JPanel();
                    jPanel2.add(jPanel3, BorderLayout.NORTH);
                    jPanel3.setPreferredSize(new java.awt.Dimension(585, 61));
                    {
                        jLabel4 = new JLabel();
                        jPanel3.add(jLabel4);
                        jLabel4.setText("dbField");
                    }
                    {
                        dbFieldText = new JTextField();
                        jPanel3.add(dbFieldText);
                        dbFieldText.setPreferredSize(new java.awt.Dimension(216, 22));
                    }
                    {
                        jLabel3 = new JLabel();
                        jPanel3.add(jLabel3);
                        jLabel3.setText("value");
                    }
                    {
                        dbValue = new JTextField();
                        jPanel3.add(dbValue);
                        dbValue.setPreferredSize(new java.awt.Dimension(244, 22));
                    }
                    {
                        pkCheckBox = new JCheckBox();
                        jPanel3.add(pkCheckBox);
                        pkCheckBox.setText("\u662fPK");
                    }
                    {
                        addFieldBtn = new JButton();
                        jPanel3.add(addFieldBtn);
                        addFieldBtn.setText("saveOrUpdate");
                        addFieldBtn.setPreferredSize(new java.awt.Dimension(116, 22));
                        addFieldBtn.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                addFieldBtnAction();
                            }
                        });
                    }
                    {
                        deleteFieldBtn = new JButton();
                        jPanel3.add(deleteFieldBtn);
                        deleteFieldBtn.setText("delete");
                        deleteFieldBtn.setPreferredSize(new java.awt.Dimension(88, 22));
                        deleteFieldBtn.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                deleteFieldBtnAction();
                            }
                        });
                    }
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel2.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(585, 258));
                    {
                        DefaultListModel dbFieldListModel = new DefaultListModel();
                        dbFieldList = new JList();
                        jScrollPane1.setViewportView(dbFieldList);
                        dbFieldList.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                dbFieldListMousePreformd(evt);
                            }
                        });
                        dbFieldList.setModel(dbFieldListModel);
                        dbFieldList.addKeyListener(new KeyAdapter() {
                            public void keyPressed(KeyEvent evt) {
                                JListUtil.newInstance(dbFieldList).defaultJListKeyPressed(evt);
                            }
                        });
                    }
                }
            }
            {
                jPanel4 = new JPanel();
                GridLayout jPanel4Layout = new GridLayout(1, 1);
                jPanel4Layout.setColumns(1);
                jPanel4Layout.setHgap(5);
                jPanel4Layout.setVgap(5);
                jPanel4.setLayout(jPanel4Layout);
                jTabbedPane1.addTab("?", null, jPanel4, null);
                {
                    manualDefineArea = new JTextArea();
                    jPanel4.add(manualDefineArea);
                    manualDefineArea.setText("");
                    manualDefineArea.setToolTipText("?");
                }
                {
                    manualDefinePkArea = new JTextArea();
                    jPanel4.add(manualDefinePkArea);
                    manualDefinePkArea.setText("");
                    manualDefinePkArea.setToolTipText("PK?");
                }
                {
                    manualDefineDbFieldBtn = new JButton();
                    jPanel4.add(manualDefineDbFieldBtn);
                    manualDefineDbFieldBtn
                            .setText("\u4ee5\u8cbc\u5165\u6b04\u4f4d\u5b9a\u7fa9\u6c7a\u5b9a\u6b04\u4f4d");
                    manualDefineDbFieldBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            manualDefineDbFieldBtnAction();
                        }
                    });
                }
            }
        }
        pack();
        this.setSize(598, 366);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:edu.purdue.cc.bionet.ui.ClusteringDisplayPanel.java

public void setSampleGroups(Collection<SampleGroup> sampleGroups) {
    Component frame = this;
    while (!(frame instanceof Frame) && frame != null) {
        frame = frame.getParent();/*  w w  w  . j  av  a  2  s.c om*/
    }
    ClusterSelectionDialog dialog = new ClusterSelectionDialog((Frame) frame,
            Settings.getLanguage().get("Choose Clustering Method"), this.getSampleGroups() != null);

    if (dialog.getReturnValue() == null) {
        return;
    }
    super.setSampleGroups(sampleGroups);
    Collection<Molecule> molecules;
    try {
        ClusterSelectorTreePanel clusterPanel = (ClusterSelectorTreePanel) this.selectorPanel.getComponent(0);
        molecules = clusterPanel.getCheckedMolecules();
    } catch (ArrayIndexOutOfBoundsException e) {
        molecules = this.molecules;
    } catch (ClassCastException e) {
        molecules = this.molecules;
        Logger.getLogger(this.getClass()).error(e, e);
    }
    // clear the panels and set new layouts based on the new groups.
    this.selectorPanel.removeAll();
    this.clusterGraphPanel.removeAll();
    int rows = (int) Math.ceil(Math.sqrt(sampleGroups.size()));
    int cols = (int) Math.ceil(sampleGroups.size() / rows);
    GridLayout layout = (GridLayout) this.selectorPanel.getLayout();
    layout.setRows(rows);
    layout.setColumns(cols);
    layout = (GridLayout) this.clusterGraphPanel.getLayout();
    layout.setRows(rows);
    layout.setColumns(cols);

    // start the clusterer(s) in parallel.
    Map<Thread, RunnableClusterer> clusterers = new HashMap<Thread, RunnableClusterer>();
    for (SampleGroup group : sampleGroups) {
        RunnableClusterer clusterer = new RunnableClusterer(dialog.getReturnValue());
        SampleGroup filteredGroup = new SampleGroup(group);
        filteredGroup.retainAll(this.sampleSelectorTree.getSamples());
        clusterer.setDataset(this.getDataset(molecules, filteredGroup));
        Thread thread = new Thread(clusterer);
        thread.start();
        clusterers.put(thread, clusterer);
    }

    // iterate through each group and join the threads
    Iterator<SampleGroup> groupIter = sampleGroups.iterator();
    Collection<ClusterSelectorTreePanel> clusterTreeList = new ArrayList<ClusterSelectorTreePanel>();
    this.clusterGraphPanel.removeAll();
    for (Map.Entry<Thread, RunnableClusterer> clusterer : clusterers.entrySet()) {
        try {
            clusterer.getKey().join();
            Dataset[] result = clusterer.getValue().getResult();
            Collection<Collection<Molecule>> clusters = new TreeSet<Collection<Molecule>>(
                    new DatasetComparator());
            Collection<Molecule> unclustered = new ArrayList<Molecule>(this.molecules);
            for (Dataset dataset : result) {
                Collection<Molecule> cluster = this.getMoleculesForDataset(dataset);
                clusters.add(cluster);
                unclustered.removeAll(cluster);
            }

            // create a new clustertree and add the appropriate listeners
            ClusterSelectorTreePanel clusterTree = new ClusterSelectorTreePanel(clusters);
            if (unclustered.size() > 0) {
                clusterTree.add(unclustered,
                        String.format(Settings.getLanguage().get("Unclustered") + " (%d)", unclustered.size()),
                        false);
            }
            for (ClusterSelectorTreePanel tree : clusterTreeList) {
                tree.addTreeCheckingListener(clusterTree);
                clusterTree.addTreeCheckingListener(tree);
            }
            clusterTreeList.add(clusterTree);

            this.selectorPanel.add(clusterTree);
            ClusterGraph graph = new ClusterGraph(this.sampleSelectorTree, clusterTree, groupIter.next());
            this.clusterGraphPanel.add(graph);
            graph.setMeanGraph(clusterTree.getRoot());
        } catch (InterruptedException e) {
            Logger.getLogger(this.getClass()).debug(e, e);
        }
    }
    this.removeSampleGroupsMenuItem.setEnabled(sampleGroups.size() > 1);
    this.validate();
}

From source file:ar.edu.uns.cs.vyglab.arq.rockar.gui.JFrameControlPanel.java

private void initGUI() {
    try {/*  ww  w . j a v  a 2  s  .  c  om*/
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.setIconImage(new ImageIcon(getClass().getClassLoader()
                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/splash/purple-monkey32.png"))
                        .getImage());
        this.setTitle("Rock.AR v2.0");
        this.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent evt) {
                thisComponentResized(evt);
            }
        });
        this.addWindowListener(new WindowAdapter() {
            public void windowClosed(WindowEvent evt) {
                thisWindowClosed(evt);
            }
        });
        {
            jPanelSouth = new JPanel();
            BorderLayout jPanelSouthLayout = new BorderLayout();
            getContentPane().add(jPanelSouth, BorderLayout.SOUTH);
            jPanelSouth.setLayout(jPanelSouthLayout);
            {
                jLabelInformation = new JLabel();
                jPanelSouth.add(jLabelInformation, BorderLayout.CENTER);
                jLabelInformation.setText(DataCenter.langResource.getString("control_information_label"));
                jLabelInformation.setOpaque(true);
                jLabelInformation.setBackground(new java.awt.Color(241, 191, 101));
            }
        }
        {
            jPanelCenter = new JPanel();
            GridLayout jPanelCenterLayout = new GridLayout(1, 1);
            jPanelCenterLayout.setHgap(5);
            jPanelCenterLayout.setVgap(5);
            jPanelCenterLayout.setColumns(1);
            getContentPane().add(jPanelCenter, BorderLayout.CENTER);
            jPanelCenter.setLayout(jPanelCenterLayout);
            {
                jPanelWest = new JPanel();
                BorderLayout jPanelWestLayout = new BorderLayout();
                jPanelCenter.add(jPanelWest);
                jPanelWest.setLayout(jPanelWestLayout);
                jPanelWest.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                {
                    jToolBarMineralTable = new JToolBar();
                    jToolBarMineralTable.setLayout(new FlowLayout(FlowLayout.LEFT));
                    jPanelWest.add(jToolBarMineralTable, BorderLayout.NORTH);
                    jToolBarMineralTable.setFloatable(false);
                    jToolBarMineralTable.setFocusable(false);
                    {
                        jButtonNew = new JButton();
                        jToolBarMineralTable.add(jButtonNew);
                        jButtonNew.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/Actions-tab-new-icon.png")));
                        jButtonNew.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonNewActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonOpen = new JButton();
                        jToolBarMineralTable.add(jButtonOpen);
                        jButtonOpen.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/open.png")));
                        jButtonOpen.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonOpenActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonSave = new JButton();
                        jToolBarMineralTable.add(jButtonSave);
                        jButtonSave.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/save.png")));
                        jButtonSave.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonSaveActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jSeparator1 = new JSeparator();
                        jToolBarMineralTable.add(jSeparator1);
                        jSeparator1.setOrientation(SwingConstants.VERTICAL);
                        jSeparator1.setSize(5, 44);
                        jSeparator1.setPreferredSize(new java.awt.Dimension(5, 44));
                    }
                    {
                        jButtonAdd = new JButton();
                        jToolBarMineralTable.add(jButtonAdd);
                        jButtonAdd.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/add.png")));
                        jButtonAdd.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonAddActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonEdit = new JButton();
                        jToolBarMineralTable.add(jButtonEdit);
                        jButtonEdit.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/modify.png")));
                        jButtonEdit.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonEditActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonRemove = new JButton();
                        jToolBarMineralTable.add(jButtonRemove);
                        jButtonRemove.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/remove.png")));
                        jButtonRemove.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonRemoveActionPerformed(evt);
                            }
                        });
                    }
                }
                {
                    jLabelMineralTableInformation = new JLabel();
                    jPanelWest.add(jLabelMineralTableInformation, BorderLayout.SOUTH);
                    jLabelMineralTableInformation
                            .setText(DataCenter.langResource.getString("total_counted_table"));
                    jLabelMineralTableInformation.setHorizontalAlignment(SwingConstants.LEFT);
                    jLabelMineralTableInformation.setBackground(new java.awt.Color(255, 212, 133));
                    jLabelMineralTableInformation.setOpaque(true);
                }
                {
                    jScrollPaneMineralTable = new JScrollPane();
                    jPanelWest.add(jScrollPaneMineralTable, BorderLayout.CENTER);
                    {
                        jTableMineralsModel = new RockTableModel(
                                new String[] { DataCenter.langResource.getString("keyvalue_table"),
                                        DataCenter.langResource.getString("name_table"),
                                        DataCenter.langResource.getString("color_table"),
                                        DataCenter.langResource.getString("counted_table"),
                                        DataCenter.langResource.getString("area_table") },
                                0);
                        //                     jTableMineralsModel.addRow(new Object[] {
                        //                           0, "x?", Color.gray, 0,
                        //                           "0.00" });
                        jTableMinerals = new JReadOnlyTable();
                        jScrollPaneMineralTable.setViewportView(jTableMinerals);
                        jTableMinerals.setModel(jTableMineralsModel);
                        jTableMinerals.setDefaultRenderer(Color.class, new ColorRenderer(true));
                        TableCellRenderer centerRenderer = new CenterRenderer();
                        TableColumn column = jTableMinerals.getColumnModel().getColumn(0);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(1);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(3);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(4);
                        column.setCellRenderer(centerRenderer);

                    }
                }
            }
            {
                jPanelEast = new JPanel();
                jPanelCenter.add(jPanelEast);
                GridLayout jPanelEastLayout = new GridLayout(2, 1);
                jPanelEastLayout.setHgap(5);
                jPanelEastLayout.setVgap(5);
                jPanelEastLayout.setColumns(1);
                jPanelEast.setLayout(jPanelEastLayout);
                {
                    jPanelTop = new JPanel();
                    BorderLayout jPanelTopLayout = new BorderLayout();
                    jPanelEast.add(jPanelTop);
                    jPanelTop.setLayout(jPanelTopLayout);
                    jPanelTop.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                    {
                        jToolBarStats = new JToolBar();
                        jPanelTop.add(jToolBarStats, BorderLayout.NORTH);
                        jToolBarStats.setFloatable(false);
                        jToolBarStats.setFocusable(false);
                        {
                            jButtonExportStats = new JButton();
                            jButtonExportStats.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    saveChartAsImage();
                                }
                            });
                            //jToolBarStats.add(jButtonExportStats);
                            jButtonExportStats.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/export-graph.png")));
                        }
                        {
                            jButtonExportExcel = new JButton();
                            //jToolBarStats.add(jButtonExportExcel);
                            //jToolBarMineralTable.add(jButtonExportExcel);
                            jButtonExportExcel.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/excel-icon.png")));
                            jButtonExportExcel.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    exportToExcel();
                                }
                            });
                        }
                        {
                            jButtonExportAll = new JButton();
                            //jToolBarStats.add(jButtonExportAll);
                            jButtonExportAll.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/Mimetypes-application-vnd-ms-excel-icon.png")));
                        }
                    }
                    {

                    }
                }
                {
                    jPanelBottom = new JPanel();
                    BorderLayout jPanelBottomLayout = new BorderLayout();
                    jPanelEast.add(jPanelBottom);
                    jPanelBottom.setLayout(jPanelBottomLayout);
                    jPanelBottom.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                    {
                        jToolBarOverview = new JToolBar();
                        jPanelBottom.add(jToolBarOverview, BorderLayout.NORTH);
                        jToolBarOverview.setFloatable(false);
                        jToolBarOverview.setFocusable(false);
                        {
                            jButtonExportOverview = new JButton();
                            jToolBarOverview.add(jButtonExportOverview);
                            jButtonExportOverview.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/export-graph.png")));
                            jButtonExportOverview.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    exportOverview();
                                }
                            });
                        }
                    }
                    {
                        jPanelOverviewContent = new JPanel();
                        jPanelBottom.add(jPanelOverviewContent, BorderLayout.CENTER);
                        jPanelOverviewContent.setLayout(new GridBagLayout());
                        this.jLabelOverview = new JLabel();
                        jPanelOverviewContent.add(this.jLabelOverview);
                    }
                }
            }
        }
        pack();
        this.setSize(800, 600);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:edu.purdue.cc.bionet.ui.DistributionAnalysisDisplayPanel.java

/**
 * Sets the SampleGroups for this panel.
 * //from  ww  w. j  ava2  s .c o  m
 * @param sampleGroups The new set of groups
 */
public void setSampleGroups(Collection<SampleGroup> sampleGroups) {

    super.setSampleGroups(sampleGroups);

    // clear the listeners
    CheckboxTree tree = this.selectorTree.getTree();
    for (TreeSelectionListener t : tree.getTreeSelectionListeners()) {
        tree.removeTreeSelectionListener(t);
        // CheckboxTree doesn't have a method for getting TreeCheckingListeners,
        // so we'll try this and catch any exceptions.
        try {
            tree.removeTreeCheckingListener((TreeCheckingListener) t);
        } catch (ClassCastException e) {
        }
    }
    for (ItemListener i : this.noFitButton.getItemListeners()) {
        this.noFitButton.removeItemListener(i);
    }
    for (ItemListener i : this.robustFitButton.getItemListeners()) {
        this.robustFitButton.removeItemListener(i);
    }
    for (ItemListener i : this.chiSquareFitButton.getItemListeners()) {
        this.chiSquareFitButton.removeItemListener(i);
    }

    this.experimentGraphPanel.removeAll();
    this.bottomPanel.removeAll();
    int cols = (int) Math.ceil(Math.sqrt(sampleGroups.size()));
    int rows = (int) Math.ceil(sampleGroups.size() / cols);
    GridLayout layout = (GridLayout) this.experimentGraphPanel.getLayout();
    layout.setRows(rows);
    layout.setColumns(cols);
    layout = (GridLayout) this.bottomPanel.getLayout();
    layout.setRows(rows);
    layout.setColumns(cols);

    TreePath path = selectorTree.getTree().getSelectionPath();
    int level = path.getPathCount();
    DefaultMutableTreeNode selectedNode = null;
    if (level > MOLECULE) {
        selectedNode = (DefaultMutableTreeNode) path.getPathComponent(MOLECULE);
    }

    for (SampleGroup sampleGroup : sampleGroups) {
        SampleGraph sampleGraph = new SampleGraph(experiments, sampleGroup);
        ExperimentGraph experimentGraph = new ExperimentGraph(experiments, sampleGroup);
        this.bottomPanel.add(sampleGraph);
        this.selectorTree.getTree().addTreeSelectionListener(sampleGraph);
        this.experimentGraphPanel.add(experimentGraph, BorderLayout.CENTER);
        // add the listeners
        this.selectorTree.getTree().addTreeCheckingListener(sampleGraph);
        this.selectorTree.getTree().addTreeSelectionListener(experimentGraph);
        this.selectorTree.getTree().addTreeCheckingListener(experimentGraph);
        this.noFitButton.addItemListener(experimentGraph);
        this.robustFitButton.addItemListener(experimentGraph);
        this.chiSquareFitButton.addItemListener(experimentGraph);
        if (selectedNode != null) {
            sampleGraph.setGraph(selectedNode);
            experimentGraph.setGraph(selectedNode);
        }
    }
    this.removeSampleGroupsMenuItem.setEnabled(sampleGroups != null && sampleGroups.size() > 1);
    this.experimentGraphPanel.validate();
    this.bottomPanel.validate();
}

From source file:org.biojava.bio.view.MotifAnalyzer.java

/**
 * //  w w  w.jav a  2 s. c  o  m
 * @param f1 sequence file
 * @param motifs list of motifs to display
 */
public void showMotifs(SequenceIterator seqItr, List<Motif> motifs) {
    seqViewerTab.removeAll();
    seqViewerTab.setLayout(new BorderLayout());

    try {
        Vector<Sequence> seqs = new Vector<Sequence>();
        Set<MotifFinder> finders = new HashSet<MotifFinder>();

        while (seqItr.hasNext())
            seqs.add(seqItr.nextSequence());

        // labels panel

        JPanel labelPanel = new JPanel();
        seqViewerTab.add(labelPanel, BorderLayout.NORTH);

        // Sequence panels array
        JPanel seqViewer = new JPanel(new GridLayout(seqs.size(), 1));
        seqViewerTab.add(seqViewer, BorderLayout.CENTER);

        SequencePanel[] seqPanel = new SequencePanel[seqs.size()];
        GridLayout seqPanelLayout = new GridLayout(2, 1);
        seqPanelLayout.setColumns(1);
        seqPanelLayout.setHgap(5);
        seqPanelLayout.setVgap(5);
        seqPanelLayout.setRows(2);
        int i = 0;

        for (Iterator<Sequence> itr = seqs.iterator(); itr.hasNext(); i++) {
            Sequence sourceSeq = itr.next();
            String name = sourceSeq.getName().substring(sourceSeq.getName().indexOf("_") + 1);
            seqPanel[i] = new SequencePanel();
            seqPanel[i].setLayout(seqPanelLayout);
            int num = 0;
            String[] f = new String[motifs.size()];
            for (Iterator<Motif> m = motifs.iterator(); m.hasNext();) {
                Motif motif = m.next();
                if (motif.getSites().get(name) == null)
                    continue;
                for (Iterator<Site> itr2 = motif.getSites().get(name).iterator(); itr2.hasNext();) {
                    Site seq = itr2.next();
                    finders.add(motif.getFinder());
                    seq.location = new RangeLocation(sourceSeq.length() + seq.location.getMin(),
                            sourceSeq.length() + seq.location.getMax());
                    seq.type = motif.getFinder().name() + "_" + num;
                    sourceSeq.createFeature(seq);
                }
                f[num] = motif.getFinder().name() + "_" + num;
                num++;
            }

            seqPanel[i].setSequence(sourceSeq);
            seqPanel[i].setRange(new RangeLocation(1, sourceSeq.length()));
            // Magic number from EmblViewer
            seqPanel[i].setScale(Math.exp(-INITIAL_SCALE / 7.0) * 20.0);
            seqPanel[i].setDirection(SequencePanel.HORIZONTAL);

            OptimizableFilter[] optFilter = new OptimizableFilter[num];//MotifFinder.values().length];
            FeatureBlockSequenceRenderer[] renderer = new FeatureBlockSequenceRenderer[num];//MotifFinder.values().length];

            for (int k = 0; k < num; k++)//MotifFinder.values().length; k++)
            {
                optFilter[k] = new FeatureFilter.ByType(f[k]);//MotifFinder.values()[k].name());
                renderer[k] = new FeatureBlockSequenceRenderer(new RectangularBeadRenderer(10.0f, 5.0f,
                        Color.black, MotifFinder.valueOf(f[k].substring(0, f[k].indexOf('_'))).color,
                        new BasicStroke()));
            }

            MultiLineRenderer multi = new MultiLineRenderer();

            for (int k = 0; k < renderer.length; k++)
                multi.addRenderer(new FilteringRenderer(renderer[k], optFilter[k], false));

            multi.addRenderer(new SymbolSequenceRenderer());
            multi.addRenderer(new RulerRenderer());

            seqPanel[i].setRenderer(multi);
            seqPanel[i].setEnabled(false);

            JScrollPane seqScroll = new JScrollPane(seqPanel[i]);

            JPanel temp = new JPanel(new BorderLayout());

            temp.add(getControlBox(seqPanel[i], sourceSeq.getName()), BorderLayout.NORTH);
            temp.add(seqScroll, BorderLayout.CENTER);

            seqViewer.add(temp);
        }

        for (Iterator<MotifFinder> itr = finders.iterator(); itr.hasNext();) {
            MotifFinder finder = itr.next();
            // Add label of this MotifFinder
            labelPanel.add(new JLabel(finder.name()));
            JLabel l = new JLabel("      ");
            l.setOpaque(true);
            l.setBackground(finder.color);
            l.setBorder(BorderFactory.createLineBorder(Color.black));
            labelPanel.add(l);
        }
        mainFrame.setVisible(true);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:uk.ac.ucl.chem.ccs.clinicalgui.ClinicalGuiClient.java

protected void startup() {
    loadProperties();//from   w ww  .ja v  a 2 s .co  m
    {
        getMainFrame().setSize(800, 700);
        //getMainFrame().setMinimumSize(new java.awt.Dimension(600, 600));
        //getMainFrame().setMaximumSize(new java.awt.Dimension(600, 600));

    }
    {
        jMenuBar1 = new JMenuBar();
        getMainFrame().setJMenuBar(jMenuBar1);
        {
            jMenu1 = new JMenu();
            jMenuBar1.add(jMenu1);
            jMenu1.setName("jMenu1");
            /*
            {
               change = new JMenuItem();
               jMenu1.add(change);
               change.setName("Change");
               change.addActionListener(new ActionListener() {
                 public void actionPerformed (ActionEvent evt) {
              PatientIdDialog pd = new PatientIdDialog(ClinicalGuiClient.this.getMainFrame());
             pd.setModal(true);
             pd.setVisible(true);
                 }
              });
            }
            */
            {
                manage = new JMenuItem();
                jMenu1.add(manage);
                manage.setName("manage");
            }
            {
                jSeparator1 = new JSeparator();
                jMenu1.add(jSeparator1);
            }
            {
                exit = new JMenuItem();
                jMenu1.add(exit);
                exit.setName("Exit");
                exit.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        closeApp();
                    }
                });
            }
        }
        {
            accessGridMenu = new JMenu();
            jMenuBar1.add(accessGridMenu);
            accessGridMenu.setName("accessGridMenu");
            {
                agToolKitLaunch = new JMenuItem();
                accessGridMenu.add(agToolKitLaunch);
                agToolKitLaunch.setName("agToolKitLaunch");
                agToolKitLaunch.setEnabled(false);
            }
            {
                configureAG = new JMenuItem();
                accessGridMenu.add(configureAG);
                configureAG.setName("configureAG");
                configureAG.setEnabled(false);
            }
        }
    }
    topPanel = new JPanel();
    GridLayout topPanelLayout = new GridLayout(1, 1);
    topPanelLayout.setColumns(1);
    topPanelLayout.setHgap(5);
    topPanelLayout.setVgap(5);
    // topPanel.setMinimumSize(new java.awt.Dimension(600, 600));
    topPanel.setPreferredSize(new java.awt.Dimension(800, 700));
    topPanel.setLayout(topPanelLayout);
    {
        mainPanel1 = new MainPanel();
        topPanel.add(mainPanel1);
    }
    show(topPanel);
}

From source file:uk.ac.ucl.chem.ccs.clinicalgui.DisplayJobPanel.java

private void initGUI() {
    if (ajo == null) {
        try {//from ww  w . j av a2s  .c  o m
            setPreferredSize(new Dimension(400, 300));
        } catch (Exception e) {
            e.printStackTrace();
        }
        //JLabel l = new JLabel("No simulation running");
        //this.add(l);
        //this.setEnabled(false);
        return;
    }
    System.out.println("I am not null: drawing the display job panel");
    try {
        TableLayout thisLayout = new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED,
                TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.FILL } });
        thisLayout.setHGap(5);
        thisLayout.setVGap(5);
        this.setLayout(thisLayout);

        {
            jPanel1 = new JPanel();
            TableLayout jPanel1Layout = new TableLayout(new double[][] {
                    { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED,
                            TableLayout.PREFERRED },
                    { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                            TableLayout.FILL } });

            jPanel1Layout.setHGap(5);
            jPanel1Layout.setVGap(5);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1.setLayout(jPanel1Layout);

            jPanel1.setBorder(BorderFactory.createEtchedBorder());
            this.add(jPanel1, "0, 0, 0, 2");
            jPanel1.setPreferredSize(new java.awt.Dimension(630, 305));
            jPanel1.setSize(630, 305);
            {
                dtails = new JPanel();
                GridLayout dtailsLayout = new GridLayout(1, 1);
                dtailsLayout.setColumns(1);
                dtailsLayout.setHgap(5);
                dtailsLayout.setVgap(5);
                dtails.setBorder(BorderFactory.createTitledBorder("Job Details"));
                jPanel1.add(dtails, "0,  0,  2,  4");
                dtails.setLayout(dtailsLayout);
                {
                    jobDetailsSP = new JScrollPane();
                    dtails.add(jobDetailsSP);
                    {
                        jPanel3 = new JPanel();
                        TableLayout jPanel3Layout = new TableLayout(
                                new double[][] { { TableLayout.PREFERRED, TableLayout.FILL },
                                        { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                        jPanel3Layout.setHGap(5);
                        jPanel3Layout.setVGap(5);
                        jPanel3.setLayout(jPanel3Layout);
                        jobDetailsSP.setViewportView(jPanel3);
                        jPanel3.setBackground(new java.awt.Color(156, 199, 219));
                        {
                            jLabel2 = new JLabel();
                            jPanel3.add(jLabel2, "0, 0");
                            jLabel2.setText("Job Start Time");
                        }
                        {
                            jLabel3 = new JLabel();
                            jPanel3.add(jLabel3, "0, 1");
                            jLabel3.setText("Resource ID");
                        }
                        {
                            jLabel4 = new JLabel();
                            jPanel3.add(jLabel4, "0, 2");
                            jLabel4.setText("Job Type");
                        }
                        {
                            jLabel5 = new JLabel();
                            jPanel3.add(jLabel5, "0, 3");
                            jLabel5.setText("Status");
                        }
                        {
                            jLabel6 = new JLabel();
                            jPanel3.add(jLabel6, "0, 4");
                            jLabel6.setText("Machine");
                        }
                        {
                            jLabel7 = new JLabel();
                            jPanel3.add(jLabel7, "0, 5");
                            jLabel7.setText("CPUs Requested");
                        }
                        {
                            jLabel8 = new JLabel();
                            jPanel3.add(jLabel8, "0, 6");
                            jLabel8.setText("Configuration File");
                        }
                        {
                            jLabel9 = new JLabel();
                            jPanel3.add(jLabel9, "0, 7");
                            jLabel9.setText("Job Arguments");
                        }
                        {
                            jLabel10 = new JLabel();
                            jPanel3.add(jLabel10, "0, 8");
                            jLabel10.setText("Job Stdout");
                        }
                        {
                            jLabel11 = new JLabel();
                            jPanel3.add(jLabel11, "0, 9");
                            jLabel11.setText("Job Stderr");
                        }
                        {
                            jLabel12 = new JLabel();
                            jPanel3.add(jLabel12, "0, 10");
                            jLabel12.setText("Job Stdin");
                        }
                        {
                            jLabel13 = new JLabel();
                            jPanel3.add(jLabel13, "0, 11");
                            jLabel13.setText("Resource Endpoint");
                        }
                        {
                            jobName = new JTextField();
                            jPanel3.add(jobName, "1, 0");
                            jobName.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobName.setOpaque(true);
                            jobName.setBackground(new java.awt.Color(255, 255, 255));
                            jobName.setEditable(false);

                        }
                        {
                            resourceID = new JTextField();
                            jPanel3.add(resourceID, "1, 1");
                            resourceID.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            resourceID.setOpaque(true);
                            resourceID.setBackground(new java.awt.Color(255, 255, 255));
                            resourceID.setEditable(false);

                        }
                        {
                            jobType = new JTextField();
                            jPanel3.add(jobType, "1, 2");
                            jobType.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobType.setBackground(new java.awt.Color(255, 255, 255));
                            jobType.setOpaque(true);
                            jobType.setEditable(false);

                        }
                        {
                            jobStatus = new JLabel();
                            jPanel3.add(jobStatus, "1, 3");
                            jobStatus.setOpaque(true);
                            jobStatus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStatus.setBackground(new java.awt.Color(255, 255, 255));
                        }
                        {
                            rm = new JTextField();
                            jPanel3.add(rm, "1, 4");
                            rm.setBackground(new java.awt.Color(255, 255, 255));
                            rm.setOpaque(true);
                            rm.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            rm.setEditable(false);

                        }
                        {
                            jobCpus = new JTextField();
                            jPanel3.add(jobCpus, "1, 5");
                            jobCpus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobCpus.setOpaque(true);
                            jobCpus.setBackground(new java.awt.Color(255, 255, 255));
                            jobCpus.setEditable(false);

                        }
                        {
                            jobConf = new JTextField();
                            jPanel3.add(jobConf, "1, 6");
                            jobConf.setBackground(new java.awt.Color(255, 255, 255));
                            jobConf.setOpaque(true);
                            jobConf.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobConf.setEditable(false);

                        }
                        {
                            jobArgs = new JTextField();
                            jPanel3.add(jobArgs, "1, 7");
                            jobArgs.setBackground(new java.awt.Color(255, 255, 255));
                            jobArgs.setOpaque(true);
                            jobArgs.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobArgs.setEditable(false);

                        }
                        {
                            jobSdtout = new JTextField();
                            jPanel3.add(jobSdtout, "1, 8");
                            jobSdtout.setBackground(new java.awt.Color(255, 255, 255));
                            jobSdtout.setOpaque(true);
                            jobSdtout.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobSdtout.setEditable(false);

                        }
                        {
                            jobStderr = new JTextField();
                            jPanel3.add(jobStderr, "1, 9");
                            jobStderr.setBackground(new java.awt.Color(255, 255, 255));
                            jobStderr.setOpaque(true);
                            jobStderr.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStderr.setEditable(false);

                        }
                        {
                            jobStdin = new JTextField();
                            jPanel3.add(jobStdin, "1, 10");
                            jobStdin.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStdin.setBackground(new java.awt.Color(255, 255, 255));
                            jobStdin.setOpaque(true);
                            jobStdin.setEditable(false);

                        }
                        {
                            jobEPR = new JTextField();
                            jPanel3.add(jobEPR, "1, 11");
                            jobEPR.setOpaque(true);
                            jobEPR.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobEPR.setBackground(new java.awt.Color(255, 255, 255));
                            jobEPR.setEditable(false);

                        }
                    }

                }
            }
            {
                controls = new JPanel();
                TableLayout controlsLayout = new TableLayout(new double[][] { { TableLayout.FILL },
                        { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                controlsLayout.setHGap(5);
                controlsLayout.setVGap(5);
                controls.setLayout(controlsLayout);
                controls.setBorder(BorderFactory.createTitledBorder("Operations"));
                jPanel1.add(controls, "3,  0,  4,  2");
                {
                    updateStatus = new JButton();
                    controls.add(updateStatus, "0, 0");
                    updateStatus.setText("Update Job Status");
                    updateStatus.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            if (updateStatus.getText().equals("Start Job")) {
                                StartCall sc = new StartCall(ajo,
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-lifetime"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-port"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-dn"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-server"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-pw"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-un"));
                                ajo = sc.makeCall();
                                updatePanel();
                            } else {
                                pollJobState();
                            }
                        }
                    });
                }
                {
                    teminateJob = new JButton();
                    controls.add(teminateJob, "0, 1");
                    teminateJob.setText("Terminate Job");
                    teminateJob.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            TerminateSimCall tsc = new TerminateSimCall(ajo.getEndPoint());
                            DisplayJobPanel.this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
                            boolean tcsstatus = tsc.makeCall();
                            DisplayJobPanel.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                            if (tcsstatus) {
                                ajo.setState(AHEJobObject.GRIDSAM_TERMINATING);
                                updateState();
                            } else {
                                ErrorMessage em = new ErrorMessage(DisplayJobPanel.this,
                                        "Error terminating job. Check log for details");
                                ;
                            }
                        }
                    });
                }
                {
                    vizButton = new JButton();
                    controls.add(vizButton, "0, 2");
                    vizButton.setText("Visualize");

                    vizButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            String h = "localhost";
                            int p = 65250;
                            int w = 1024 * 1024;

                            VizSteererWindow vs = new VizSteererWindow(h, p, w,
                                    (JFrame) DisplayJobPanel.this.getTopLevelAncestor());
                        }
                    });
                }

                {
                    deleteFiles = new JCheckBox();
                    controls.add(deleteFiles, "0, 3");
                    deleteFiles.setText("Delete staged files when destroying job");
                    deleteFiles.setFont(new java.awt.Font("Sansserif", 0, 11));
                    deleteFiles.setSelected(true);
                }
            }
            {
                polling = new JPanel();
                GridBagLayout pollingLayout = new GridBagLayout();
                pollingLayout.rowWeights = new double[] { 0.1, 0.1, 0.1, 0.1 };
                pollingLayout.rowHeights = new int[] { 7, 7, 7, 7 };
                pollingLayout.columnWeights = new double[] { 0.0, 0.1 };
                pollingLayout.columnWidths = new int[] { 109, 7 };
                polling.setBorder(BorderFactory.createTitledBorder("Status Polling"));
                jPanel1.add(polling, "3,  3,  4,  4");
                polling.setLayout(pollingLayout);
                {
                    jLabel1 = new JLabel();
                    polling.add(jLabel1,
                            new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
                                    GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                    jLabel1.setText("Set the polling interval ");
                    jLabel1.setFont(new java.awt.Font("Sansserif", 0, 11));
                }
                {
                    jSlider1 = new JSlider();
                    polling.add(jSlider1,
                            new GridBagConstraints(0, 1, 2, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST,
                                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
                    jSlider1.setMaximum(60);
                    jSlider1.setValue(0);
                    //jSlider1.setMinorTickSpacing(1);
                    //jSlider1.createStandardLabels(5);
                    Hashtable lab = new Hashtable();
                    lab.put(new Integer(0), new JLabel("0"));
                    lab.put(new Integer(20), new JLabel("10"));
                    lab.put(new Integer(40), new JLabel("20"));
                    lab.put(new Integer(60), new JLabel("30"));
                    jSlider1.setLabelTable(lab);

                    jSlider1.setPaintTicks(true);
                    jSlider1.setPaintLabels(true);
                    jSlider1.setSnapToTicks(false);
                    jSlider1.setMajorTickSpacing(2);
                    jSlider1.setFont(new java.awt.Font("Sansserif", 0, 11));
                    jSlider1.addChangeListener(new ChangeListener() {
                        public void stateChanged(ChangeEvent e) {
                            if (jSlider1.getValue() != 0) {
                                Integer i = new Integer(jSlider1.getValue());
                                time1.setText(Float.toString(i.floatValue() / 2));
                                if (pollingButton.getText().equals("Stop Polling")) {
                                    pollTimer.stop();

                                    pollTimer.setInitialDelay(jSlider1.getValue() * 30000);
                                    pollTimer.setDelay(jSlider1.getValue() * 30000);
                                    pollTimer.start();
                                }
                            } else {
                                if (pollingButton.getText().equals("Stop Polling")) {
                                    pollTimer.stop();
                                    pollingButton.setText("Start Polling");
                                }
                                time1.setText("0.0");
                            }
                        }
                    });
                }
                {
                    pollingButton = new JButton();
                    polling.add(pollingButton,
                            new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST,
                                    GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    pollingButton.setText("Start Polling");
                    pollingButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            if (jSlider1.getValue() > 0) {
                                if (pollingButton.getText().equals("Start Polling")) {
                                    pollTimer = new Timer(jSlider1.getValue() * 30000, new ActionListener() {
                                        public void actionPerformed(ActionEvent evt) {
                                            pollJobState();
                                        }
                                    });
                                    pollTimer.setInitialDelay(1);
                                    pollTimer.start();
                                    pollingButton.setText("Stop Polling");
                                } else {
                                    pollTimer.stop();
                                    pollingButton.setText("Start Polling");
                                }
                            }
                        }
                    });

                }
                {
                    time = new JLabel();
                    polling.add(time, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    time.setBackground(new java.awt.Color(255, 255, 255));
                    time.setText("Every");
                }
                {
                    jLabel14 = new JLabel();
                    polling.add(jLabel14, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    jLabel14.setText("mins");
                }
                {
                    time1 = new JLabel();
                    polling.add(time1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    time1.setText("0.0");
                    ;
                }
            }
        }
        {
            jPanel2 = new JPanel();
            GridLayout jPanel2Layout = new GridLayout(1, 1);
            jPanel2Layout.setColumns(1);
            jPanel2Layout.setHgap(5);
            jPanel2Layout.setVgap(5);
            jPanel2.setLayout(jPanel2Layout);
            TitledBorder title2;
            title2 = BorderFactory.createTitledBorder("Job Output");
            jPanel2.setBorder(title2);
            this.add(jPanel2, "0, 3, 0, 4");
            jPanel2.setPreferredSize(new java.awt.Dimension(630, 254));
            {
                jTabbedPane1 = new JTabbedPane();
                jPanel2.add(jTabbedPane1);

                {
                    gridsamStatus = new JPanel();
                    GridLayout gridsamStatusLayout = new GridLayout(1, 1);
                    gridsamStatusLayout.setColumns(1);
                    gridsamStatusLayout.setHgap(5);
                    gridsamStatusLayout.setVgap(5);
                    gridsamStatus.setLayout(gridsamStatusLayout);
                    jTabbedPane1.addTab("AHE Job Status", null, gridsamStatus, null);
                    {
                        jScrollPane1 = new JScrollPane();
                        gridsamStatus.add(jScrollPane1);
                        {
                            gridsamStatusResults = new JTextArea();
                            jScrollPane1.setViewportView(gridsamStatusResults);
                            gridsamStatusResults.setFont(new java.awt.Font("Monospaced", 0, 12));
                        }
                    }
                }
                {
                    stagedFiles = new JPanel();
                    TableLayout stagedFilesLayout = new TableLayout(new double[][] {
                            { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                    TableLayout.PREFERRED, TableLayout.PREFERRED },
                            { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                    TableLayout.FILL, TableLayout.PREFERRED } });
                    stagedFilesLayout.setHGap(5);
                    stagedFilesLayout.setVGap(5);
                    stagedFiles.setLayout(stagedFilesLayout);
                    jTabbedPane1.addTab("Staged Files", null, stagedFiles, null);
                    {
                        filesScrollPane = new JScrollPane();
                        stagedFiles.add(filesScrollPane, "0, 0, 5, 4");
                        {

                            outputFilesTable = new JTable();

                            int col1 = 0, col2 = 0;
                            int fsize = outputFilesTable.getFont().getSize() - 5;
                            Object data[][] = new Object[ajo.getOutfiles().size() + ajo.getInfiles().size()][3];

                            int i = 0;
                            if (ajo.getOutfiles() != null) {
                                Iterator it = ajo.getOutfiles().iterator();
                                while (it.hasNext()) {
                                    JobFileElement je = (JobFileElement) it.next();
                                    data[i][0] = new Boolean(true);
                                    data[i][1] = je.getName();
                                    if (je.getName().length() > col1) {
                                        col1 = je.getName().length();
                                    }
                                    String url = Tools.getUrlNoUP(je.getRemotepath());
                                    data[i][2] = url;
                                    if (url.length() > col2) {
                                        col2 = url.length();
                                    }
                                    i++;
                                }
                            }

                            if (ajo.getInfiles() != null) {
                                Iterator it = ajo.getInfiles().iterator();
                                while (it.hasNext()) {
                                    JobFileElement je = (JobFileElement) it.next();
                                    data[i][0] = new Boolean(false);
                                    data[i][1] = je.getName();
                                    if (je.getName().length() > col1) {
                                        col1 = je.getName().length();
                                    }
                                    String url = Tools.getUrlNoUP(je.getRemotepath());
                                    data[i][2] = url;
                                    if (url.length() > col2) {
                                        col2 = url.length();
                                    }
                                    i++;
                                }
                            }

                            String colNames[] = { "Download", "File Name", "File Location" };

                            TableModel outputFilesTableModel = new MyTableModel(data, colNames);
                            outputFilesTable.setIntercellSpacing(new Dimension(3, 3));
                            outputFilesTable.setModel(outputFilesTableModel);
                            outputFilesTable.getColumnModel().getColumn(0).setPreferredWidth(70);
                            outputFilesTable.getColumnModel().getColumn(1).setPreferredWidth(col1 * fsize);
                            outputFilesTable.getColumnModel().getColumn(2).setPreferredWidth(col2 * fsize);
                            outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                            filesScrollPane.setViewportView(outputFilesTable);
                            this.addComponentListener(new ComponentAdapter() {
                                public void componentResized(ComponentEvent e) {
                                    if (outputFilesTable.getWidth() < filesScrollPane.getWidth()) {
                                        outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
                                    } else {
                                        outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                                    }
                                }
                            });

                        }

                    }
                    {
                        downloadButton = new JButton();
                        stagedFiles.add(downloadButton, "5, 5");
                        downloadButton.setText("Download");
                        downloadButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                int outFileSize = ajo.getOutfiles().size();
                                for (int row = 0; row < outputFilesTable.getRowCount(); row++) {
                                    if (((Boolean) outputFilesTable.getValueAt(row, 0))
                                            .booleanValue() == true) {

                                        if (row < outFileSize) {
                                            JobFileElement je = (JobFileElement) ajo.getOutfiles()
                                                    .elementAt(row);

                                            if (fileLocation != null) {
                                                je.setLocalpath(Tools.checkURL(fileLocation) + je.getName());
                                            }

                                            downloadFiles.add(je);
                                        } else {
                                            JobFileElement je = (JobFileElement) ajo.getInfiles()
                                                    .elementAt(row - outFileSize);

                                            if (fileLocation != null) {
                                                je.setLocalpath(Tools.checkURL(fileLocation) + je.getName());
                                            }

                                            downloadFiles.add(je);
                                        }
                                    }

                                }

                                StageFilesIn task = new StageFilesIn(
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavserver"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavuser"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavpasswd"));
                                task.init(downloadFiles);

                                ProgressMonitor progressMonitor = new ProgressMonitor(DisplayJobPanel.this,
                                        "Downloading Files", null, 0, task.getLength());
                                //progressMonitor.setMillisToDecideToPopup(1);
                                progressMonitor.setMillisToPopup(100);
                                //jProgressBar1.setMaximum(task.getLength());
                                //jProgressBar1.setValue(0);

                                while (task.filesToStage()) {
                                    if (task.stageNext()) {
                                        progressMonitor.setProgress(task.getCurrent());
                                    } else {
                                        cat.error(task.getError());

                                    }

                                }

                            }
                        });

                    }
                    {
                        changeLocationButton = new JButton();
                        stagedFiles.add(changeLocationButton, "4, 5");
                        changeLocationButton.setText("Local Dir");
                        changeLocationButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                JFileChooser fc = new JFileChooser();
                                fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                                int returnVal = fc.showOpenDialog(DisplayJobPanel.this);

                                if (returnVal == JFileChooser.APPROVE_OPTION) {
                                    File file = fc.getSelectedFile();
                                    fileLocation = file.getAbsolutePath();
                                    //System.out.println(fileLocation);
                                }
                            }
                        });

                    }
                }
                {
                    if (ajo.getReGSWSEPR() != null) {

                        regSteering = new JPanel();

                        TableLayout steerLayout = new TableLayout(
                                new double[][] { { TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL,
                                        TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                        regSteering.setLayout(steerLayout);
                        steeredApp = true;
                        jTabbedPane1.addTab("ReG Steering", null, regSteering, null);
                        {
                            JLabel look = new JLabel("Steering address");
                            steerERP = new JTextField();
                            steer = new JButton("Start Steerer");
                            steer.setEnabled(false);
                            steer.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent evt) {
                                    vs = new VizSteererWindow(h, p, w,
                                            DisplayJobPanel.this.getTopLevelAncestor());
                                }
                            });

                            regSteering.add(look, "0,1");
                            regSteering.add(steerERP, "0,2");
                            regSteering.add(steer, "0,3");

                        }

                    }
                }

            }
        }
        updatePanel();
        this.setPreferredSize(new java.awt.Dimension(630, 605));
        this.setSize(630, 605);
        this.setOpaque(false);

    } catch (Exception e) {
        e.printStackTrace();
    }
}