use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.
the class AddRanksDialog method createButtonPanel.
private JPanel createButtonPanel() {
okButton = new JButton(new AbstractAction("OK") {
public void actionPerformed(ActionEvent e) {
if (validateDuplicateRankName()) {
loadRanksAndClose();
}
}
});
JButton cancelButton = new JButton(new AbstractAction("Cancel") {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
JPanel buttonPanel = LookAndFeelUtil.createOkCancelPanel(okButton, cancelButton);
LookAndFeelUtil.setDefaultOkCancelKeyStrokes(getRootPane(), okButton.getAction(), cancelButton.getAction());
getRootPane().setDefaultButton(okButton);
okButton.setEnabled(false);
return buttonPanel;
}
use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.
the class AddRanksDialog method createContents.
private void createContents() {
JPanel textFieldPanel = createTextFieldPanel();
JPanel buttonPanel = createButtonPanel();
Container contentPane = this.getContentPane();
GroupLayout layout = new GroupLayout(contentPane);
contentPane.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup().addComponent(textFieldPanel).addComponent(buttonPanel));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(textFieldPanel).addGap(0, 0, Short.MAX_VALUE).addComponent(buttonPanel));
}
use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.
the class ControlPanel method getCtrlPanelsContainer.
JPanel getCtrlPanelsContainer() {
if (ctrlPanelsContainer == null) {
ctrlPanelsContainer = new JPanel();
ctrlPanelsContainer.setLayout(cardLayout);
ctrlPanelsContainer.add(nullViewCtrlPanel, nullViewCtrlPanel.getName());
if (LookAndFeelUtil.isAquaLAF())
ctrlPanelsContainer.setOpaque(false);
}
return ctrlPanelsContainer;
}
use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.
the class PostAnalysisKnownSignaturePanel method createKnownSignatureGMTPanel.
/**
* @return Panel for choosing and loading GMT and SignatureGMT Geneset-Files
*/
private JPanel createKnownSignatureGMTPanel() {
knownSignatureGMTFileNameTextField = new JFormattedTextField();
knownSignatureGMTFileNameTextField.setColumns(15);
knownSignatureGMTFileNameTextField.setToolTipText(Messages.GMT_INSTRUCTION);
final Color textFieldForeground = knownSignatureGMTFileNameTextField.getForeground();
knownSignatureGMTFileNameTextField.addPropertyChangeListener("value", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
// if the text is red set it back to black as soon as the user starts typing
knownSignatureGMTFileNameTextField.setForeground(textFieldForeground);
}
});
JButton selectSigGMTFileButton = new JButton("Browse...");
selectSigGMTFileButton.setToolTipText(Messages.GMT_INSTRUCTION);
selectSigGMTFileButton.setActionCommand("Known Signature");
selectSigGMTFileButton.addActionListener(e -> {
parentPanel.chooseGMTFile(knownSignatureGMTFileNameTextField);
});
makeSmall(knownSignatureGMTFileNameTextField, selectSigGMTFileButton);
JPanel panel = new JPanel();
panel.setBorder(LookAndFeelUtil.createTitledBorder("SigGMT File (contains signature-genesets)"));
final GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(knownSignatureGMTFileNameTextField, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(selectSigGMTFileButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(knownSignatureGMTFileNameTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(selectSigGMTFileButton));
if (LookAndFeelUtil.isAquaLAF())
panel.setOpaque(false);
return panel;
}
use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.
the class PostAnalysisPanelMediator method showDialog.
@SuppressWarnings("serial")
public void showDialog(Component parent, CyNetworkView netView) {
final EnrichmentMap map = emManager.getEnrichmentMap(netView.getModel().getSUID());
invokeOnEDT(() -> {
final PostAnalysisInputPanel panel = panelFactory.create(map);
final JDialog dialog = new JDialog(swingApplication.getJFrame(), "Add Signature Gene Sets", ModalityType.APPLICATION_MODAL);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
JButton helpButton = SwingUtil.createOnlineHelpButton(EnrichmentMapBuildProperties.USER_MANUAL_URL, "Online Manual...", serviceRegistrar);
JButton resetButton = new JButton("Reset");
resetButton.addActionListener(e -> panel.reset());
JButton closeButton = new JButton(new AbstractAction("Close") {
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
JButton runButton = new JButton(new AbstractAction("Add") {
@Override
public void actionPerformed(ActionEvent e) {
if (panel.isReady()) {
Optional<PostAnalysisParameters> params = buildPostAnalysisParameters(panel, map, dialog);
if (params.isPresent()) {
addGeneSets(netView, params.get());
dialog.dispose();
} else {
JOptionPane.showMessageDialog(panel, "Could not run post analysis.", "EnrichmentMap: Error", JOptionPane.WARNING_MESSAGE);
}
}
}
});
JPanel buttonPanel = LookAndFeelUtil.createOkCancelPanel(runButton, closeButton, helpButton, resetButton);
dialog.getContentPane().add(panel, BorderLayout.CENTER);
dialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
LookAndFeelUtil.setDefaultOkCancelKeyStrokes(dialog.getRootPane(), runButton.getAction(), closeButton.getAction());
dialog.getRootPane().setDefaultButton(runButton);
dialog.pack();
dialog.setLocationRelativeTo(swingApplication.getJFrame());
dialog.setVisible(true);
});
}
Aggregations