List of usage examples for javax.swing BoxLayout PAGE_AXIS
int PAGE_AXIS
To view the source code for javax.swing BoxLayout PAGE_AXIS.
Click Source Link
From source file:org.geworkbench.components.lincs.LincsInterface.java
public LincsInterface() { final String lincsCwbFileName = this.getClass().getPackage().getName().replace(".", FilePathnameUtils.FILE_SEPARATOR) + FilePathnameUtils.FILE_SEPARATOR + "Lincs.cwb.xml"; setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); // temp do this, if data is there, then may be take out hideColumnList.add("P-value"); add(queryTypePanel);//from w w w . j av a 2 s. co m add(queryConditionPanel1); add(queryConditionPanel2); add(queryCommandPanel); experimental.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(experimental); group.add(computational); queryTypePanel.add(new JLabel("Query Type")); queryTypePanel.add(experimental); queryTypePanel.add(computational); queryTypePanel.add(new JLabel(" ")); JLabel viewLicenseLabel = new JLabel("<html><font color=blue><u><b>View License</b></u></font></html>"); ; queryTypePanel.add(viewLicenseLabel); viewLicenseLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { viewLicense_actionPerformed(lincsCwbFileName); } }); String url = getLincsWsdlUrl(); // String url = // "http://localhost:8080/axis2/services/LincsService?wsdl"; lincs = new Lincs(url, null, null); queryConditionPanel1.setLayout(new GridLayout(2, 7)); final JLabel tissueTypeLabel = new JLabel("Tissue Type"); final JLabel cellLineLabel = new JLabel("Cell Line"); final JLabel drug1Label = new JLabel("Drug 1"); final JLabel drug2Label = new JLabel("Drug 2"); final JLabel assayTypeLabel = new JLabel("Assay Type"); final JLabel synergyMeasurementLabel = new JLabel("Synergy Measurement Type"); final JLabel similarityAlgorithmLabel = new JLabel("Similarity Algorithm"); final JLabel blankLabel = new JLabel(""); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(drug1Label); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(blankLabel); queryConditionPanel1.add(tissueTypeLabel); queryConditionPanel1.add(cellLineLabel); queryConditionPanel1.add(drug1Search); queryConditionPanel1.add(drug2Label); queryConditionPanel1.add(assayTypeLabel); queryConditionPanel1.add(synergyMeasurementLabel); queryConditionPanel1.add(new JLabel("")); queryConditionPanel2.setLayout(new GridLayout(1, 7)); List<String> tissueTypeList = null; List<String> drug1List = null; List<String> assayTypeList = null; List<String> synergyMeasuremetnTypeList = null; List<String> similarityAlgorithmList = null; try { tissueTypeList = addAll(lincs.getAllTissueNames()); drug1List = addAll(lincs.getCompound1NamesFromExperimental(null, null)); assayTypeList = addAll(lincs.getAllAssayTypeNames()); synergyMeasuremetnTypeList = addAll(lincs.getAllMeasurementTypeNames()); similarityAlgorithmList = addAll(lincs.getALLSimilarAlgorithmNames()); } catch (Exception ex) { log.error(ex.getMessage()); } tissueTypeBox = new JList(); final JScrollPane tissueTypeBoxPanel = buildJListPanel(tissueTypeList, tissueTypeBox); cellLineBox = new JList(); final JScrollPane cellLineBoxPanel = buildJListPanel(null, cellLineBox); cellLineBox.setEnabled(false); final JScrollPane drug1BoxPanel = buildFilterJListPanel(drug1List, drug1Box); drug2Box = new JList(); final JScrollPane drug2BoxPanel = buildJListPanel(null, drug2Box); drug2Box.setEnabled(false); assayTypeBox = new JList(); final JScrollPane assayTypeBoxPanel = buildJListPanel(assayTypeList, assayTypeBox); synergyMeasurementTypeBox = new JList(); final JScrollPane synergyMeasuremetnTypeBoxPanel = buildJListPanel(synergyMeasuremetnTypeList, synergyMeasurementTypeBox); similarityAlgorithmTypeBox = new JList(); final JScrollPane similarityAlgorithmTypeBoxPanel = buildJListPanel(similarityAlgorithmList, similarityAlgorithmTypeBox); onlyTitration = new JCheckBox("Only with titration"); queryConditionPanel2.add(tissueTypeBoxPanel); queryConditionPanel2.add(cellLineBoxPanel); queryConditionPanel2.add(drug1BoxPanel); queryConditionPanel2.add(drug2BoxPanel); queryConditionPanel2.add(assayTypeBoxPanel); queryConditionPanel2.add(synergyMeasuremetnTypeBoxPanel); queryConditionPanel2.add(onlyTitration); // dynamic dependency parts tissueTypeBox.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { List<String> selectedTissueList = getSelectedValues(tissueTypeBox); List<String> cellLineDataList = null; List<String> drug1DataList = null; try { cellLineDataList = addAll(lincs.getAllCellLineNamesForTissueTypes(selectedTissueList)); if (experimental.isSelected() == true) drug1DataList = addAll( lincs.getCompound1NamesFromExperimental(selectedTissueList, null)); else drug1DataList = addAll( lincs.getCompound1NamesFromComputational(selectedTissueList, null)); } catch (Exception ex) { log.error(ex.getMessage()); } if (tissueTypeBox.getSelectedValues() != null && tissueTypeBox.getSelectedValues().length > 0) cellLineBox.setModel(new LincsListModel(cellLineDataList)); else cellLineBox.setModel(new LincsListModel(null)); cellLineBox.setEnabled(true); cellLineBox.clearSelection(); drug1Box.removeAllItems(); for (int i = 0; i < drug1DataList.size(); i++) drug1Box.addItem(drug1DataList.get(i)); drug1Box.clearSelection(); drug2Box.clearSelection(); drug2Box.setModel(new LincsListModel(null)); drug2Box.setEnabled(false); cellLineBox.ensureIndexIsVisible(0); drug1Box.ensureIndexIsVisible(0); } } }); // dynamic dependency parts cellLineBox.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { List<String> selectedTissueList = getSelectedValues(tissueTypeBox); List<String> selectedCellLineList = getSelectedValues(cellLineBox); List<String> drug1DataList = null; try { if (experimental.isSelected() == true) drug1DataList = addAll(lincs.getCompound1NamesFromExperimental(selectedTissueList, selectedCellLineList)); else drug1DataList = addAll(lincs.getCompound1NamesFromComputational(selectedTissueList, selectedCellLineList)); } catch (Exception ex) { log.error(ex.getMessage()); } drug1Box.removeAllItems(); for (int i = 0; i < drug1DataList.size(); i++) drug1Box.addItem(drug1DataList.get(i)); drug1Box.ensureIndexIsVisible(0); drug1Box.clearSelection(); drug2Box.clearSelection(); drug2Box.setModel(new LincsListModel(null)); drug2Box.setEnabled(false); } } }); // dynamic dependency parts drug1Box.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { List<String> selectedTissueList = getSelectedValues(tissueTypeBox); List<String> selectedCellLineList = getSelectedValues(cellLineBox); List<String> selectedDrug1List = getSelectedValues(drug1Box); List<String> drug2DataList = null; try { if (experimental.isSelected() == true) drug2DataList = addAll(lincs.getCompound2NamesFromExperimental(selectedTissueList, selectedCellLineList, selectedDrug1List)); else drug2DataList = addAll(lincs.getCompound2NamesFromComputational(selectedTissueList, selectedCellLineList, selectedDrug1List)); } catch (Exception ex) { log.error(ex.getMessage()); } if (drug1Box.getSelectedValues() != null && drug1Box.getSelectedValues().length > 0) drug2Box.setModel(new LincsListModel(drug2DataList)); else drug2Box.setModel(new LincsListModel(null)); drug2Box.setEnabled(true); drug2Box.ensureIndexIsVisible(0); } } }); maxResult = new JCheckBox("Max results"); maxResultNumber = new JTextField("10", 10); searchButton = new JButton("Search"); resetButton = new JButton("Reset"); colorGradient = new JCheckBox("Color gradient for Score"); queryCommandPanel.add(maxResult); queryCommandPanel.add(maxResultNumber); queryCommandPanel.add(searchButton); queryCommandPanel.add(resetButton); queryCommandPanel.add(colorGradient); resultTable = new TableViewer(experimentalColumnNames, null, hideColumnList); add(resultTable); add(resultProcessingPanel); queryResultPanel.setLayout(new BorderLayout()); // queryResultPanel.add(new JScrollPane(resultTable), // BorderLayout.CENTER); plotOptions = new JComboBox(new String[] { HEATMAP, NETWORK }); JButton plotButton = new JButton("Plot"); final JCheckBox limitNetwork = new JCheckBox("Limit network to multiply-connected pairs"); limitNetwork.setEnabled(false); limitNetwork.setVisible(false); JButton exportButton = new JButton("Export"); exportButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { List<String> hideColumns = new ArrayList<String>(); hideColumns.add("Include"); TableViewer.export(resultTable.getTable(), hideColumns, resultTable); } }); resultProcessingPanel.add(new JLabel("Plot options:")); resultProcessingPanel.add(plotOptions); resultProcessingPanel.add(plotButton); resultProcessingPanel.add(limitNetwork); resultProcessingPanel.add(exportButton); plotOptions.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (plotOptions.getSelectedItem().toString().equals(HEATMAP)) { limitNetwork.setEnabled(false); } else if (plotOptions.getSelectedItem().toString().equals(NETWORK)) { limitNetwork.setEnabled(true); } } }); plotButton.addActionListener(plotListener); colorGradient.addActionListener(colorGradientListener); computational.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { queryConditionPanel1.remove(blankLabel); queryConditionPanel1.remove(assayTypeLabel); queryConditionPanel1.remove(synergyMeasurementLabel); queryConditionPanel2.remove(assayTypeBoxPanel); queryConditionPanel2.remove(synergyMeasuremetnTypeBoxPanel); queryConditionPanel1.add(similarityAlgorithmLabel, 10); queryConditionPanel2.add(similarityAlgorithmTypeBoxPanel, 4); queryConditionPanel1.updateUI(); queryConditionPanel2.updateUI(); onlyTitration.setEnabled(false); reset(); } }); experimental.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { queryConditionPanel1.remove(similarityAlgorithmLabel); queryConditionPanel2.remove(similarityAlgorithmTypeBoxPanel); queryConditionPanel1.add(blankLabel, 6); queryConditionPanel1.add(assayTypeLabel, 11); queryConditionPanel1.add(synergyMeasurementLabel, 12); queryConditionPanel2.add(assayTypeBoxPanel, 4); queryConditionPanel2.add(synergyMeasuremetnTypeBoxPanel, 5); queryConditionPanel1.updateUI(); queryConditionPanel2.updateUI(); onlyTitration.setEnabled(true); reset(); } }); searchButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int rowLimit = 0; List<String> tissueTypes = getSelectedValues(tissueTypeBox); List<String> cellLineNames = getSelectedValues(cellLineBox); List<String> drug1Names = getSelectedValues(drug1Box); List<String> drug2Names = getSelectedValues(drug2Box); if (maxResult.isSelected()) { try { rowLimit = new Integer(maxResultNumber.getText().trim()).intValue(); } catch (NumberFormatException nbe) { JOptionPane.showMessageDialog(null, "Please enter a number."); maxResultNumber.requestFocus(); return; } } if ((drug1Names == null || drug1Names.isEmpty()) && (drug2Names == null || drug2Names.isEmpty())) { JOptionPane.showMessageDialog(null, "Please select at least one drug constraint, multiple drugs can be selected."); return; } AbstractAnalysis selectedAnalysis = new LincsSearchAnalysis(); String dataSetName = null; if (experimental.isSelected()) { selectedAnalysis.setLabel("LINCS Experimental Query"); dataSetName = "LINCS Data"; } else { selectedAnalysis.setLabel("LINCS Computational Query"); dataSetName = "LINCS Data"; } final AnalysisInvokedEvent invokeEvent = new AnalysisInvokedEvent(selectedAnalysis, dataSetName); publishAnalysisInvokedEvent(invokeEvent); try { if (experimental.isSelected()) { List<String> assayTypes = getSelectedValues(assayTypeBox); List<String> measurementTypes = getSelectedValues(synergyMeasurementTypeBox); List<ExperimentalData> dataList = lincs.getExperimentalData(tissueTypes, cellLineNames, drug1Names, drug2Names, measurementTypes, assayTypes, onlyTitration.isSelected(), rowLimit); Object[][] objects = convertExperimentalData(dataList); updateResultTable(objects); } else { List<String> similarityAlgorithmTypes = getSelectedValues(similarityAlgorithmTypeBox); List<ComputationalData> dataList = lincs.getComputationalData(tissueTypes, cellLineNames, drug1Names, drug2Names, similarityAlgorithmTypes, rowLimit); Object[][] objects = convertComputationalData(dataList); updateResultTable(objects); } publishAnalysisCompleteEvent(new AnalysisCompleteEvent(invokeEvent)); } catch (Exception ex) { log.error(ex.getMessage()); publishAnalysisAbortEvent(new AnalysisAbortEvent(invokeEvent)); } if (resultTable.getData() == null || resultTable.getData().length == 0) { JOptionPane.showMessageDialog(null, "There is no row in the database for your query.", "Empty Set", JOptionPane.INFORMATION_MESSAGE); return; } freeVariables = getFreeVariables(); } }); resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); }
From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java
private JPanel createEmptyDbPanel() { JPanel errorPanel = new JPanel(); errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.PAGE_AXIS)); errorPanel.setOpaque(false);//from ww w.j a v a 2s . co m errorPanel.add(new JLabel(noStudiesPresentInfo), JLabel.CENTER); // add button to go back to main menu! JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setOpaque(false); buttonPanel.add(createBackToMainMenuButton(), BorderLayout.WEST); errorPanel.add(Box.createVerticalStrut(20)); errorPanel.add(buttonPanel); return errorPanel; }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.queryresultspanel.QueryResultsPanel.java
/** * Inits the components./*from w ww. j ava2s. c om*/ */ public synchronized void initComponents() { while (activeFrame != null) { if (applicationService != null && applicationService.getFrameView() != null) { activeFrame = applicationService.getFrameView().getActiveFrame(); } } resultCountLabel = new JXLabel(QUERY_COUNT_PREFIX + resultSetCount + QUERY_COUNT_SUFFIX); resultCountLabel.setHorizontalTextPosition(SwingConstants.LEFT); queryTimeLabel = new JXLabel(QUERY_TIME_PREFIX + 0 + QUERY_TIME_SUFFIX); queryTimeLabel.setHorizontalTextPosition(SwingConstants.LEFT); displayDistinctResultsCheckBox = new JCheckBox( new AbstractAction("" + "Display only unique patient count") { public void actionPerformed(ActionEvent e) { renderQueryCountLabels(); } }); displayDistinctResultsCheckBox.setHorizontalAlignment(SwingConstants.LEFT); // create panels and add labels JPanel countPanel = new JPanel(); countPanel.setLayout(new BoxLayout(countPanel, BoxLayout.LINE_AXIS)); countPanel.add(resultCountLabel); countPanel.add(Box.createHorizontalGlue()); JPanel timePanel = new JPanel(); timePanel.setLayout(new BoxLayout(timePanel, BoxLayout.LINE_AXIS)); timePanel.add(Box.createHorizontalGlue()); timePanel.add(queryTimeLabel); timePanel.add(Box.createHorizontalGlue()); timePanel.add(displayDistinctResultsCheckBox); JPanel labelsPanel = new JPanel(); labelsPanel.setBorder(BorderFactory.createEmptyBorder(borderSize, borderSize, borderSize, borderSize)); labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.PAGE_AXIS)); labelsPanel.add(countPanel); labelsPanel.add(timePanel); resultSetTableModel = new ResultSetTableModel(); resultsTable = new JXTable(resultSetTableModel); // set cell renderer for columns in table setCellRenderer(); resultsTable.setColumnControlVisible(true); resultsTable.setHighlighters(HighlighterFactory.createAlternateStriping()); resultsTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { // get row at click point int row = resultsTable.rowAtPoint(e.getPoint()); if (row > -1) { // check if double click if (e.getClickCount() == 2) { // get id at row String patientId = resultSetTableModel.getValueAt(row, 0).toString(); logger.debug("Value of patientId : " + patientId); // set as active constraint patientPanel.setPatient(patientId); patientDialog.setTitle("Patient - " + patientId); patientDialog.setVisible(true); } } } }); JPanel lowerPanel = new JPanel(new BorderLayout()); lowerPanel.setBorder(BorderFactory.createTitledBorder("Query Results")); lowerPanel.add(labelsPanel, BorderLayout.NORTH); lowerPanel.add(new JScrollPane(resultsTable), BorderLayout.CENTER); // set components for view setLayout(new BorderLayout()); add(lowerPanel, BorderLayout.CENTER); // create patient panel createPatientDialog(); }
From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java
private JPanel createStudyAccessionLoadErrorPanel() { JPanel errorPanel = new JPanel(); errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.PAGE_AXIS)); errorPanel.setOpaque(false);/*from w w w. j a v a 2 s . co m*/ errorPanel.add(new JLabel(connectionProblemInfo), JLabel.CENTER); return errorPanel; }
From source file:org.isatools.isacreator.filechooser.FileChooserUI.java
private JPanel createTopPanel() { final JTextField uri = new RoundedJTextField(20); final JTextField username = new RoundedJTextField(20); final JPasswordField password = new RoundedJPasswordField(20); final JPanel topContainer = new JPanel(); topContainer.setLayout(new BoxLayout(topContainer, BoxLayout.PAGE_AXIS)); topContainer.setBackground(UIHelper.BG_COLOR); HUDTitleBar titlePanel = new HUDTitleBar(null, null, true); add(titlePanel, BorderLayout.NORTH); titlePanel.installListeners();// w w w . ja v a2 s .com topContainer.add(titlePanel); JPanel buttonPanel = new JPanel(new GridLayout(1, 1)); buttonPanel.setOpaque(false); JPanel fileSystemPanel = new JPanel(); fileSystemPanel.setLayout(new BoxLayout(fileSystemPanel, BoxLayout.LINE_AXIS)); fileSystemPanel.setBackground(UIHelper.BG_COLOR); localFsChoice = new JLabel(localFileSystemIcon, JLabel.LEFT); localFsChoice.setBackground(UIHelper.BG_COLOR); localFsChoice.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { SwingUtilities.invokeLater(new Runnable() { public void run() { localFsChoice.setIcon(localFileSystemIconOver); remoteFsChoice.setIcon(remoteFileSystemIcon); ftpConnectionContainer.setVisible(false); topContainer.revalidate(); status.setText(""); fileBrowser = new LocalBrowser(); try { updateTree(fileBrowser.getHomeDirectory()); } catch (IOException e) { FileBrowserTreeNode defaultFTPNode = new FileBrowserTreeNode("problem occurred!", false, FileBrowserTreeNode.DIRECTORY); updateTree(defaultFTPNode); } } }); } }); fileSystemPanel.add(localFsChoice); fileSystemPanel.add(Box.createHorizontalStrut(5)); remoteFsChoice = new JLabel(remoteFileSystemIcon, JLabel.LEFT); remoteFsChoice.setBackground(UIHelper.BG_COLOR); remoteFsChoice.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { SwingUtilities.invokeLater(new Runnable() { public void run() { localFsChoice.setIcon(localFileSystemIcon); remoteFsChoice.setIcon(remoteFileSystemIconOver); ftpConnectionContainer.setVisible(true); topContainer.revalidate(); } }); // immediately try to call FTP manager to get last sessions details final FTPAuthentication lastSession; if ((lastSession = ftpManager.getLastSession()) != null) { Thread remoteConnector = new Thread(new Runnable() { public void run() { connectToFTP(lastSession.getUri(), lastSession.getUsername(), lastSession.getPassword()); } }); remoteConnector.start(); } else { errorAction("no ftp location"); } } }); fileSystemPanel.add(remoteFsChoice); fileSystemPanel.add(Box.createHorizontalStrut(5)); status = UIHelper.createLabel("", UIHelper.VER_10_BOLD, UIHelper.DARK_GREEN_COLOR); status.setHorizontalAlignment(JLabel.RIGHT); fileSystemPanel.add(status); buttonPanel.add(fileSystemPanel); topContainer.add(buttonPanel); // now create panel to configure the FTP site ftpConnectionContainer = new JPanel(new GridLayout(1, 1)); ftpConnectionContainer.setBackground(UIHelper.BG_COLOR); JPanel userAuthFTP = new JPanel(); userAuthFTP.setLayout(new BoxLayout(userAuthFTP, BoxLayout.LINE_AXIS)); userAuthFTP.setOpaque(false); // add field to add URI JPanel uriPanel = new JPanel(new GridLayout(1, 2)); uriPanel.setBackground(UIHelper.BG_COLOR); JLabel uriLab = UIHelper.createLabel("FTP URI: ", UIHelper.VER_10_BOLD, UIHelper.DARK_GREEN_COLOR); UIHelper.renderComponent(uri, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false); uriPanel.add(uriLab); uriPanel.add(uri); userAuthFTP.add(uriPanel); // add field to add username JPanel usernamePanel = new JPanel(new GridLayout(1, 2)); usernamePanel.setBackground(UIHelper.BG_COLOR); JLabel usernameLab = UIHelper.createLabel("Username: ", UIHelper.VER_10_BOLD, UIHelper.DARK_GREEN_COLOR); UIHelper.renderComponent(username, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false); uriPanel.add(usernameLab); uriPanel.add(username); userAuthFTP.add(usernamePanel); // add field to add password JPanel passwordPanel = new JPanel(new GridLayout(1, 2)); passwordPanel.setBackground(UIHelper.BG_COLOR); JLabel passwordLab = UIHelper.createLabel("Password: ", UIHelper.VER_10_BOLD, UIHelper.DARK_GREEN_COLOR); UIHelper.renderComponent(password, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false); passwordPanel.add(passwordLab); passwordPanel.add(password); userAuthFTP.add(passwordPanel); JLabel connectLab = new JLabel(connectIcon); connectLab.setOpaque(false); connectLab.setToolTipText("<html><b>Connect</b><p>Connect to the FTP source defined!</p></html>"); connectLab.addMouseListener(new CommonMouseAdapter() { public void mousePressed(MouseEvent event) { super.mousePressed(event); if (uri.getText() != null && !uri.getText().trim().equals("")) { String user = (username.getText() != null) ? username.getText() : ""; String pass = (password.getPassword() != null) ? new String(password.getPassword()) : ""; final FTPAuthentication newFTPLocation = new FTPAuthentication(uri.getText(), user, pass); Thread remoteConnector = new Thread(new Runnable() { public void run() { connectToFTP(newFTPLocation.getUri(), newFTPLocation.getUsername(), newFTPLocation.getPassword()); } }); remoteConnector.start(); } } }); userAuthFTP.add(connectLab); JLabel historyLab = new JLabel(viewHistoryIcon); historyLab.setOpaque(false); historyLab.setToolTipText( "<html><b>Search previously connected to FTP locations</b><p>Connect to a previously defined FTP location</p></html>"); historyLab.addMouseListener(new CommonMouseAdapter() { public void mousePressed(MouseEvent event) { super.mousePressed(event); SelectFromFTPHistory selectFTP = new SelectFromFTPHistory(); selectFTP.addPropertyChangeListener("locationSelected", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getNewValue() != null) { final FTPAuthentication ftpRecord = ftpManager .retrieveFTPAuthenticationObject(event.getNewValue().toString()); Thread remoteConnector = new Thread(new Runnable() { public void run() { connectToFTP(ftpRecord.getUri(), ftpRecord.getUsername(), ftpRecord.getPassword()); } }); remoteConnector.start(); } } }); selectFTP.createGUI(); showJDialogAsSheet(selectFTP); } }); userAuthFTP.add(historyLab); ftpConnectionContainer.add(userAuthFTP); ftpConnectionContainer.setVisible(false); topContainer.add(ftpConnectionContainer); return topContainer; }
From source file:io.github.jeremgamer.editor.panels.components.PanelsPanel.java
public PanelsPanel(JFrame frame, final PanelSave ps) { this.ps = ps; this.frame = frame; this.setSize(new Dimension(395, frame.getHeight() - 27 - 23)); this.setLocation(300, 0); this.setBorder(BorderFactory.createTitledBorder("Edition du panneau")); JPanel content = new JPanel(); JScrollPane scroll = new JScrollPane(content); scroll.getVerticalScrollBar().setUnitIncrement(Editor.SCROLL_SPEED); scroll.setBorder(null);//from w w w.j a v a2 s.co m content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS)); scroll.setPreferredSize(new Dimension(382, frame.getHeight() - 27 - 46 - 20)); JPanel namePanel = new JPanel(); name.setPreferredSize(new Dimension(this.getWidth() - 280, 30)); name.setEditable(false); namePanel.add(new JLabel("Nom :")); namePanel.add(name); namePanel.add(Box.createRigidArea(new Dimension(10, 1))); layout.addItem("Basique"); layout.addItem("Bordures"); layout.addItem("Ligne"); layout.addItem("Colonne"); layout.addItem("Grille"); layout.addItem("Empil"); layout.setPreferredSize(new Dimension(110, 30)); layout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { @SuppressWarnings("unchecked") JComboBox<String> combo = (JComboBox<String>) event.getSource(); cl.show(advanced, listContent[combo.getSelectedIndex()]); ps.set("layout", combo.getSelectedIndex()); ActionPanel.updateLists(); } }); namePanel.add(new JLabel("Disposition :")); namePanel.add(layout); namePanel.setPreferredSize(new Dimension(365, 50)); namePanel.setMaximumSize(new Dimension(365, 50)); content.add(namePanel); advanced.setPreferredSize(new Dimension(365, 300)); advanced.setMaximumSize(new Dimension(365, 300)); advanced.add(ble, listContent[0]); advanced.add(brdle, listContent[1]); advanced.add(lle, listContent[2]); advanced.add(rle, listContent[3]); advanced.add(gle, listContent[4]); advanced.add(cle, listContent[5]); content.add(advanced); topBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { @SuppressWarnings("unchecked") JComboBox<String> combo = (JComboBox<String>) event.getSource(); ps.set("border.top", combo.getSelectedItem()); } }); leftBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { @SuppressWarnings("unchecked") JComboBox<String> combo = (JComboBox<String>) event.getSource(); ps.set("border.left", combo.getSelectedItem()); } }); centerBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { @SuppressWarnings("unchecked") JComboBox<String> combo = (JComboBox<String>) event.getSource(); ps.set("border.center", combo.getSelectedItem()); } }); rightBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { @SuppressWarnings("unchecked") JComboBox<String> combo = (JComboBox<String>) event.getSource(); ps.set("border.right", combo.getSelectedItem()); } }); bottomBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { @SuppressWarnings("unchecked") JComboBox<String> combo = (JComboBox<String>) event.getSource(); ps.set("border.bottom", combo.getSelectedItem()); } }); JPanel prefSize = new JPanel(); prefSize.setPreferredSize(new Dimension(365, 110)); prefSize.setMaximumSize(new Dimension(365, 110)); prefSize.setBorder(BorderFactory.createTitledBorder("Taille prfre")); JPanel prefSizePanel = new JPanel(); prefSizePanel.setLayout(new GridLayout(2, 4)); prefSizePanel.setPreferredSize(new Dimension(300, 55)); prefSizePanel.setMaximumSize(new Dimension(300, 55)); prefSizePanel.add(prefSizeEnabled); prefSizePanel.add(new JLabel("")); prefSizePanel.add(new JLabel("")); prefSizePanel.add(new JLabel("(en pixels)")); prefSizePanel.add(new JLabel("Largeur :")); prefSizePanel.add(prefWidth); prefSizePanel.add(new JLabel("Hauteur :")); prefSizePanel.add(prefHeight); prefWidth.setEnabled(false); prefHeight.setEnabled(false); prefSizeEnabled.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { JCheckBox check = (JCheckBox) event.getSource(); ps.set("preferredSize", check.isSelected()); prefWidth.setEnabled(check.isSelected()); prefHeight.setEnabled(check.isSelected()); } }); prefWidth.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { JSpinner spinner = (JSpinner) event.getSource(); ps.set("preferredWidth", spinner.getValue()); } }); prefHeight.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { JSpinner spinner = (JSpinner) event.getSource(); ps.set("preferredHeight", spinner.getValue()); } }); prefSize.add(prefSizePanel); content.add(prefSize); JPanel insetsPanel = new JPanel(); insetsPanel.setBorder(BorderFactory.createTitledBorder("carts")); insetsPanel.setPreferredSize(new Dimension(365, 100)); insetsPanel.setMaximumSize(new Dimension(365, 100)); JPanel insetsContent = new JPanel(); insetsContent.setLayout(new BoxLayout(insetsContent, BoxLayout.PAGE_AXIS)); JPanel insetInput = new JPanel(); insetInput.setLayout(new GridLayout(2, 4)); insetInput.add(insetsEnabled); insetInput.add(new JLabel("")); insetInput.add(new JLabel("")); insetInput.add(new JLabel("(en pixels)")); insetInput.add(new JLabel("Horizontaux :")); insetInput.add(insetHz); insetInput.add(new JLabel("Verticaux :")); insetInput.add(insetVt); insetsEnabled.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { JCheckBox check = (JCheckBox) event.getSource(); if (check.isSelected()) { insetHz.setEnabled(true); insetVt.setEnabled(true); ps.set("insets", true); } else { insetHz.setEnabled(true); insetVt.setEnabled(true); ps.set("insets", false); } } }); insetHz.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { JSpinner spinner = (JSpinner) event.getSource(); ps.set("insets.horizontal", spinner.getValue()); } }); insetVt.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { JSpinner spinner = (JSpinner) event.getSource(); ps.set("insets.vertical", spinner.getValue()); } }); insetsContent.add(insetInput); insetsPanel.add(insetsContent); content.add(insetsPanel); JPanel web = new JPanel(); web.setPreferredSize(new Dimension(365, 100)); web.setMaximumSize(new Dimension(365, 100)); web.setBorder(BorderFactory.createTitledBorder("Page Web")); JPanel webContent = new JPanel(); webContent.setLayout(new BorderLayout()); webContent.add(webEnabled, BorderLayout.NORTH); webEnabled.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JCheckBox check = (JCheckBox) e.getSource(); ps.set("web", check.isSelected()); if (check.isSelected() == true) { layout.setSelectedIndex(0); layout.setEnabled(false); ble.removeAllComponents(); ble.disableComponents(); adress.setEnabled(true); } else { ble.enableComponents(); layout.setEnabled(true); adress.setEnabled(false); } } }); JPanel webInput = new JPanel(); webInput.add(new JLabel("Adresse :")); adress.setPreferredSize(new Dimension(250, 30)); CaretListener caretUpdate = new CaretListener() { public void caretUpdate(javax.swing.event.CaretEvent e) { JTextField text = (JTextField) e.getSource(); ps.set("web.adress", text.getText()); } }; adress.addCaretListener(caretUpdate); webInput.add(adress); webContent.add(webInput, BorderLayout.CENTER); web.add(webContent); JPanel background = new JPanel(); BorderLayout bLayout = new BorderLayout(); bLayout.setVgap(12); background.setLayout(bLayout); background.setBorder(BorderFactory.createTitledBorder("Couleur de fond")); background.setPreferredSize(new Dimension(365, 210)); background.setMaximumSize(new Dimension(365, 210)); cp.setPreferredSize(new Dimension(347, 145)); cp.setMaximumSize(new Dimension(347, 145)); opaque.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JCheckBox check = (JCheckBox) e.getSource(); ps.set("background.opaque", check.isSelected()); cp.enableComponents(check.isSelected()); } }); background.add(opaque, BorderLayout.NORTH); background.add(cp, BorderLayout.CENTER); JPanel image = new JPanel(); image.setBorder(BorderFactory.createTitledBorder("Image de fond")); image.setPreferredSize(new Dimension(365, 125)); image.setMaximumSize(new Dimension(365, 125)); image.setLayout(new BorderLayout()); try { remove = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png")))); } catch (IOException e) { e.printStackTrace(); } remove.setEnabled(false); remove.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { File img = new File( "projects/" + Editor.getProjectName() + "/panels/" + name.getText() + "/background.png"); if (img.exists()) { img.delete(); } browseImage.setEnabled(true); } }); JPanel top = new JPanel(); browseImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); String path = null; JFileChooser chooser = new JFileChooser(Editor.lastPath); FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg", "bmp"); chooser.setFileFilter(filter); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int option = chooser.showOpenDialog(null); if (option == JFileChooser.APPROVE_OPTION) { path = chooser.getSelectedFile().getAbsolutePath(); Editor.lastPath = chooser.getSelectedFile().getParent(); copyImage(new File(path), "background.png"); nameBackground.setText(new File(path).getName()); ps.set("background.image", new File(path).getName()); button.setEnabled(false); size.setEnabled(true); size2.setEnabled(true); remove.setEnabled(true); } } }); bg.add(size); bg.add(size2); JPanel sizePanel = new JPanel(); sizePanel.setLayout(new BoxLayout(sizePanel, BoxLayout.PAGE_AXIS)); size.setEnabled(false); size2.setEnabled(false); sizePanel.add(size); sizePanel.add(size2); size.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { ps.set("background.size", 0); } }); size2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { ps.set("background.size", 1); } }); top.add(browseImage); top.add(sizePanel); remove.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { JButton button = (JButton) event.getSource(); new File("projects/" + Editor.getProjectName() + "/panels/" + name.getText() + "/background.png") .delete(); nameBackground.setText(""); ps.set("background.image", ""); button.setEnabled(false); } }); nameBackground.setFont(new Font("Sans Serif", Font.PLAIN, 15)); JPanel center = new JPanel(new BorderLayout()); center.add(nameBackground, BorderLayout.CENTER); center.add(remove, BorderLayout.EAST); image.add(top, BorderLayout.NORTH); image.add(center, BorderLayout.CENTER); content.add(web); content.add(background); content.add(image); this.add(scroll); }
From source file:flexflux.analyses.result.PP2DResult.java
public void plot() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); // one chart by group Map<Integer, Integer> correspGroup = new HashMap<Integer, Integer>(); XYSeriesCollection dataset = new XYSeriesCollection(); int index = 0; XYSeries series = new XYSeries(""); for (double point : fluxValues) { series.add(point, resultValues.get(point)); correspGroup.put(index, pointIndex.get(point)); index++;//w ww . j a va 2 s. com } dataset.addSeries(series); if (!expValues.isEmpty()) { XYSeries expSeries = new XYSeries("Experimental values"); if (!expValues.isEmpty()) { for (Double d : expValues.keySet()) { for (Double d2 : expValues.get(d)) { expSeries.add(d, d2); } } } dataset.addSeries(expSeries); } final JFreeChart chart = ChartFactory.createXYLineChart("", // chart // title reacName, // domain axis label objName, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.GRAY); plot.setDomainGridlinePaint(Color.GRAY); XYLineAndShapeRenderer renderer = new MyRenderer(true, false, correspGroup); plot.setRenderer(0, renderer); if (!expValues.isEmpty()) { renderer.setSeriesLinesVisible(1, false); renderer.setSeriesShapesVisible(1, true); renderer.setSeriesPaint(1, Color.BLUE); } ChartPanel chartPanel = new ChartPanel(chart); panel.add(chartPanel); JPanel fvaPanel = new JPanel(); fvaPanel.setLayout(new BoxLayout(fvaPanel, BoxLayout.PAGE_AXIS)); for (int i = 1; i <= groupIndex.size(); i++) { Color color = COLORLIST[i % COLORLIST.length]; JPanel groupPanel = new JPanel(); groupPanel.setLayout(new BoxLayout(groupPanel, BoxLayout.PAGE_AXIS)); List<BioEntity> newEssentialReactions = comparator.getNewEssentialEntities().get(i); List<BioEntity> noLongerEssentialReactions = comparator.getNoLongerEssentialEntities().get(i); JPanel colorPanel = new JPanel(); colorPanel.setBackground(color); groupPanel.add(colorPanel); groupPanel.add(new JLabel( "Phenotypic phase " + i + ", " + newEssentialReactions.size() + " new essential reactions")); fvaPanel.add(groupPanel); if (newEssentialReactions.size() > 0) { fvaPanel.add(new JScrollPane(comparator.getNewEssentialEntitiesPanel().get(i))); } fvaPanel.add(new JLabel("Phenotypic phase " + i + ", " + noLongerEssentialReactions.size() + " no longer essential reactions")); if (noLongerEssentialReactions.size() > 0) { fvaPanel.add(fvaPanel.add(new JScrollPane(comparator.getNoLongerEssentialEntitiesPanel().get(i)))); } } JScrollPane fvaScrollPane = new JScrollPane(fvaPanel); JFrame frame = new JFrame("Phenotypic phase analysis results"); if (expValues.size() > 0) { frame.setTitle("Pareto analysis two dimensions results"); } if (groupIndex.size() > 0) { JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panel, fvaScrollPane); frame.setContentPane(splitPane); frame.setSize(600, 1000); } else { frame.setContentPane(panel); frame.setSize(600, 600); } panel.setPreferredSize(new Dimension(600, 600)); panel.setMinimumSize(new Dimension(600, 600)); RefineryUtilities.centerFrameOnScreen(frame); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:moviedatas.MovieDatas.java
public JPanel createGlobalPanel() { SortPanelView sortFilterView = new SortPanelView(); FilterPanelView filterPanelView = new FilterPanelView(); JPanel sortPanel = sortFilterView.createSortPanel(); JPanel filterPanel = filterPanelView.createFilterPanel(); JPanel globalPanel = new JPanel(); globalPanel.setLayout(new BoxLayout(globalPanel, BoxLayout.PAGE_AXIS)); globalPanel.add(sortPanel);//from w ww .j av a 2 s.c om globalPanel.add(filterPanel); return globalPanel; }
From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java
private JPanel createStudySelectionPanel() { JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setOpaque(false);//from w ww.ja va2s .c o m JPanel studyAccessionSelector = new JPanel(); studyAccessionSelector.setLayout(new BorderLayout()); studyAccessionSelector.setOpaque(false); JLabel information = new JLabel(unloadStudyHeader); information.setHorizontalAlignment(SwingConstants.RIGHT); information.setVerticalAlignment(SwingConstants.TOP); studyAccessionSelector.add(information, BorderLayout.NORTH); retrieveAndProcessStudyInformation(); JScrollPane treeScroller = new JScrollPane(studyAvailabilityTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); treeScroller.getViewport().setOpaque(false); treeScroller.setOpaque(false); treeScroller.setBorder(new EmptyBorder(1, 1, 1, 1)); treeScroller.setPreferredSize(new Dimension(380, 210)); studyAccessionSelector.add(treeScroller); container.add(studyAccessionSelector); // and need a convert button! JPanel buttonCont = new JPanel(new BorderLayout()); buttonCont.setOpaque(false); final JLabel unload = new JLabel(this.unloadButton, JLabel.RIGHT); unload.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { unload.setIcon(unloadButtonOver); } public void mouseExited(MouseEvent mouseEvent) { unload.setIcon(StudyAccessionGUI.this.unloadButton); } public void mousePressed(MouseEvent mouseEvent) { Set<String> studiesToUnload = studyAvailabilityTree .getCheckedStudies(studyAvailabilityTree.getRoot()); log.info("going to unload: "); for (String acc : studiesToUnload) { log.info("study with acc " + acc); } doUnloading(studiesToUnload); } }); buttonCont.add(unload, BorderLayout.EAST); buttonCont.add(createBackToMainMenuButton(), BorderLayout.WEST); container.add(buttonCont); return container; }
From source file:pcgen.gui2.dialog.ChooserDialog.java
private void initComponents() { setTitle(chooser.getName());//from w ww . ja v a2 s. co m setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { //detach listeners from the chooser treeViewModel.setDelegate(null); listModel.setListFacade(null); chooser.getRemainingSelections().removeReferenceListener(ChooserDialog.this); } }); Container pane = getContentPane(); pane.setLayout(new BorderLayout()); JSplitPane split = new JSplitPane(); JPanel leftPane = new JPanel(new BorderLayout()); if (availTable != null) { availTable.setAutoCreateRowSorter(true); availTable.setTreeViewModel(treeViewModel); availTable.getRowSorter().toggleSortOrder(0); availTable.addActionListener(this); leftPane.add(new JScrollPane(availTable), BorderLayout.CENTER); } else { availInput.addActionListener(this); Dimension maxDim = new Dimension(Integer.MAX_VALUE, availInput.getPreferredSize().height); availInput.setMaximumSize(maxDim); JPanel availPanel = new JPanel(); availPanel.setLayout(new BoxLayout(availPanel, BoxLayout.PAGE_AXIS)); availPanel.add(Box.createRigidArea(new Dimension(10, 30))); availPanel.add(Box.createVerticalGlue()); availPanel.add(new JLabel(LanguageBundle.getString("in_uichooser_value"))); availPanel.add(availInput); availPanel.add(Box.createVerticalGlue()); leftPane.add(availPanel, BorderLayout.WEST); } JPanel buttonPane1 = new JPanel(new FlowLayout()); JButton addButton = new JButton(chooser.getAddButtonName()); addButton.setActionCommand("ADD"); addButton.addActionListener(this); buttonPane1.add(addButton); buttonPane1.add(new JLabel(Icons.Forward16.getImageIcon())); leftPane.add(buttonPane1, BorderLayout.SOUTH); split.setLeftComponent(leftPane); JPanel rightPane = new JPanel(new BorderLayout()); JPanel labelPane = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; labelPane.add(new JLabel(chooser.getSelectionCountName()), new GridBagConstraints()); remainingLabel.setText(chooser.getRemainingSelections().get().toString()); labelPane.add(remainingLabel, gbc); labelPane.add(new JLabel(chooser.getSelectedTableTitle()), gbc); rightPane.add(labelPane, BorderLayout.NORTH); list.setModel(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addActionListener(this); rightPane.add(new JScrollPane(list), BorderLayout.CENTER); JPanel buttonPane2 = new JPanel(new FlowLayout()); buttonPane2.add(new JLabel(Icons.Back16.getImageIcon())); JButton removeButton = new JButton(chooser.getRemoveButtonName()); removeButton.setActionCommand("REMOVE"); removeButton.addActionListener(this); buttonPane2.add(removeButton); rightPane.add(buttonPane2, BorderLayout.SOUTH); split.setRightComponent(rightPane); if (chooser.isInfoAvailable()) { JSplitPane infoSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); infoSplit.setTopComponent(split); infoSplit.setBottomComponent(infoPane); infoSplit.setResizeWeight(0.8); pane.add(infoSplit, BorderLayout.CENTER); if (availTable != null) { availTable.getSelectionModel().addListSelectionListener(this); } } else { pane.add(split, BorderLayout.CENTER); } JPanel bottomPane = new JPanel(new FlowLayout()); JButton button = new JButton(LanguageBundle.getString("in_ok")); //$NON-NLS-1$ button.setMnemonic(LanguageBundle.getMnemonic("in_mn_ok")); //$NON-NLS-1$ button.setActionCommand("OK"); button.addActionListener(this); bottomPane.add(button); button = new JButton(LanguageBundle.getString("in_cancel")); //$NON-NLS-1$ button.setMnemonic(LanguageBundle.getMnemonic("in_mn_cancel")); //$NON-NLS-1$ button.setActionCommand("CANCEL"); button.addActionListener(this); bottomPane.add(button); pane.add(bottomPane, BorderLayout.SOUTH); }