package ir.ac.iust.nlp.dependencyparser.utility.parsing; import ir.ac.iust.nlp.dependencyparser.BasePanel; import java.io.File; /** * * @author Mojtaba Khallash */ public class MaltSettingsPanel extends javax.swing.JPanel { /** * Creates new form MaltSettingsPanel */ public MaltSettingsPanel() { this(""); } public MaltSettingsPanel(String dir) { initComponents(); txtOptionsFile.setText(dir + File.separator + "Treebank" + File.separator + "malt_config" + File.separator + "options.xml"); txtGuidesFile.setText(dir + File.separator + "Treebank" + File.separator + "malt_config" + File.separator + "guides.xml"); setDrop(); } private void setDrop() { BasePanel.initDrop(txtOptionsFile, false); BasePanel.initDrop(txtGuidesFile, false); } public String getOptionsFile() { return txtOptionsFile.getText(); } public String getGuidesFile() { return txtGuidesFile.getText(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { lblOptionsFile = new javax.swing.JLabel(); txtOptionsFile = new javax.swing.JTextField(); btnOptionsFileBrowse = new javax.swing.JButton(); btnGuidesFileBrowse = new javax.swing.JButton(); txtGuidesFile = new javax.swing.JTextField(); lblGuidesFile = new javax.swing.JLabel(); lblOptionsFile.setText("Options File:"); txtOptionsFile.setEditable(false); btnOptionsFileBrowse.setText("..."); btnOptionsFileBrowse.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOptionsFileBrowseActionPerformed(evt); } }); btnGuidesFileBrowse.setText("..."); btnGuidesFileBrowse.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGuidesFileBrowseActionPerformed(evt); } }); txtGuidesFile.setEditable(false); lblGuidesFile.setText("Guides File:"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblOptionsFile) .addComponent(lblGuidesFile)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtOptionsFile, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) .addComponent(txtGuidesFile)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnOptionsFileBrowse, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnGuidesFileBrowse, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblOptionsFile) .addComponent(txtOptionsFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnOptionsFileBrowse)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblGuidesFile) .addComponent(txtGuidesFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnGuidesFileBrowse)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private void btnOptionsFileBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOptionsFileBrowseActionPerformed txtOptionsFile.setText(BasePanel.showFileDialog(txtOptionsFile.getText(), false)); }//GEN-LAST:event_btnOptionsFileBrowseActionPerformed private void btnGuidesFileBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuidesFileBrowseActionPerformed txtGuidesFile.setText(BasePanel.showFileDialog(txtGuidesFile.getText(), false)); }//GEN-LAST:event_btnGuidesFileBrowseActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnGuidesFileBrowse; private javax.swing.JButton btnOptionsFileBrowse; private javax.swing.JLabel lblGuidesFile; private javax.swing.JLabel lblOptionsFile; private javax.swing.JTextField txtGuidesFile; private javax.swing.JTextField txtOptionsFile; // End of variables declaration//GEN-END:variables }