Example usage for javax.swing JFrame setLayout

List of usage examples for javax.swing JFrame setLayout

Introduction

In this page you can find the example usage for javax.swing JFrame setLayout.

Prototype

public void setLayout(LayoutManager manager) 

Source Link

Document

Sets the LayoutManager.

Usage

From source file:org.apache.batchee.tools.maven.DiagramMojo.java

private JFrame createWindow(final VisualizationViewer<Node, Edge> viewer, final String name) {
    viewer.setBackground(Color.WHITE);

    final DefaultModalGraphMouse<Node, Edge> gm = new DefaultModalGraphMouse<Node, Edge>();
    gm.setMode(DefaultModalGraphMouse.Mode.PICKING);
    viewer.setGraphMouse(gm);//w  ww  . j  a  v  a 2  s . c  om

    final JFrame frame = new JFrame(name + " viewer");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setLayout(new GridLayout());
    frame.getContentPane().add(viewer);
    frame.pack();

    return frame;
}

From source file:org.openuat.apps.IPSecConnectorAdmin.java

/**
  * Create the GUI and show it.  For thread safety,
  * this method should be invoked from the
  * event-dispatching thread./*from   www .j a va  2  s.  c o m*/
  */
private static void createAndShowGUI(JComponent pane) {
    //Create and set up the window.
    JFrame frame = new JFrame(" ~ ~ IPSec Admin ~ ~");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new BorderLayout());
    frame.getContentPane().add(pane, BorderLayout.CENTER);

    //Display the window.
    frame.setSize(550, 500);
    frame.setVisible(true);
}

From source file:org.openuat.apps.IPSecConnectorClient.java

private static void createAndShowGUI(CAEventsHandler selectionGui) {
    //Create and set up the window.
    JFrame frame = new JFrame(" ~ ~ IPSec Client ~ ~ ");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setLayout(new BorderLayout());
    frame.getContentPane().add(selectionGui, BorderLayout.CENTER);

    //Display the window.
    frame.setSize(400, 500);/* w  ww  .  j a v a 2 s  .com*/
    frame.setVisible(true);

}

From source file:qic.launcher.Main.java

private void startGUI(TakeDown installer) {
    TextAreaWithBackground textArea = new TextAreaWithBackground();

    JButton launchButton = new JButton("  Launch  ");
    launchButton.setEnabled(false);/*from ww w .  jav a 2 s  .co  m*/
    JProgressBar progressBar = new JProgressBar();

    launchButton.addActionListener(e -> {
        runAIC();
        System.exit(0);
    });

    JPanel southPanel = new JPanel();
    southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.X_AXIS));
    southPanel.add(progressBar);
    southPanel.add(launchButton);
    JFrame frame = new JFrame("QIC Search Updater");
    frame.setIconImage(new ImageIcon(getClass().getResource("/q.png")).getImage());
    frame.setLayout(new BorderLayout(5, 5));
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
    frame.getContentPane().add(southPanel, BorderLayout.SOUTH);
    frame.setSize(495, 445);
    frame.setLocationRelativeTo(null);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

    textArea.setText("Loading path notes...");

    String imgUrl = "http://poeqic.github.io/launcher/images/background.png";
    try {
        Image image = ImageIO.read(new URL(imgUrl));
        if (image != null)
            textArea.setBackgroundImage(image);
    } catch (IOException ex) {
        logger.error("Error while loading background image from: " + imgUrl, ex);
    }

    Worker<String> pathNotesWorker = new Worker<String>(() -> URLConnectionReader.getText(CHANGELOG_URL),
            s -> textArea.setText(s), e -> showErrorAndQuit(e));
    pathNotesWorker.execute();

    Worker<Boolean> updaterWorker = new Worker<Boolean>(() -> {
        progressBar.setIndeterminate(true);
        return installer.installOrUpdate();
    }, b -> {
        progressBar.setIndeterminate(false);
        launchButton.setEnabled(true);
    }, e -> showErrorAndQuit(e));
    updaterWorker.execute();

}

From source file:ro.nextreports.designer.action.report.ViewReportSqlAction.java

public void actionPerformed(ActionEvent e) {

    JFileChooser fc = new JFileChooser();
    fc.setDialogTitle(I18NSupport.getString("select.next.reports.file"));
    fc.setAcceptAllFileFilterUsed(false);
    fc.addChoosableFileFilter(new NextFileFilter());
    int returnVal = fc.showOpenDialog(Globals.getMainFrame());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File f = fc.getSelectedFile();
        if (f != null) {

            String sql = null;/*w  w w  .j a v a 2  s .  c  o  m*/
            String entityName = null;
            Object entity = null;
            FileInputStream fis = null;
            entityName = f.getName();
            try {
                XStream xstream = XStreamFactory.createXStream();
                fis = new FileInputStream(f);
                entity = xstream.fromXML(fis);

            } catch (Exception ex) {
                Show.error(ex);
            } finally {
                if (fis != null) {
                    try {
                        fis.close();
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
            }

            if (entityName.endsWith(QueryFilter.QUERY_EXTENSION)
                    || entityName.endsWith(ReportFilter.REPORT_EXTENSION)) {

                Report report = (Report) entity;
                if (report.getSql() != null) {
                    sql = report.getSql();
                } else if (report.getQuery() != null) {
                    SelectQuery query = report.getQuery();
                    try {
                        query.setDialect(DialectUtil.getDialect(Globals.getConnection()));
                    } catch (Exception ex) {
                        ex.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
                        LOG.error(ex.getMessage(), ex);
                    }
                    sql = query.toString();
                }

            } else if (entityName.endsWith(ChartFilter.CHART_EXTENSION)) {
                Chart chart = (Chart) entity;
                if (chart.getReport().getSql() != null) {
                    sql = chart.getReport().getSql();
                } else if (chart.getReport().getQuery() != null) {
                    SelectQuery query = chart.getReport().getQuery();
                    try {
                        query.setDialect(DialectUtil.getDialect(Globals.getConnection()));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        LOG.error(ex.getMessage(), ex);
                    }
                    sql = query.toString();
                }
            }

            Editor editor = new Editor();
            editor.setText(sql);
            editor.setPreferredSize(new Dimension(400, 400));
            JFrame frame = new JFrame(I18NSupport.getString("view.sql.info", entityName));
            frame.setIconImage(ImageUtil.getImageIcon("report_view").getImage());
            frame.setLayout(new GridBagLayout());
            frame.add(editor, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));
            frame.pack();
            Show.centrateComponent(Globals.getMainFrame(), frame);
            frame.setVisible(true);

        }
    }

}

From source file:test.uk.co.modularaudio.util.swing.lwtc.TestShowLWTCButton.java

public void go() throws Exception {

    final JFrame f = new JFrame();
    final MigLayoutStringHelper msg = new MigLayoutStringHelper();
    msg.addLayoutConstraint("fill");
    msg.addLayoutConstraint("insets 0");
    msg.addLayoutConstraint("gap 0");
    msg.addColumnConstraint("[][grow][]");
    msg.addRowConstraint("[][grow][][grow][]");
    f.setLayout(msg.createMigLayout());

    f.add(new JLabel("TL"), "center");
    f.add(new JLabel("TM"), "center");
    f.add(new JLabel("TR"), "center,wrap");
    f.add(new JLabel("ML"), "center");
    f.add(tdb, "grow");
    f.add(new JLabel("MR"), "center,wrap");

    f.add(new JLabel("BL"), "center");
    f.add(new JLabel("BM"), "center");
    f.add(new JLabel("BR"), "center,wrap");

    f.add(new JLabel("SML"), "center");
    f.add(otherButton, "grow");
    f.add(new JLabel("SMR"), "center,wrap");

    f.add(new JLabel("BL"), "center");
    f.add(new JLabel("BM"), "center");
    f.add(new JLabel("BR"), "center,wrap");

    f.pack();/*  w w w . jav a  2  s  . c  o  m*/

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            f.setVisible(true);
        }
    });
}

From source file:test.uk.co.modularaudio.util.swing.lwtc.TestShowLWTCSliderComparison.java

public void go(final int orientation) throws Exception {

    final JSlider testSwingJSlider = new JSlider(orientation);
    testSwingJSlider.setOpaque(false);/*from   www. j  a  v a2  s .  c o m*/

    final BoundedRangeModel defaultSwingSliderModel = testSwingJSlider.getModel();
    log.debug("Default swing slider model is " + defaultSwingSliderModel.toString());

    final JFrame f = new JFrame();

    f.getContentPane().setBackground(Color.decode("#3a5555"));

    final MigLayoutStringHelper msg = new MigLayoutStringHelper();
    //      msg.addLayoutConstraint( "debug" );
    msg.addLayoutConstraint("fill");
    msg.addLayoutConstraint("insets 0");
    msg.addLayoutConstraint("gap 0");
    if (orientation == SwingConstants.VERTICAL) {
        msg.addColumnConstraint("[][grow][grow][]");
        msg.addRowConstraint("[][grow][]");
    } else {
        msg.addColumnConstraint("[][grow][]");
        msg.addRowConstraint("[][grow][grow][]");
    }
    f.setLayout(msg.createMigLayout());

    f.add(new JLabel("o"), "center");
    f.add(new JLabel("o"), "center");
    if (orientation == SwingConstants.VERTICAL) {
        f.add(new JLabel("o"), "center");
    }
    f.add(new JLabel("o"), "center,wrap");

    f.add(new JLabel("o"), "center");
    if (orientation == SwingConstants.VERTICAL) {
        f.add(verticalKnobContainer, "center, grow");
        f.add(testSwingJSlider, "center, grow");
    } else {
        f.add(horizontalKnobContainer, "center, grow");
    }
    f.add(new JLabel("o"), "center,wrap");

    if (orientation == SwingConstants.HORIZONTAL) {
        f.add(new JLabel("o"), "center");
        f.add(testSwingJSlider, "center, grow");
        f.add(new JLabel("o"), "center, wrap");
    }

    f.add(new JLabel("o"), "center");
    if (orientation == SwingConstants.VERTICAL) {
        f.add(new JLabel("o"), "center");
    }
    f.add(new JLabel("o"), "center");
    f.add(new JLabel("o"), "center");

    f.pack();

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            f.setVisible(true);
        }
    });
}

From source file:test.uk.co.modularaudio.util.swing.lwtc.TestShowLWTCToggleButtonGroup.java

public void go() throws Exception {

    final JFrame f = new JFrame();
    final MigLayoutStringHelper msg = new MigLayoutStringHelper();
    msg.addLayoutConstraint("fill");
    msg.addLayoutConstraint("insets 0");
    msg.addLayoutConstraint("gap 0");
    msg.addColumnConstraint("[][grow][]");
    //      msg.addRowConstraint( "[][grow][][grow][]" );
    f.setLayout(msg.createMigLayout());

    f.add(new JLabel("TL"), "center, grow 0");
    f.add(new JLabel("TM"), "center, growy 0");
    f.add(new JLabel("TR"), "center, grow 0, wrap");

    final LWTCToggleButton[] tbs = tg.getToggleButtons();
    for (int i = 0; i < tbs.length; ++i) {
        final LWTCToggleButton tb = tbs[i];

        f.add(new JLabel("ML"), "center");
        f.add(tb, "grow");
        f.add(new JLabel("MR"), "center,wrap");
    }/* w  w w. java2  s .  com*/

    f.add(new JLabel("BL"), "center");
    f.add(new JLabel("BM"), "center");
    f.add(new JLabel("BR"), "center,wrap");

    f.pack();

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            f.setVisible(true);
        }
    });
}

From source file:TrabajoFinalJava.DescargaFichero.java

@Override
public void run() {

    //************************INICIO****INTERFAZ**************************************************************************

    JFrame principal = new JFrame("GESTOR DESCARGAS");
    //Colores// w  w w.j a v a2s . c o  m

    Color nuevoColor = new Color(167, 220, 231);

    principal.getContentPane().setBackground(nuevoColor);

    JLabel tituloPrincipal = new JLabel("GESTOR DESCARGAS");
    JLabel tituloVentana = new JLabel("DESCARGA FICHERO FTP");
    //Recojo la fuente que se esta utilizando actualmente.
    Font auxFont = tituloPrincipal.getFont();

    //Aplico la fuente actual, y al final le doy el tamao del texto...
    tituloPrincipal.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    tituloVentana.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    //tituloVentana.setAlignmentY(0);

    JLabel nombreArchivo = new JLabel("INTRODUCE EL NOMBRE DEL FICHERO A DESCARGAR.");
    JTextField nombreArchivoIn = new JTextField();
    JButton descarga = new JButton("DESCARGA FICHERO.");
    JButton atras = new JButton("ATRAS");

    JButton salir = new JButton("Salir");

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();

    //Asignamos la constante EXIT_ON_CLOSE, cierra la ventana al pulsar la X.
    principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Asignamos al JFrame el Layout que usaremos, GridBagLayout
    principal.setLayout(gridbag);
    //aadir botones al layout

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(tituloPrincipal, gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.NONE;
    principal.add(tituloVentana, gbc);

    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(nombreArchivo, gbc);

    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(nombreArchivoIn, gbc);

    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(descarga, gbc);

    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(atras, gbc);

    gbc.gridx = 1;
    gbc.gridy = 5;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(salir, gbc);

    //Hace visible el panel
    principal.setVisible(true);
    principal.setSize(650, 350);
    principal.setLocationRelativeTo(null);
    principal.setResizable(false);
    //principal.pack();

    descarga.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (descargasUsuarioLog <= 9) {
                try {
                    cFtp.connect(ftpSsrver);
                    boolean login = cFtp.login(ftpUser, ftpPass);
                    System.out.print("conexion establecida");

                    cFtp.enterLocalPassiveMode();

                    nombreFichero = nombreArchivoIn.getText();
                    nombrePc = nombreArchivoIn.getText();

                    CrearListaFicheros listarFicheros = new CrearListaFicheros();
                    listarFicheros.start();

                    for (int i = 0; i < CrearListaFicheros.arrayArchivos.size(); i++) {

                        System.out.println(CrearListaFicheros.arrayArchivos.get(i));

                    }

                    if (CrearListaFicheros.arrayArchivos.contains(nombreFichero)) {
                        FTPFile file = cFtp.mlistFile(nombreFichero);
                        long size = file.getSize();
                        System.out.println("Tamao del fichero= " + size);

                        if (size > 1000000) {
                            System.out.println("El fichero es muy grande......");
                        } else {

                            FileOutputStream fos = new FileOutputStream(nombreFichero);
                            cFtp.retrieveFile(nombreFichero, fos);

                            System.out.println("");
                            System.out.println("Archivo recibido");

                            nombreArchivoIn.setBackground(Color.green);
                            descargasUsuarioLog = descargasUsuarioLog + 1;
                            System.out.println(descargasUsuarioLog);

                            //modificamos las descargas totales del usuario en la BBDD
                            Connection conn;

                            try {
                                try {
                                    Class.forName("com.mysql.jdbc.Driver");
                                } catch (Exception y) {
                                    y.printStackTrace();
                                }

                                conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/midb", "root",
                                        "");
                                System.out.println("Conn OK!");

                                stmt = conn.createStatement();

                                stmt.executeUpdate("UPDATE usuarios SET bajadas = '" + descargasUsuarioLog
                                        + "' WHERE usuario = '" + usuarioLog + "';");

                                System.out.print("Descargas modificadas correctamente.");

                                conn.close();
                            } catch (Exception i) {
                                System.out.println(e);
                            }
                        }

                    } else {
                        System.out.println("El fichero no existe...");
                        nombreArchivoIn.setText("El fichero no existe");
                    }

                } catch (IOException r) {
                    r.printStackTrace();
                }

            } else {
                System.out.println(
                        "No te quedan descargas... por favor comuniquese con el administrador del servidor. Gracias.");
                nombreArchivoIn.setText(
                        "No te quedan descargas... por favor comuniquese con el administrador del servidor. Gracias.");

            }

        }

    });

    atras.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            FormularioAccesoFtp accesoFtp = new FormularioAccesoFtp();
            accesoFtp.inicioFtp();
            principal.setVisible(false);

        }

    });

    salir.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            System.exit(1000);

        }

    });

}

From source file:TrabajoFinalJava.FormularioVerFicheros.java

public void run() {

    //************************INICIO****INTERFAZ**************************************************************************

    JFrame principal = new JFrame("GESTOR DESCARGAS");
    //Colores/*  w w w  .  j  a  va2 s  .c om*/

    Color nuevoColor = new Color(167, 220, 231);

    principal.getContentPane().setBackground(nuevoColor);

    JLabel tituloPrincipal = new JLabel("GESTOR DESCARGAS");
    JLabel tituloVentana = new JLabel("VER FICHEROS");
    JTextArea cajaFicheros = new JTextArea(12, 20);

    JButton mostrar = new JButton("MOSTRAR FICHEROS");
    JButton atras = new JButton("ATRAS");
    JButton salir = new JButton("SALIR");

    cajaFicheros.setEditable(false);

    //Recojo la fuente que se esta utilizando actualmente.
    Font auxFont = tituloPrincipal.getFont();

    //Aplico la fuente actual, y al final le doy el tamao del texto...
    tituloPrincipal.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));
    tituloVentana.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30));

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();

    //Asignamos la constante EXIT_ON_CLOSE, cierra la ventana al pulsar la X.
    principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Asignamos al JFrame el Layout que usaremos, GridBagLayout

    principal.setLayout(gridbag);

    //aadir botones al layout

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(tituloPrincipal, gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(tituloVentana, gbc);

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    principal.add(new JScrollPane(cajaFicheros), gbc);

    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(mostrar, gbc);

    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(atras, gbc);

    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.NONE;
    principal.add(salir, gbc);

    //cajaFicheros.setEditable(false);

    //Hace visible el panel
    principal.setVisible(true);
    principal.setSize(650, 350);
    principal.setLocationRelativeTo(null);
    principal.setResizable(false);
    //principal.pack();

    mostrar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String ftpSsrver = "127.0.0.1";
            String ftpUser = "solera";
            String ftpPass = "solera";

            FTPClient cFtp = new FTPClient();

            try {

                cFtp.connect(ftpSsrver);
                boolean login = cFtp.login(ftpUser, ftpPass);
                System.out.print("conexion ftp para ver ficheros establecida");

                cFtp.enterLocalPassiveMode();

                String[] archivos = cFtp.listNames();
                FTPFile[] detalles = cFtp.listFiles();

                archivos = cFtp.listNames();

                for (int i = 0; i < archivos.length; i++) {
                    /*
                    cajaFicheros.selectAll();
                    cajaFicheros.replaceSelection("");
                    */
                    arrayArchivos.add(archivos[i].toString());
                    System.out.println(arrayArchivos.get(i));
                    cajaFicheros.append(System.getProperty("line.separator"));
                    cajaFicheros.append(arrayArchivos.get(i));

                }

                cFtp.logout();
                cFtp.disconnect();
                System.out.println("Conexion Finalizada, buenas tardes.");
            } catch (IOException ioe) {
                System.out.println("error" + ioe.toString());
            }

        }

    });

    try {
        salir.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                System.exit(0);

            }

        });
    } catch (Exception e) {
    }

    try {
        atras.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                FormularioAccesoFtp accesoFtp = new FormularioAccesoFtp();
                accesoFtp.inicioFtp();
                principal.setVisible(false);

            }

        });
    } catch (Exception e) {
    }

}