Example usage for javax.swing JFileChooser FILES_AND_DIRECTORIES

List of usage examples for javax.swing JFileChooser FILES_AND_DIRECTORIES

Introduction

In this page you can find the example usage for javax.swing JFileChooser FILES_AND_DIRECTORIES.

Prototype

int FILES_AND_DIRECTORIES

To view the source code for javax.swing JFileChooser FILES_AND_DIRECTORIES.

Click Source Link

Document

Instruction to display both files and directories.

Usage

From source file:org.lnicholls.galleon.apps.iTunes.iTunesOptionsPanel.java

public void actionPerformed(ActionEvent e) {

    if ("pick".equals(e.getActionCommand())) {

        final JFileChooser fc = new JFileChooser();

        fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

        fc.addChoosableFileFilter(new FileFilter() {

            public boolean accept(File f) {

                if (f.isDirectory()) {

                    return true;

                } else if (f.isFile() && f.getName().toLowerCase().endsWith("xml")) {

                    return true;

                }/*from  w  w w. j  av a2 s .c  o  m*/

                return false;

            }

            //The description of this filter

            public String getDescription() {

                return "Playlist Library";

            }

        });

        int returnVal = fc.showOpenDialog(this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {

            File file = fc.getSelectedFile();

            mPlaylistPathField.setText(file.getAbsolutePath());

        }

    }

}

From source file:org.martin.ftp.gui.GUIClient.java

private void btnFolderOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFolderOptionActionPerformed

    dialogUploadOptions.hide();//from   w ww.  ja va  2  s.c o m
    fileChoos.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    fileChoos.showOpenDialog(formManagement);
    File[] selectedFiles = fileChoos.getSelectedFiles();

    if (selectedFiles != null) {

        tUploader = new Thread(() -> {
            try {
                for (File file : selectedFiles) {
                    if (file.isDirectory())
                        linker.uploadFolder(file, linker.getWorkingDirectory());

                    else
                        linker.uploadFile(file, directorioActual);
                }
                updateTable();
            } catch (IOException ex) {
                Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
            }
        });
        tUploader.start();
        threadsUploaders.add(tUploader);
    }
}

From source file:org.omegat.gui.main.ProjectUICommands.java

/**
 * Imports the file/files/folder into project's source files.
 *///w  ww .jav a  2  s.c o m
public static void doPromptImportSourceFiles() {
    OmegaTFileChooser chooser = new OmegaTFileChooser();
    chooser.setMultiSelectionEnabled(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    chooser.setDialogTitle(OStrings.getString("TF_FILE_IMPORT_TITLE"));

    int result = chooser.showOpenDialog(Core.getMainWindow().getApplicationFrame());
    if (result == OmegaTFileChooser.APPROVE_OPTION) {
        File[] selFiles = chooser.getSelectedFiles();
        projectImportFiles(Core.getProject().getProjectProperties().getSourceRoot(), selFiles);
    }
}

From source file:org.opencms.applet.upload.FileUploadApplet.java

/**
 * @see java.lang.Runnable#run()//from  w w w.j a v  a 2 s  .  com
 */
public void run() {

    try {
        boolean ok = true;
        while (ok) {
            ok = true;

            m_message = "";
            m_resources = 0;
            m_step = 0;
            // create a new file chooser

            if (m_fileSelector == null) {
                m_fileSelector = new UploadAppletFileChooser(this);
            }

            // file selector can read files and folders
            m_fileSelector.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

            m_fileSelector.setDialogTitle(m_actionOutputSelect);

            FileFilter imageFilter = new ImageFilter();
            FileFilter officeFilter = new OfficeFilter();
            FileFilter webFilter = new WebFilter();

            // add two custom file filters (office and images) and the default filters
            m_fileSelector.addChoosableFileFilter(imageFilter);
            m_fileSelector.addChoosableFileFilter(officeFilter);
            m_fileSelector.addChoosableFileFilter(webFilter);

            m_fileSelector.setAcceptAllFileFilterUsed(true);
            // enable multi-selection of files
            m_fileSelector.setMultiSelectionEnabled(true);
            // add custom icons for file types.
            m_fileSelector.setFileView(new ImageFileView(m_opencms, m_fileExtensions));
            // add the image preview pane.
            m_fileSelector.setAccessory(new ImagePreview(m_fileSelector, m_messageNoPreview));
            if ((m_clientFolder != null) && !m_clientFolder.trim().equals("")) {
                File clientFolder = new File(m_clientFolder);
                if (clientFolder.exists() && clientFolder.isDirectory()) {
                    m_fileSelector.setCurrentDirectory(clientFolder);
                }
            }

            m_action = m_actionOutputSelect;

            // pre - selection of the filter: 
            if ((m_fileFilterSelection != null) && !m_fileFilterSelection.trim().equals("")) {
                if (WebFilter.FILTER_ID.equals(m_fileFilterSelection)) {
                    m_fileSelector.setFileFilter(webFilter);
                } else if (OfficeFilter.FILTER_ID.equals(m_fileFilterSelection)) {
                    m_fileSelector.setFileFilter(officeFilter);
                } else if (ImageFilter.FILTER_ID.equals(m_fileFilterSelection)) {
                    m_fileSelector.setFileFilter(imageFilter);
                }
            }
            repaint();
            m_overwrites = new ArrayList();
            int returnVal = m_fileSelector.showDialog(this, "OK");

            // process the results.
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                // count all resources
                m_outputMode = 1;
                m_action = m_actionOutputCount;
                repaint();

                File[] files = m_fileSelector.getSelectedFiles();
                List fileNames = new ArrayList();
                for (int i = 0; i < files.length; i++) {
                    getRelativeFilePaths(files[i], fileNames);
                }

                if (m_overwrites.size() > 0) {
                    // subtract all duplicate files first
                    files = subtractDuplicates(fileNames, m_overwrites);
                    files = addOverwrites(files,
                            ((FileSelectionPanel) m_overwriteDialog.getControlPanel().getComponent(1))
                                    .getSelectedFiles());
                } else {

                    fileNames = new ArrayList();
                    for (int i = 0; i < files.length; i++) {
                        getFilesInTree(files[i], fileNames);
                    }
                    files = (File[]) fileNames.toArray(new File[fileNames.size()]);
                }

                m_resources = countResources(files);

                // create the zipfile  
                m_outputMode = 2;
                if (files.length > 0) {
                    File targetFile = createZipFile(files);
                    // check the size of the zip files
                    if ((targetFile == null) || ((m_maxsize > 0) && (targetFile.length() > m_maxsize))) {
                        // show some details in the applet itself
                        m_outputMode = 4;
                        if (targetFile == null) {
                            m_message = m_messageOutputErrorZip;
                        } else {
                            m_message = m_messageOutputErrorSize + " " + targetFile.length() + " > "
                                    + m_maxsize;
                        }
                        m_action = m_actionOutputError;
                        repaint();
                        // show an error-alertbog
                        JOptionPane.showMessageDialog(this, m_message, m_action, JOptionPane.ERROR_MESSAGE);
                    } else {
                        m_outputMode = 3;
                        m_message = m_messageOutputUpload + " (" + targetFile.length() / 1024 + " kb)";
                        repaint();
                        // upload the zipfile
                        FileUploadThread uploadThreat = new FileUploadThread();

                        uploadThreat.init(this);
                        uploadThreat.start();

                        uploadZipFile(targetFile);
                        ok = false;
                    }
                } else {
                    // zero files were selected for upload (might be that all potential overwrites were deselected)
                    ok = false;
                    getAppletContext().showDocument(new URL(m_redirectUrl), m_redirectTargetFrame);
                }

            } else {
                //the cancel button was used, so go back to the workplace
                ok = false;
                getAppletContext().showDocument(new URL(m_redirectUrl), m_redirectTargetFrame);
            }
        }
    } catch (RuntimeException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java

/**
 * Initializes the components composing the display.
 * //from w w w . j ava 2s  . c o m
 * @param filters The filters to handle.
 * @param importerAction The cancel-all-imports action.
 */
private void initComponents(FileFilter[] filters, ImporterAction importerAction) {
    canvas = new QuotaCanvas();
    sizeImportLabel = new JLabel();
    diskSpacePane = new JPanel();
    diskSpacePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
    diskSpacePane.add(UIUtilities.setTextFont(TEXT_FREE_SPACE));
    diskSpacePane.add(canvas);

    showThumbnails = new JCheckBox(TEXT_SHOW_THUMBNAILS);
    showThumbnails.setVisible(false);

    Registry registry = ImporterAgent.getRegistry();

    Boolean loadThumbnails = (Boolean) registry.lookup(LOAD_THUMBNAIL);

    if (loadThumbnails != null) {
        if (loadThumbnails.booleanValue()) {
            showThumbnails.setVisible(true);
            showThumbnails.setSelected(loadThumbnails.booleanValue());
        }
    }

    if (!isFastConnection()) // slow connection
        showThumbnails.setSelected(false);
    long groupId = -1;
    if (model.getSelectedGroup() != null)
        groupId = model.getSelectedGroup().getGroupId();
    if (groupId < 0)
        groupId = ImporterAgent.getUserDetails().getGroupId();

    locationDialog = new LocationDialog(owner, selectedContainer, type, objects, model, groupId, true);
    locationDialog.addPropertyChangeListener(this);

    int plugin = ImporterAgent.runAsPlugin();

    if (plugin == LookupNames.IMAGE_J_IMPORT || plugin == LookupNames.IMAGE_J) {
        detachedDialog = new LocationDialog(owner, selectedContainer, type, objects, model, groupId, false);
        detachedDialog.addPropertyChangeListener(this);
    }
    tagSelectionListener = new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Object src = e.getSource();
            if (src instanceof JButton) {
                TagAnnotationData tag = tagsMap.get(src);
                if (tag != null) {
                    tagsMap.remove(src);
                    handleTagsSelection(tagsMap.values());
                }
            }
        }
    };

    tabbedPane = new JTabbedPane();
    numberOfFolders = new NumericalTextField();
    numberOfFolders.setMinimum(0);
    numberOfFolders.setText("0");
    numberOfFolders.setColumns(3);
    numberOfFolders.addPropertyChangeListener(this);
    tagsMap = new LinkedHashMap<JButton, TagAnnotationData>();

    IconManager icons = IconManager.getInstance();

    refreshFilesButton = new JButton(TEXT_REFRESH_FILES);
    refreshFilesButton.setBackground(UIUtilities.BACKGROUND);
    refreshFilesButton.setToolTipText(TOOLTIP_REFRESH_FILES);
    refreshFilesButton.setActionCommand("" + CMD_REFRESH_FILES);
    refreshFilesButton.addActionListener(this);

    tagButton = new JButton(icons.getIcon(IconManager.PLUS_12));
    UIUtilities.unifiedButtonLookAndFeel(tagButton);
    tagButton.addActionListener(this);
    tagButton.setActionCommand("" + CMD_TAG);
    tagButton.setToolTipText(TOOLTIP_ADD_TAGS);
    tagsPane = new JPanel();
    tagsPane.setLayout(new BoxLayout(tagsPane, BoxLayout.Y_AXIS));

    overrideName = new JCheckBox(TEXT_OVERRIDE_FILE_NAMING);
    overrideName.setToolTipText(UIUtilities.formatToolTipText(WARNING));
    overrideName.setSelected(true);
    ButtonGroup group = new ButtonGroup();
    fullName = new JRadioButton(TEXT_NAMING_FULL_PATH);
    group.add(fullName);
    partialName = new JRadioButton();
    partialName.setText(TEXT_NAMING_PARTIAL_PATH);
    partialName.setSelected(true);
    group.add(partialName);

    table = new FileSelectionTable(this);
    table.addPropertyChangeListener(this);
    chooser = new GenericFileChooser();
    JList list = (JList) UIUtilities.findComponent(chooser, JList.class);
    KeyAdapter ka = new KeyAdapter() {

        /**
         * Adds the files to the import queue.
         * 
         * @see KeyListener#keyPressed(KeyEvent)
         */
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                handleEnterKeyPressed(e.getSource());
            }
        }
    };
    if (list != null)
        list.addKeyListener(ka);
    if (list == null) {
        JTable t = (JTable) UIUtilities.findComponent(chooser, JTable.class);
        if (t != null)
            t.addKeyListener(ka);
    }

    try {
        File f = UIUtilities.getDefaultFolder();
        if (f != null)
            chooser.setCurrentDirectory(f);
    } catch (Exception e) {
        // Ignore: could not set the default container
    }

    chooser.addPropertyChangeListener(this);
    chooser.setMultiSelectionEnabled(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    chooser.setControlButtonsAreShown(false);
    chooser.setApproveButtonText(TEXT_IMPORT);
    chooser.setApproveButtonToolTipText(TOOLTIP_IMPORT);

    bioFormatsFileFilters = new ArrayList<FileFilter>();

    if (filters != null) {
        chooser.setAcceptAllFileFilterUsed(false);

        for (FileFilter fileFilter : filters) {
            if (fileFilter instanceof ComboFileFilter) {
                bioFormatsFileFiltersCombined = fileFilter;

                ComboFileFilter comboFilter = (ComboFileFilter) fileFilter;
                FileFilter[] extensionFilters = comboFilter.getFilters();

                for (FileFilter combinedFilter : extensionFilters) {
                    bioFormatsFileFilters.add(combinedFilter);
                }
                break;
            }
        }

        chooser.addChoosableFileFilter(bioFormatsFileFiltersCombined);

        for (FileFilter fileFilter : bioFormatsFileFilters) {
            chooser.addChoosableFileFilter(fileFilter);
        }

        chooser.setFileFilter(bioFormatsFileFiltersCombined);
    } else {
        chooser.setAcceptAllFileFilterUsed(true);
    }

    closeButton = new JButton(TEXT_CLOSE);
    closeButton.setToolTipText(TOOLTIP_CLOSE);
    closeButton.setActionCommand("" + CMD_CLOSE);
    closeButton.addActionListener(this);

    cancelImportButton = new JButton(importerAction);
    importerAction.setEnabled(false);

    importButton = new JButton(TEXT_IMPORT);
    importButton.setToolTipText(TOOLTIP_IMPORT);
    importButton.setActionCommand("" + CMD_IMPORT);
    importButton.addActionListener(this);
    importButton.setEnabled(false);

    pixelsSize = new ArrayList<NumericalTextField>();
    NumericalTextField field;
    for (int i = 0; i < 3; i++) {
        field = new NumericalTextField();
        field.setNumberType(Double.class);
        field.setColumns(2);
        pixelsSize.add(field);
    }

    List<Component> boxes = UIUtilities.findComponents(chooser, JComboBox.class);
    if (boxes != null) {
        JComboBox box;
        JComboBox filterBox = null;
        Iterator<Component> i = boxes.iterator();
        while (i.hasNext()) {
            box = (JComboBox) i.next();
            Object o = box.getItemAt(0);
            if (o instanceof FileFilter) {
                filterBox = box;
                break;
            }
        }
        if (filterBox != null) {
            filterBox.addKeyListener(new KeyAdapter() {

                public void keyPressed(KeyEvent e) {
                    String value = KeyEvent.getKeyText(e.getKeyCode());
                    JComboBox box = (JComboBox) e.getSource();
                    int n = box.getItemCount();
                    FileFilter filter;
                    FileFilter selectedFilter = null;
                    String d;
                    for (int j = 0; j < n; j++) {
                        filter = (FileFilter) box.getItemAt(j);
                        d = filter.getDescription();
                        if (d.startsWith(value)) {
                            selectedFilter = filter;
                            break;
                        }
                    }
                    if (selectedFilter != null)
                        box.setSelectedItem(selectedFilter);
                }
            });
        }
    }
}

From source file:org.thelq.stackexchange.dbimport.gui.GUI.java

public GUI(Controller passedController) {
    //Initialize logger
    logAppender = new GUILogAppender(this);

    //Set our Look&Feel
    try {//from w  w w  .  j  a  va 2 s . c om
        if (SystemUtils.IS_OS_WINDOWS)
            UIManager.setLookAndFeel(new WindowsLookAndFeel());
        else
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        log.warn("Defaulting to Swing L&F due to exception", e);
    }

    this.controller = passedController;
    frame = new JFrame();
    frame.setTitle("Unified StackExchange Data Dump Importer v" + Controller.VERSION);
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    //Setup menu
    JMenuBar menuBar = new JMenuBar();
    menuAdd = new JMenuItem("Add Folders/Archives");
    menuAdd.setMnemonic(KeyEvent.VK_F);
    menuBar.add(menuAdd);
    frame.setJMenuBar(menuBar);

    //Primary panel
    FormLayout primaryLayout = new FormLayout("5dlu, pref:grow, 5dlu, 5dlu, pref",
            "pref, top:pref, pref, fill:140dlu:grow, pref, fill:80dlu");
    PanelBuilder primaryBuilder = new PanelBuilder(primaryLayout)
            .border(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    //DB Config panel
    primaryBuilder.addSeparator("Database Configuration", CC.xyw(1, 1, 2));
    FormLayout configLayout = new FormLayout("pref, 3dlu, pref:grow, 6dlu, pref",
            "pref, pref:grow, 3dlu, pref:grow, 3dlu, pref:grow, 3dlu, pref:grow, 3dlu, pref:grow, 3dlu, pref:grow");
    configLayout.setHonorsVisibility(true);
    final PanelBuilder configBuilder = new PanelBuilder(configLayout);
    configBuilder.addLabel("Server", CC.xy(1, 2), dbType = new JComboBox<DatabaseOption>(), CC.xy(3, 2));
    configBuilder.add(dbAdvanced = new JCheckBox("Show advanced options"), CC.xy(5, 2));
    configBuilder.addLabel("JDBC Connection", CC.xy(1, 4), jdbcString = new JTextField(15), CC.xyw(3, 4, 3));
    configBuilder.addLabel("Username", CC.xy(1, 6), username = new JTextField(10), CC.xy(3, 6));
    configBuilder.addLabel("Password", CC.xy(1, 8), password = new JPasswordField(10), CC.xy(3, 8));
    configBuilder.add(importButton = new JButton("Import"), CC.xywh(5, 6, 1, 3));
    //Add hidden
    JLabel dialectLabel = new JLabel("Dialect");
    dialectLabel.setVisible(false);
    configBuilder.add(dialectLabel, CC.xy(1, 10), dialect = new JTextField(10), CC.xyw(3, 10, 3));
    dialect.setVisible(false);
    JLabel driverLabel = new JLabel("Driver");
    driverLabel.setVisible(false);
    configBuilder.add(driverLabel, CC.xy(1, 12), driver = new JTextField(10) {
        @Override
        public void setText(String text) {
            if (StringUtils.isBlank(text))
                log.debug("Text is blank", new RuntimeException("Text " + text + " is blank"));
            super.setText(text);
        }
    }, CC.xyw(3, 12, 3));
    driver.setVisible(false);
    primaryBuilder.add(configBuilder.getPanel(), CC.xy(2, 2));

    //Options
    primaryBuilder.addSeparator("Options", CC.xyw(4, 1, 2));
    FormLayout optionsLayout = new FormLayout("pref, 3dlu, pref:grow", "");
    DefaultFormBuilder optionsBuilder = new DefaultFormBuilder(optionsLayout);
    optionsBuilder.append(disableCreateTables = new JCheckBox("Disable Creating Tables"), 3);
    optionsBuilder.append("Global Table Prefix", globalTablePrefix = new JTextField(7));
    optionsBuilder.append("Threads", threads = new JSpinner());
    //Save a core for the database
    int numThreads = Runtime.getRuntime().availableProcessors();
    numThreads = (numThreads != 1) ? numThreads - 1 : numThreads;
    threads.setModel(new SpinnerNumberModel(numThreads, 1, 100, 1));
    optionsBuilder.append("Batch Size", batchSize = new JSpinner());
    batchSize.setModel(new SpinnerNumberModel(500, 1, 500000, 1));
    primaryBuilder.add(optionsBuilder.getPanel(), CC.xy(5, 2));

    //Locations
    primaryBuilder.addSeparator("Dump Locations", CC.xyw(1, 3, 5));
    FormLayout locationsLayout = new FormLayout("pref, 15dlu, pref, 5dlu, pref, 5dlu, pref:grow, 2dlu, pref",
            "");
    locationsBuilder = new DefaultFormBuilder(locationsLayout, new ScrollablePanel()).background(Color.WHITE)
            .lineGapSize(Sizes.ZERO);
    locationsPane = new JScrollPane(locationsBuilder.getPanel());
    locationsPane.getViewport().setBackground(Color.white);
    locationsPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    locationsPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    primaryBuilder.add(locationsPane, CC.xyw(2, 4, 4));

    //Logger
    primaryBuilder.addSeparator("Log", CC.xyw(1, 5, 5));
    loggerText = new JTextPane();
    loggerText.setEditable(false);
    JPanel loggerTextPanel = new JPanel(new BorderLayout());
    loggerTextPanel.add(loggerText);
    JScrollPane loggerPane = new JScrollPane(loggerTextPanel);
    loggerPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    loggerPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    JPanel loggerPanePanel = new JPanel(new BorderLayout());
    loggerPanePanel.add(loggerPane);
    primaryBuilder.add(loggerPanePanel, CC.xyw(2, 6, 4));

    menuAdd.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //TODO: Allow 7z files but handle corner cases
            final JFileChooser fc = new JFileChooser();
            fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            fc.setMultiSelectionEnabled(true);
            fc.setDialogTitle("Select Folders/Archives");
            fc.addChoosableFileFilter(new FileNameExtensionFilter("Archives", "7z", "zip"));
            fc.addChoosableFileFilter(new FileFilter() {
                @Getter
                protected String description = "Folders";

                @Override
                public boolean accept(File file) {
                    return file.isDirectory();
                }
            });

            if (fc.showOpenDialog(frame) != JFileChooser.APPROVE_OPTION)
                return;

            //Add files and folders in a seperate thread while updating gui in EDT
            importButton.setEnabled(false);
            for (File curFile : fc.getSelectedFiles()) {
                DumpContainer dumpContainer = null;
                try {
                    if (curFile.isDirectory())
                        dumpContainer = new FolderDumpContainer(curFile);
                    else
                        dumpContainer = new ArchiveDumpContainer(controller, curFile);
                    controller.addDumpContainer(dumpContainer);
                } catch (Exception ex) {
                    String type = (dumpContainer != null) ? dumpContainer.getType() : "";
                    LoggerFactory.getLogger(getClass()).error("Cannot open " + type, ex);
                    String location = (dumpContainer != null) ? Utils.getLongLocation(dumpContainer) : "";
                    showErrorDialog(ex, "Cannot open " + location, curFile.getAbsolutePath());
                    continue;
                }
            }
            updateLocations();
            importButton.setEnabled(true);
        }
    });

    //Add options (Could be in a map, but this is cleaner)
    dbType.addItem(new DatabaseOption().name("MySQL 5.5.3+")
            .jdbcString("jdbc:mysql://127.0.0.1:3306/stackexchange?rewriteBatchedStatements=true")
            .dialect("org.hibernate.dialect.MySQL5Dialect").driver("com.mysql.jdbc.Driver"));
    dbType.addItem(new DatabaseOption().name("PostgreSQL 8.1")
            .jdbcString("jdbc:postgresql://127.0.0.1:5432/stackexchange")
            .dialect("org.hibernate.dialect.PostgreSQL81Dialect").driver("org.postgresql.Driver"));
    dbType.addItem(new DatabaseOption().name("PostgreSQL 8.2+")
            .jdbcString("jdbc:postgresql://127.0.0.1:5432/stackexchange")
            .dialect("org.hibernate.dialect.PostgreSQL82Dialect").driver("org.postgresql.Driver"));
    dbType.addItem(new DatabaseOption().name("SQL Server")
            .jdbcString("jbdc:jtds:mssql://127.0.0.1:1433/stackexchange")
            .dialect("org.hibernate.dialect.SQLServerDialect").driver("net.sourceforge.jtds.jdbc.Driver"));
    dbType.addItem(new DatabaseOption().name("SQL Server 2005+")
            .jdbcString("jbdc:jtds:mssql://127.0.0.1:1433/stackexchange")
            .dialect("org.hibernate.dialect.SQLServer2005Dialect").driver("net.sourceforge.jtds.jdbc.Driver"));
    dbType.addItem(new DatabaseOption().name("SQL Server 2008+")
            .jdbcString("jbdc:jtds:mssql://127.0.0.1:1433/stackexchange")
            .dialect("org.hibernate.dialect.SQLServer2008Dialect").driver("net.sourceforge.jtds.jdbc.Driver"));
    dbType.addItem(new DatabaseOption().name("H2").jdbcString("jdbc:h2:stackexchange")
            .dialect("org.hibernate.dialect.H2Dialect").driver("org.h2.Driver"));
    dbType.setSelectedItem(null);
    dbType.addItemListener(new ItemListener() {
        boolean shownMysqlWarning = false;

        public void itemStateChanged(ItemEvent e) {
            //Don't run this twice for a single select
            if (e.getStateChange() == ItemEvent.DESELECTED)
                return;

            DatabaseOption selectedOption = (DatabaseOption) dbType.getSelectedItem();
            if (selectedOption.name().startsWith("MySQL") && !shownMysqlWarning) {
                //Hide popup so you don't have to click twice on the dialog 
                dbType.setPopupVisible(false);
                JOptionPane.showMessageDialog(frame,
                        "Warning: Your server must be configured with character_set_server=utf8mb4"
                                + "\nOtherwise, data dumps that contain 4 byte UTF-8 characters will fail",
                        "MySQL Warning", JOptionPane.WARNING_MESSAGE);
                shownMysqlWarning = true;
            }

            setDbOption(selectedOption);
        }
    });

    //Show and hide advanced options with checkbox
    dbAdvanced.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean selected = ((JCheckBox) e.getSource()).isSelected();
            driver.setVisible(selected);
            ((JLabel) driver.getClientProperty("labeledBy")).setVisible(selected);
            dialect.setVisible(selected);
            ((JLabel) dialect.getClientProperty("labeledBy")).setVisible(selected);
        }
    });

    importButton.addActionListener(new ActionListener() {
        protected void showImportError(String error) {
            JOptionPane.showMessageDialog(frame, error, "Configuration Error", JOptionPane.ERROR_MESSAGE);
        }

        protected void showInputErrorDatabase(String error) {
            if (dbType.getSelectedItem() == null)
                showImportError("No dbType specified, " + StringUtils.uncapitalize(error));
            else
                showImportError(error);
        }

        public void actionPerformed(ActionEvent e) {
            boolean validationPassed = false;
            if (controller.getDumpContainers().isEmpty())
                showImportError("Please add dump folders/archives");
            else if (StringUtils.isBlank(jdbcString.getText()))
                showInputErrorDatabase("Must specify JDBC String");
            else if (StringUtils.isBlank(driver.getText()))
                showInputErrorDatabase("Must specify driver");
            else if (StringUtils.isBlank(dialect.getText()))
                showInputErrorDatabase("Must specify hibernate dialect");
            else
                validationPassed = true;

            if (!validationPassed)
                return;

            //Disable all GUI components so they can't change anything during processing
            setGuiEnabled(false);

            //Run in new thread
            controller.getGeneralThreadPool().execute(new Runnable() {
                public void run() {
                    try {
                        start();
                    } catch (final Exception e) {
                        //Show an error message box
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                LoggerFactory.getLogger(getClass()).error("Cannot import", e);
                                showErrorDialog(e, "Cannot import", null);
                            }
                        });
                    }
                    //Renable GUI
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            setGuiEnabled(true);
                        }
                    });
                }
            });
        }
    });

    //Done, init logger
    logAppender.init();
    log.info("Finished creating GUI");

    //Display
    frame.setContentPane(primaryBuilder.getPanel());
    frame.pack();
    frame.setMinimumSize(frame.getSize());

    frame.setVisible(true);
}

From source file:org.webcat.plugintester.ui.MainFrameBuilder.java

/**
 * Creates and lays out the Swing components for the window.
 *
 * @param frame the JFrame instance that will contain the components
 *//*from   ww  w  .j a v a2 s .  c o m*/
private void constructFrame(JFrame frame) {
    GridBagConstraints gridBagConstraints;

    fileChooser = new JFileChooser();
    bottomPanel = new JPanel();
    runButton = new JButton();
    mainPanel = new JPanel();
    JLabel webCatHomeLabel = new JLabel();
    webCatHomeField = new JTextField();
    webCatHomeBrowseButton = new JButton();
    JSeparator jSeparator0 = new JSeparator();
    JLabel submissionLabel = new JLabel();
    submissionField = new JTextField();
    submissionBrowseButton = new JButton();
    JSeparator jSeparator1 = new JSeparator();
    JLabel pluginsLabel = new JLabel();
    JPanel pluginsPanel = new JPanel();
    JScrollPane pluginsScrollPane = new JScrollPane();
    pluginsTable = new JTable();
    pluginAddButton = new JButton();
    pluginRemoveButton = new JButton();
    JSeparator jSeparator2 = new JSeparator();
    JTabbedPane tabPane = new JTabbedPane();
    propertiesPanel = new JPanel();
    JScrollPane propertiesScrollPane = new JScrollPane();
    propertiesEditor = new JEditorPane();
    documentationPanel = new JPanel();
    JScrollPane documentationScrollPane = new JScrollPane();
    documentationEditor = new JEditorPane();

    // File chooser
    fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    // Bottom panel
    bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));

    // Run button
    runButton.setText("Run Plug-ins");
    runButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            runButtonActionPerformed(evt);
        }
    });
    bottomPanel.add(runButton);

    frame.getContentPane().add(bottomPanel, BorderLayout.PAGE_END);

    // Main panel
    mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    mainPanel.setLayout(new GridBagLayout());

    // Web-CAT Home field
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = GridBagConstraints.RELATIVE;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    webCatHomeLabel.setText("Web-CAT Home:");
    mainPanel.add(webCatHomeLabel, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    webCatHomeField.setTransferHandler(new WebCATHomeTransferHandler());
    mainPanel.add(webCatHomeField, gridBagConstraints);

    // Web-CAT Home browse button
    webCatHomeBrowseButton.setText("Browse...");
    webCatHomeBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            webCatHomeBrowseButtonActionPerformed(evt);
        }
    });
    mainPanel.add(webCatHomeBrowseButton, new GridBagConstraints());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator0, gridBagConstraints);

    // Submission field
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = GridBagConstraints.RELATIVE;
    gridBagConstraints.anchor = GridBagConstraints.LINE_START;
    submissionLabel.setText("Submission:");
    mainPanel.add(submissionLabel, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    submissionField.setTransferHandler(new SubmissionTransferHandler());
    mainPanel.add(submissionField, gridBagConstraints);

    // Submission browse button
    submissionBrowseButton.setText("Browse...");
    submissionBrowseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            submissionBrowseButtonActionPerformed(evt);
        }
    });
    mainPanel.add(submissionBrowseButton, new GridBagConstraints());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator1, gridBagConstraints);

    // Plug-ins area
    pluginsLabel.setText("Plug-ins to run:");
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(pluginsLabel, gridBagConstraints);

    pluginsPanel.setPreferredSize(new Dimension(400, 80));
    pluginsPanel.setLayout(new GridBagLayout());

    pluginsModel = new PluginsTableModel();
    pluginsTable.setModel(pluginsModel);
    pluginsTable.setColumnSelectionAllowed(true);
    pluginsTable.getTableHeader().setReorderingAllowed(false);
    pluginsScrollPane.setViewportView(pluginsTable);
    pluginsTable.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    pluginsTable.getColumnModel().getColumn(0).setResizable(false);
    pluginsScrollPane.setTransferHandler(new PluginsTransferHandler());

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pluginsPanel.add(pluginsScrollPane, gridBagConstraints);

    pluginAddButton.setText("Add...");
    pluginAddButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            pluginAddButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = GridBagConstraints.PAGE_START;
    pluginsPanel.add(pluginAddButton, gridBagConstraints);

    pluginRemoveButton.setText("Remove");

    pluginRemoveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            pluginRemoveButtonActionPerformed(evt);
        }
    });
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = GridBagConstraints.PAGE_START;
    pluginsPanel.add(pluginRemoveButton, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 0.25;
    mainPanel.add(pluginsPanel, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(jSeparator2, gridBagConstraints);

    tabPane.setPreferredSize(new Dimension(466, 150));

    propertiesPanel.setLayout(new GridBagLayout());

    propertiesEditor.addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent e) {
            propertiesTimer.restart();
        }
    });

    propertiesTimer = new Timer(1000, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateGradingProperties();
        }
    });

    propertiesScrollPane.setViewportView(propertiesEditor);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    propertiesPanel.add(propertiesScrollPane, gridBagConstraints);

    tabPane.addTab("Properties", propertiesPanel);

    documentationPanel.setLayout(new GridBagLayout());

    documentationEditor.setContentType("text/html");
    documentationEditor.setEditable(false);
    documentationScrollPane.setViewportView(documentationEditor);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    documentationPanel.add(documentationScrollPane, gridBagConstraints);

    tabPane.addTab("Documentation", documentationPanel);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.gridheight = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weighty = 1.0;
    mainPanel.add(tabPane, gridBagConstraints);

    frame.getContentPane().add(mainPanel, BorderLayout.CENTER);

    frame.pack();
}

From source file:pdfreader.PDFReader.java

public void regionTextAllOnce(java.awt.event.ActionEvent evt) throws IOException, CryptographyException {

    JFileChooser jfc = new JFileChooser("F:\\rajmeen\\All files together\\PDF to HTML");
    jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    jfc.setSelectedFile(newFile(nameOfFile.substring(0, nameOfFile.length() - 4) + ".html"));
    jfc.showSaveDialog(PDFReader.this);
    File saveFile = jfc.getSelectedFile();
    File saveFile1 = jfc.getSelectedFile();
    String outputFileName = saveFile.toString();
    String outputFileName1;/*from w ww. j av  a 2 s.  c o  m*/
    outputFileName1 = saveFile1.toString().substring(0, (saveFile1.toString().length() - 5)) + ".xml";
    HtmlFileGen htmlFileGen = new HtmlFileGen(name, "C:\\blazeds\\tomcat\\webapps\\pictures\\",
            "localhost:8080/pictures/", getTheFileName(name), "");
    TaggedRegion tr;
    BufferedWriter xmlFile = new BufferedWriter(
            new OutputStreamWriter(new FileOutputStream(outputFileName1), "UTF8"));
    xmlFile.write("<?xml version=\"1.0\"?><Pages>");
    int tempPageNumber = -1;
    try (BufferedWriter htmlFile = new BufferedWriter(
            new OutputStreamWriter(new FileOutputStream(outputFileName), "UTF8"))) {
        for (int i = 0; i < listOfSelectedRegionInRectangle.size(); i++) {
            tr = listOfSelectedRegionInRectangle.get(i);
            if (tempPageNumber == -1)
                xmlFile.write("<Page No = \"" + tr.pageNumber + "\">");
            else if (tempPageNumber != tr.pageNumber)
                xmlFile.write("</Page><Page No = \"" + tr.pageNumber + "\">");
            //                else
            //                    xmlFile.write("<Page No = \""+tr.pageNumber+"\">");
            tempPageNumber = tr.pageNumber;
            String s = htmlFileGen.getHtmlContent(tr.pageNumber, tr.rectangle, tr.tag);
            if ("table".equals(tr.tag) || "list".equals(tr.tag)) {
                twoDRect = htmlFileGen.twoDRect;
            }
            htmlFile.write(s);
            xmlFile.write("<Region x = \"" + tr.rectangle.x + "\" y = \"" + tr.rectangle.y + "\" height = \""
                    + tr.rectangle.height + "\" width = \"" + tr.rectangle.width + "\" type = \"" + tr.tag
                    + "\">");
            xmlFile.write("<HtmlContent>" + StringEscapeUtils.escapeXml(s) + "</HtmlContent></Region>");
            //            System.out.println(s);
        }
    }
    xmlFile.write("</Page></Pages>");
    xmlFile.close();
    listOfSelectedRegionInRectangle = new ArrayList<>();
}

From source file:pdfreader.PDFReader.java

private void listExtract(java.awt.event.ActionEvent evt) {
    JFileChooser jfc = new JFileChooser("F:\\rajmeen\\All files together\\PDF to HTML");
    jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    jfc.setSelectedFile(newFile(nameOfFile.substring(0, nameOfFile.length() - 4) + ".html"));
    jfc.showSaveDialog(PDFReader.this);
    File saveFile = jfc.getSelectedFile();
    String outputFileName = saveFile.toString();
    try {/*from   w  w w . ja  v  a2 s  .  c  o  m*/
        ListExtraction list = new ListExtraction(outputFileName, 2, 2);
        PDFTextStripperByArea stripper = new PDFTextStripperByArea();
        stripper.setSortByPosition(true);
        stripper.addRegion("class1", rectangle);
        List allPages = document.getDocumentCatalog().getAllPages();
        PDPage firstPage = (PDPage) allPages.get(currentPage);
        stripper.extractRegions(firstPage);
        System.out.println("Text in the area:" + rectangle);
        String region = stripper.getTextForRegion("class1");
        System.out.println(region);
        List<TextPosition> TextinArea = stripper.getAllSelectedText();
        for (Iterator<TextPosition> it = TextinArea.iterator(); it.hasNext();) {
            TextPosition text = it.next();
            list.processTextt(text);
        }
        //            list.endOfTable();
        list.closeFile();
    } catch (Exception e) {
        System.err.println("Filed to convert Pdf to Html.");
    }
}

From source file:pdfreader.PDFReader.java

private void converttoTable(java.awt.event.ActionEvent evt) throws IOException, CryptographyException {

    JFileChooser jfc = new JFileChooser("G:/From Fuad sir DOCX to PDF");
    jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    jfc.setSelectedFile(newFile(nameOfFile.substring(0, nameOfFile.length() - 4) + ".html"));
    jfc.showSaveDialog(PDFReader.this);

    int[] regioon = null;
    ExtractTextByArea ETB = new ExtractTextByArea();
    try {//from   ww w  .  j  ava 2s  . c o  m
        regioon = ETB.extractTextByArea(name, rectangle, currentPage, 0);
    } catch (IOException | CryptographyException ex) {
        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
    }
    int positionOfRowStart[] = ETB.getPointOfRowStart();
    int numberofRows = ETB.returnNumberofRows();
    int numberofColumns = ETB.returnNumberofColumns();

    ExtractTextByColumn ETBC = new ExtractTextByColumn();
    Rectangle[] ColumnWiseRect = new Rectangle[(numberofColumns - 1) * numberofRows];
    int q = 0;
    for (int row = 0; row <= numberofRows - 1; row++) {
        for (int column = 0; column < numberofColumns - 1; column++) {
            if (column == 0 && row == 0) {
                ColumnWiseRect[q] = new Rectangle(rectangle.x, rectangle.y,
                        (regioon[column + 1] * 5 - rectangle.x) - 2, positionOfRowStart[row] - rectangle.y);
                //                    pdfPagePanel.drawrect(rectangle.x,rectangle.y,(regioon[column+1]*5-rectangle.x)-2,positionOfRowStart[row]-rectangle.y);
                //                    System.out.println("Cell["+row+"]["+column+"]:--"+ColumnWiseRect[q].x+","+ColumnWiseRect[q].y+","+ColumnWiseRect[q].width+","+ColumnWiseRect[q].height);
                //                    try {
                //                        ETBC.ExtractTextByArea(name,ColumnWiseRect[q],currentPage,row,column);
                //                    } catch (IOException ex) {
                //                        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
                //                    } catch (CryptographyException ex) {
                //                        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
                //                    }
            } else if (row == 0 && column > 0) {
                ColumnWiseRect[q] = new Rectangle(regioon[column] * 5 - 2, rectangle.y,
                        (regioon[column + 1] * 5 - regioon[column] * 5), positionOfRowStart[row] - rectangle.y);
                //                    pdfPagePanel.drawrect(regioon[column]*5-2,rectangle.y,(regioon[column+1]*5-regioon[column]*5),positionOfRowStart[row]-rectangle.y);
                //                    System.out.println("Cell["+row+"]["+column+"]:--"+ColumnWiseRect[q].x+","+ColumnWiseRect[q].y+","+ColumnWiseRect[q].width+","+ColumnWiseRect[q].height);
                //                    try {
                //                        ETBC.ExtractTextByArea(name,ColumnWiseRect[q],currentPage,row,column);
                //                    } catch (IOException ex) {
                //                        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
                //                    } catch (CryptographyException ex) {
                //                        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
                //                    }
            } else if (column == 0 && row > 0) {
                ColumnWiseRect[q] = new Rectangle(rectangle.x, positionOfRowStart[row - 1],
                        (regioon[column + 1] * 5 - rectangle.x),
                        (positionOfRowStart[row] - positionOfRowStart[row - 1]));
                //                    pdfPagePanel.drawrect(rectangle.x,positionOfRowStart[row-1]+2,(regioon[column+1]*5-rectangle.x),(positionOfRowStart[row]-positionOfRowStart[row-1]));
                //                    System.out.println("Cell["+row+"]["+column+"]:--"+ColumnWiseRect[q].x+","+ColumnWiseRect[q].y+","+ColumnWiseRect[q].width+","+ColumnWiseRect[q].height);
                //                    try {
                //                        ETBC.ExtractTextByArea(name,ColumnWiseRect[q],currentPage,row,column);
                //                    } catch (IOException ex) {
                //                        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
                //                    } catch (CryptographyException ex) {
                //                        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
                //                    }
            } else if (column > 0 && row > 0) {
                ColumnWiseRect[q] = new Rectangle(regioon[column] * 5 - 2, positionOfRowStart[row - 1],
                        (regioon[column + 1] * 5 - regioon[column] * 5),
                        (positionOfRowStart[row] - positionOfRowStart[row - 1]));
                //                    pdfPagePanel.drawrect(regioon[column]*5-2,positionOfRowStart[row-1]+2,(regioon[column+1]*5-regioon[column]*5),(positionOfRowStart[row]-positionOfRowStart[row-1]));
                //                    System.out.println("Cell["+row+"]["+column+"]:--"+ColumnWiseRect[q].x+","+ColumnWiseRect[q].y+","+ColumnWiseRect[q].width+","+ColumnWiseRect[q].height);
                //                    try {
                //                        ETBC.ExtractTextByArea(name,ColumnWiseRect[q],currentPage,row,column);
                //                    } catch (IOException ex) {
                //                        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
                //                    } catch (CryptographyException ex) {
                //                        Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
                //                    }
            }
            q++;
        }
    }

    //        pdfPagePanel.pdfpagepanelrec = ColumnWiseRect;
    //        try {
    //            ETBC.getTable(numberofRows,numberofColumns,saveFile,true);
    //        } catch (IOException ex) {
    //            Logger.getLogger(PageWrapper.class.getName()).log(Level.SEVERE, null, ex);
    //        }        
}