private void addPathSelectionPanel() { File file = null; try { file = Install.getJarFile(); } catch (IOException e) { e.printStackTrace(); } { // label for JAR files GridBagConstraints cLabel = new GridBagConstraints(); cLabel.gridy = 0; cLabel.gridx = 0; cLabel.weightx = 1; cLabel.insets = new Insets(10, 10, 0, 0); cLabel.fill = GridBagConstraints.HORIZONTAL; add(new JLabel("Location of MEP and matconsolectl .JAR-files"), cLabel); // jar textfield GridBagConstraints cJARPath = new GridBagConstraints(); cJARPath.gridy = 1; cJARPath.gridx = 0; cJARPath.weightx = 1; cJARPath.insets = new Insets(0, 10, 0, 10); cJARPath.fill = GridBagConstraints.HORIZONTAL; jtJAR = new JTextField(file.getParent()); jtJAR.setEditable(false); add(jtJAR, cJARPath); searchJars(file.getParentFile()); // jar browser button GridBagConstraints cJARPathBrowse = new GridBagConstraints(); cJARPathBrowse.gridy = 1; cJARPathBrowse.gridx = 1; cJARPathBrowse.weightx = 0.1; cJARPathBrowse.insets = new Insets(0, 0, 0, 10); final JButton jb = new JButton("..."); jb.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showOpenDialog(jb); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); jtJAR.setText(file.toString()); searchJars(file); } } }); add(jb, cJARPathBrowse); } { // label for javaclasspath.txt GridBagConstraints cLabel = new GridBagConstraints(); cLabel.gridy = 2; cLabel.gridx = 0; cLabel.weightx = 1; cLabel.insets = new Insets(10, 10, 0, 0); cLabel.fill = GridBagConstraints.HORIZONTAL; add(new JLabel("Location of javaclasspath.txt"), cLabel); // jcp textfield File file2 = null; try { file2 = Install.getJavaClassPathTxt(); jtJCP = new JTextField(file2.toString()); txtJCP = file2; } catch (IOException ignored) { jtJCP = new JTextField(); } jtJCP.setEditable(false); GridBagConstraints cJCPPath = new GridBagConstraints(); cJCPPath.gridy = 3; cJCPPath.gridx = 0; cJCPPath.weightx = 1; cJCPPath.insets = new Insets(0, 10, 0, 10); cJCPPath.fill = GridBagConstraints.HORIZONTAL; add(jtJCP, cJCPPath); // jcp browser button GridBagConstraints cJCPPathBrowse = new GridBagConstraints(); cJCPPathBrowse.gridy = 3; cJCPPathBrowse.gridx = 1; cJCPPathBrowse.weightx = 0.1; cJCPPathBrowse.insets = new Insets(0, 0, 0, 10); final JButton jb = new JButton("..."); jb.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fc.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = fc.showOpenDialog(jb); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); if (file.getName().startsWith("javaclasspath")) { txtJCP = file; } else { txtJCP = null; } jtJCP.setText(file.toString()); checkJCPPath(); } } }); add(jb, cJCPPathBrowse); } { // label for installdir GridBagConstraints cLabel = new GridBagConstraints(); cLabel.gridy = 4; cLabel.gridx = 0; cLabel.weightx = 1; cLabel.insets = new Insets(10, 10, 0, 0); cLabel.fill = GridBagConstraints.HORIZONTAL; add(new JLabel("Installation directory"), cLabel); GridBagConstraints cID = new GridBagConstraints(); cID.gridy = 5; cID.gridx = 0; cID.weightx = 1; cID.insets = new Insets(0, 10, 0, 10); cID.fill = GridBagConstraints.HORIZONTAL; jtID = new JTextField("", 50); jtID.setEditable(false); add(jtID, cID); // jcp browser button GridBagConstraints cIDPathBrowse = new GridBagConstraints(); cIDPathBrowse.gridy = 5; cIDPathBrowse.gridx = 1; cIDPathBrowse.weightx = 0.1; cIDPathBrowse.insets = new Insets(0, 0, 0, 10); final JButton jb = new JButton("..."); jb.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showOpenDialog(jb); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); id = new File(file.toString() + "\\MEP"); jtID.setText(id.toString()); } } }); add(jb, cIDPathBrowse); } checkJARPath(); checkJCPPath(); }