Search in sources :

Example 41 with CompoundBorder

use of javax.swing.border.CompoundBorder in project vcell by virtualcell.

the class PythonConfigurationPanel2 method initialize.

private void initialize() {
    setLayout(new BorderLayout());
    Border margin = new EmptyBorder(5, 3, 1, 1);
    Border loweredEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    TitledBorder panelBorder = BorderFactory.createTitledBorder(loweredEtchedBorder, " Python Properties ");
    panelBorder.setTitleJustification(TitledBorder.LEFT);
    panelBorder.setTitlePosition(TitledBorder.TOP);
    panelBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
    JPanel mainPanel = new JPanel();
    mainPanel.setBorder(new CompoundBorder(margin, panelBorder));
    mainPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weighty = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridheight = 1;
    add(mainPanel, BorderLayout.CENTER);
    JPanel upper = new JPanel();
    // TitledBorder titleLeft = BorderFactory.createTitledBorder(loweredEtchedBorder, " Original Physiology ");
    // titleLeft.setTitleJustification(TitledBorder.LEFT);
    // titleLeft.setTitlePosition(TitledBorder.TOP);
    // upper.setBorder(titleLeft);
    upper.setLayout(new GridBagLayout());
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 0.5;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    // top, left, bottom, right
    gbc.insets = new Insets(5, 2, 2, 3);
    mainPanel.add(upper, gbc);
    // ============================================= Populating the upper group box =================
    String managedMiniconda = new File(ResourceUtil.getVcellHome(), "Miniconda").getAbsolutePath();
    String vcellPythonText = "<html>" + "Python is required for parameter estimation and other analysis.<br>" + "VCell manages a dedicated Miniconda python installation " + "at <font color=#8C001A>" + managedMiniconda + "</font>.<br>" + "</html>";
    String vcellPythonText2 = "<html>" + "For more information about Miniconda, see:" + "</html>";
    websiteLabel.setText(textContinuum);
    websiteLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    int gridy = 0;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(4, 4, 2, 10);
    upper.add(new JLabel(vcellPythonText), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(10, 4, 0, 10);
    upper.add(new JLabel(vcellPythonText2), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(0, 4, 2, 10);
    upper.add(websiteLabel, gbc);
    // --------------------------------------------------
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(4, 4, 4, 10);
    upper.add(new JLabel(""), gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    // gbc.weightx = 1;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    // top, left, bottom, right
    gbc.insets = new Insets(4, 4, 4, 10);
    upper.add(getTestConfigurationButton(), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    // gbc.weightx = 1;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(4, 4, 4, 10);
    upper.add(getInstallPythonButton(), gbc);
    // Dimension size = getTestConfigurationButton().getPreferredSize();
    // getTestConfigurationButton().setPreferredSize(size);
    // getTestConfigurationButton().setMaximumSize(size);
    // getInstallPythonButton().setSize(size);
    // getInstallPythonButton().setPreferredSize(size);
    // getInstallPythonButton().setMaximumSize(size);
    // --------------------------------------------------------
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    // fake cell used for filling all the vertical empty space
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(4, 4, 4, 10);
    upper.add(new JLabel(""), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets = new Insets(4, 4, 2, 10);
    upper.add(testConfigurationResults, gbc);
    getTestConfigurationButton().addActionListener(eventHandler);
    getInstallPythonButton().addActionListener(eventHandler);
    addFocusListener(eventHandler);
    websiteLabel.addMouseListener(eventHandler);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) TitledBorder(javax.swing.border.TitledBorder) Cursor(java.awt.Cursor) BorderLayout(java.awt.BorderLayout) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) Border(javax.swing.border.Border) CompoundBorder(javax.swing.border.CompoundBorder) TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder) EtchedBorder(javax.swing.border.EtchedBorder) File(java.io.File)

Example 42 with CompoundBorder

use of javax.swing.border.CompoundBorder in project vcell by virtualcell.

the class PythonConfigurationPanel3 method initialize.

private void initialize() {
    setLayout(new BorderLayout());
    Border margin = new EmptyBorder(5, 3, 1, 1);
    Border loweredEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    TitledBorder panelBorder = BorderFactory.createTitledBorder(loweredEtchedBorder, " Python Properties ");
    panelBorder.setTitleJustification(TitledBorder.LEFT);
    panelBorder.setTitlePosition(TitledBorder.TOP);
    panelBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
    JPanel jpanel = new JPanel();
    jpanel.setBorder(new CompoundBorder(margin, panelBorder));
    add(jpanel, BorderLayout.CENTER);
    jpanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weighty = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridheight = 1;
    // =============================================================================
    // 
    // python exe
    // 
    // =============================================================================
    int gridy = 0;
    JLabel pythonExeLabel = new JLabel("<html>Python 2.7 executable (Anaconda/Miniconda preferred)</html>");
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = 2;
    gbc.weightx = 0.5;
    // top, left bottom, right
    gbc.insets = new Insets(4, 4, 2, 4);
    jpanel.add(pythonExeLabel, gbc);
    gridy++;
    pythonExeTextField = new JTextField();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = 1;
    gbc.weightx = 0.5;
    gbc.ipady = 1;
    gbc.insets = new Insets(4, 4, 2, 2);
    jpanel.add(pythonExeTextField, gbc);
    // pythonExeTextField.addActionListener((ActionEvent e) -> { VCellConfiguration.setFileProperty(PropertyLoader.pythonExe, new File(pythonExeTextField.getText())); });
    pythonExeTextField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            String text = pythonExeTextField.getText();
            if (text == null || text.isEmpty()) {
                File fileProperty = VCellConfiguration.resetFileProperty(PropertyLoader.pythonExe);
                VCellConfiguration.showProperties();
            } else {
                File fileProperty = VCellConfiguration.setFileProperty(PropertyLoader.pythonExe, new File(text));
            }
        }
    });
    JButton findPythonExeButton = new JButton("Browse...");
    findPythonExeButton.addActionListener((ActionEvent e) -> browsePythonExe());
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.gridwidth = 1;
    gbc.weightx = 0;
    gbc.ipady = 0;
    gbc.insets = new Insets(3, 2, 2, 4);
    jpanel.add(findPythonExeButton, gbc);
    gridy++;
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = 3;
    gbc.weightx = 1;
    // fake cell used for filling all the vertical empty space
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.WEST;
    jpanel.add(new JLabel(""), gbc);
    // -------------------------------------------------
    // JPanel buttonsPanel = new JPanel();
    // buttonsPanel.setLayout(new GridBagLayout());
    // 
    // gbc = new GridBagConstraints();
    // gbc.gridx = 0;
    // gbc.gridy = 0;
    // gbc.weightx = 1;
    // gbc.weighty = 1;		// fake cell
    // gbc.fill = GridBagConstraints.BOTH;
    // gbc.anchor = GridBagConstraints.WEST;
    // buttonsPanel.add(new JLabel(""), gbc);
    // 
    // gbc = new GridBagConstraints();
    // gbc.gridx = 1;
    // gbc.gridy = 0;
    // gbc.insets = new Insets(0, 0, 4, 2);
    // buttonsPanel.add(getRestoreButton(), gbc);
    // 
    // gbc = new GridBagConstraints();
    // gbc.gridx = 2;
    // gbc.gridy = 0;
    // gbc.insets = new Insets(0, 2, 4, 4);
    // buttonsPanel.add(getApplyButton(), gbc);
    // 
    // gridy++;
    // gbc = new GridBagConstraints();
    // gbc.gridx = 0;
    // gbc.gridy = gridy;
    // gbc.gridwidth = 3;
    // gbc.fill = GridBagConstraints.HORIZONTAL;
    // gbc.anchor = GridBagConstraints.EAST;
    // gbc.insets = new Insets(1, 1, 1, 1);
    // jpanel.add(buttonsPanel, gbc);			// add the buttons panel to the main panel
    initPythonValues();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) TitledBorder(javax.swing.border.TitledBorder) JTextField(javax.swing.JTextField) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) Border(javax.swing.border.Border) CompoundBorder(javax.swing.border.CompoundBorder) TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder) EtchedBorder(javax.swing.border.EtchedBorder) File(java.io.File)

Example 43 with CompoundBorder

use of javax.swing.border.CompoundBorder in project vcell by virtualcell.

the class VisItConfigurationPanel method initialize.

private void initialize() {
    setLayout(new BorderLayout());
    Border margin = new EmptyBorder(5, 3, 1, 1);
    Border loweredEtchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    TitledBorder panelBorder = BorderFactory.createTitledBorder(loweredEtchedBorder, " VisIt Properties ");
    panelBorder.setTitleJustification(TitledBorder.LEFT);
    panelBorder.setTitlePosition(TitledBorder.TOP);
    panelBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
    JPanel jpanel = new JPanel();
    jpanel.setBorder(new CompoundBorder(margin, panelBorder));
    add(jpanel, BorderLayout.CENTER);
    jpanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weighty = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridheight = 1;
    // =============================================================================
    // 
    // visit exe
    // 
    // =============================================================================
    int gridy = 0;
    JLabel visitExeLabel = new JLabel("<html>VisIt executable, see <a href='https://wci.llnl.gov/simulation/computer-codes/visit'>VisIt</a> at LLNL (llnl.gov)</html>");
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = 2;
    gbc.weightx = 0.5;
    // top, left bottom, right
    gbc.insets = new Insets(4, 4, 2, 4);
    jpanel.add(visitExeLabel, gbc);
    gridy++;
    visitExeTextField = new JTextField();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = 1;
    gbc.weightx = 0.5;
    gbc.ipady = 1;
    gbc.insets = new Insets(4, 4, 2, 2);
    jpanel.add(visitExeTextField, gbc);
    // visitExeTextField.addActionListener((ActionEvent e) -> { VCellConfiguration.setFileProperty(PropertyLoader.visitExe, new File(visitExeTextField.getText())); });
    visitExeTextField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            String text = visitExeTextField.getText();
            if (text == null || text.isEmpty()) {
                File fileProperty = VCellConfiguration.resetFileProperty(PropertyLoader.visitExe);
                VCellConfiguration.showProperties();
            } else {
                File fileProperty = VCellConfiguration.setFileProperty(PropertyLoader.visitExe, new File(text));
            }
        }
    });
    JButton findVisitExeButton = new JButton("Browse...");
    findVisitExeButton.addActionListener((ActionEvent e) -> browseVisitExe());
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.gridwidth = 1;
    gbc.weightx = 0;
    gbc.ipady = 0;
    gbc.insets = new Insets(3, 2, 2, 4);
    jpanel.add(findVisitExeButton, gbc);
    gridy++;
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = 3;
    gbc.weightx = 1;
    // fake cell used for filling all the vertical empty space
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.WEST;
    jpanel.add(new JLabel(""), gbc);
    // -------------------------------------------------
    // JPanel buttonsPanel = new JPanel();
    // buttonsPanel.setLayout(new GridBagLayout());
    // 
    // gbc = new GridBagConstraints();
    // gbc.gridx = 0;
    // gbc.gridy = 0;
    // gbc.weightx = 1;
    // gbc.weighty = 1;		// fake cell
    // gbc.fill = GridBagConstraints.BOTH;
    // gbc.anchor = GridBagConstraints.WEST;
    // buttonsPanel.add(new JLabel(""), gbc);
    // 
    // gbc = new GridBagConstraints();
    // gbc.gridx = 1;
    // gbc.gridy = 0;
    // gbc.insets = new Insets(0, 0, 4, 2);
    // buttonsPanel.add(getRestoreButton(), gbc);
    // 
    // gbc = new GridBagConstraints();
    // gbc.gridx = 2;
    // gbc.gridy = 0;
    // gbc.insets = new Insets(0, 2, 4, 4);
    // buttonsPanel.add(getApplyButton(), gbc);
    // 
    // gridy++;
    // gbc = new GridBagConstraints();
    // gbc.gridx = 0;
    // gbc.gridy = gridy;
    // gbc.gridwidth = 3;
    // gbc.fill = GridBagConstraints.HORIZONTAL;
    // gbc.anchor = GridBagConstraints.EAST;
    // gbc.insets = new Insets(1, 1, 1, 1);
    // jpanel.add(buttonsPanel, gbc);			// add the buttons panel to the main panel
    initVisitValues();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) TitledBorder(javax.swing.border.TitledBorder) JTextField(javax.swing.JTextField) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) Border(javax.swing.border.Border) CompoundBorder(javax.swing.border.CompoundBorder) TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder) EtchedBorder(javax.swing.border.EtchedBorder) File(java.io.File)

Aggregations

CompoundBorder (javax.swing.border.CompoundBorder)43 EmptyBorder (javax.swing.border.EmptyBorder)23 Border (javax.swing.border.Border)20 BorderLayout (java.awt.BorderLayout)14 JLabel (javax.swing.JLabel)13 JPanel (javax.swing.JPanel)13 Insets (java.awt.Insets)10 LineBorder (javax.swing.border.LineBorder)9 GridBagConstraints (java.awt.GridBagConstraints)8 GridBagLayout (java.awt.GridBagLayout)8 JButton (javax.swing.JButton)8 TitledBorder (javax.swing.border.TitledBorder)8 ActionEvent (java.awt.event.ActionEvent)7 EtchedBorder (javax.swing.border.EtchedBorder)7 CustomLineBorder (com.intellij.ui.border.CustomLineBorder)5 ActionListener (java.awt.event.ActionListener)5 File (java.io.File)5 JTextField (javax.swing.JTextField)5 NotNull (org.jetbrains.annotations.NotNull)5 Color (java.awt.Color)4