Salvar em JPeg, PNG

Estou desenvolvendo um software que o usuario implementa por jComboBox valores e adicionar na jTable.

Em java, tem como eu salvar essas informações da jTable no formato .JPEG, PNG?

Desde ja agradeço!

Usando canvas, vc consegue pintar coisas e salvar num arquivo como png.

http://www.egtry.com/java/awt/draw_save

1 curtida

Todo componente swing tem um método paint(Graphics).
Então você pode criar um BufferedImage e passar o Graphics dessa imagem para o método paint da sua JTable.
Em seguida usa a classe ImageIO pra salvar a imagem em arquivo, no formato desejado.

1 curtida

Obrigado, vou tentar implementar no codigo! Darei retorno!

Irei implementar e darei retorno!

Bom tentei ver essas classes, mas nao consegui implementar no codigo… tive dificuldades.
Estou pensando em fazer em outra linguagem… Caso voces queiram ver o codigo posso mandar. Muito obrigado!

Qual a dificuldade?

Método que salva um componente numa imagem:

private void salvarImagem(JComponent componente, String formato, File arquivo) {
    try {
        Dimension tamanho = componente.getSize();
        BufferedImage imagem = new BufferedImage(tamanho.width, tamanho.height, BufferedImage.TYPE_INT_RGB);
        componente.paint(imagem.getGraphics());
        ImageIO.write(imagem, formato, arquivo);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Exemplo de uso:

String formato = "jpg";
File arquivo = new File("C:\\minhaTabela.jpg");
salvarImagem(meuObjetoJTable, formato, arquivo);
1 curtida

Tipo, essa é a primeira vez que desenvolvo algo em java… fora da faculdade.
Estou com dificuldades de tipo implementar… aonde coloco cada coisa… sou novato nessa viagem. Desculpe os erros bobos.
Esse é o codigo todo.

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package manel2;


import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import javax.imageio.ImageIO;
import javax.swing.JComponent;




import javax.swing.JOptionPane;

import javax.swing.table.DefaultTableModel;

/**
 *
 * @author JuniorMaia
 */
public class Planilha2 extends javax.swing.JFrame {
     private static String filePath;
     private static Path caminho = null;
     private static final Charset iso_8859_1 = StandardCharsets.ISO_8859_1;

    /**
     * Creates new form Planilha2
     */
    public Planilha2() {
        initComponents();
    }

    /**
     * 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">                          
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jComboBoxNome = new javax.swing.JComboBox<>();
        jComboBoxLargura = new javax.swing.JComboBox<>();
        jComboBoxAltura = new javax.swing.JComboBox<>();
        jComboBoxPeitoril = new javax.swing.JComboBox<>();
        jComboBoxTipo = new javax.swing.JComboBox<>();
        jComboBoxQuantidade = new javax.swing.JComboBox<>();
        jButtonAdicionar = new javax.swing.JButton();
        jButtonExcluir = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTMedicoes = new javax.swing.JTable();
        jButtonAlterar = new javax.swing.JButton();
        jButtonBaixar = new javax.swing.JButton();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("NOME");

        jLabel2.setText("LARGURA(m)");

        jLabel3.setText("ALTURA(m)");

        jLabel4.setText("PEITORIL");

        jLabel5.setText("QUANTIDADE");

        jLabel6.setText("TIPO");

        jComboBoxNome.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "PORTA", "JANELA" }));

        jComboBoxLargura.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "60", "70", "80", "90", "100", "120", "150" }));

        jComboBoxTipo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "GIRO PARA A DIREITA", "GIRO PARA A ESQUERDA" }));
        jComboBoxTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxTipoActionPerformed(evt);
            }
        });

        jButtonAdicionar.setText("ADICIONAR");
        jButtonAdicionar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAdicionarActionPerformed(evt);
            }
        });

        jButtonExcluir.setText("EXCLUIR");
        jButtonExcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonExcluirActionPerformed(evt);
            }
        });

        jTMedicoes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "NOME", "LARGURA(m)", "ALTURA", "PEITORIL", "QUANTIDADE", "TIPO"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTMedicoes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTMedicoesMouseClicked(evt);
            }
        });
        jTMedicoes.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTMedicoesKeyReleased(evt);
            }
        });
        jScrollPane2.setViewportView(jTMedicoes);

        jButtonAlterar.setText("ALTERAR");
        jButtonAlterar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAlterarActionPerformed(evt);
            }
        });

        jButtonBaixar.setText("BAIXAR");
        jButtonBaixar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBaixarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jComboBoxNome, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(35, 35, 35)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jComboBoxLargura, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(24, 24, 24)
                                .addComponent(jLabel1)))
                        .addGap(32, 32, 32)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel3)
                            .addComponent(jComboBoxAltura, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(60, 60, 60)
                        .addComponent(jButtonAdicionar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButtonExcluir)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel4)
                            .addComponent(jComboBoxPeitoril, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(61, 61, 61)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel6)
                        .addGap(125, 125, 125))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jComboBoxQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jComboBoxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGap(47, 47, 47)
                        .addComponent(jButtonAlterar)
                        .addGap(75, 75, 75)
                        .addComponent(jButtonBaixar)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 764, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jComboBoxLargura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jComboBoxAltura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jComboBoxPeitoril, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jComboBoxQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jComboBoxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jComboBoxNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(jLabel2)
                        .addComponent(jLabel4)
                        .addComponent(jLabel5)
                        .addComponent(jLabel6)))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonExcluir)
                    .addComponent(jButtonAlterar)
                    .addComponent(jButtonBaixar)
                    .addComponent(jButtonAdicionar))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                        

    private void jComboBoxTipoActionPerformed(java.awt.event.ActionEvent evt) {                                              
        // TODO add your handling code here:
    }                                             

    private void jTMedicoesMouseClicked(java.awt.event.MouseEvent evt) {                                        
        
       if(jTMedicoes.getSelectedRow() != -1){
           
            jComboBoxNome.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 0));
            jComboBoxLargura.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 1));
            jComboBoxAltura.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 2));
            jComboBoxPeitoril.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 3));
            jComboBoxQuantidade.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 4));
            jComboBoxTipo.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 5));
        }else{
            JOptionPane.showMessageDialog(null, "SELECIONE ITEM A SER ALTERADO!");
        }
        
    }                                       

    private void jButtonAdicionarActionPerformed(java.awt.event.ActionEvent evt) {                                                 
    
        DefaultTableModel dtmMedicoes = (DefaultTableModel) jTMedicoes.getModel();
        Object[] dados = {jComboBoxNome.getSelectedItem(),jComboBoxLargura.getSelectedItem(),jComboBoxAltura.getSelectedItem(), jComboBoxPeitoril.getSelectedItem(),jComboBoxQuantidade.getSelectedItem(), jComboBoxTipo.getSelectedItem()};
        
        dtmMedicoes.addRow(dados);
        
        
    }                                                

    private void jButtonExcluirActionPerformed(java.awt.event.ActionEvent evt) {                                               
        //jTMedicoes.getSelectedRow();
        
        if(jTMedicoes.getSelectedRow() != -1){
        
        DefaultTableModel dtmMedicoes = (DefaultTableModel) jTMedicoes.getModel();
        dtmMedicoes.removeRow(jTMedicoes.getSelectedRow());
        }else{
                JOptionPane.showMessageDialog(null, "SELECIONE UM PRODUTO PARA EXCLUIR.");
        }
        
        
        
    }                                              

    private void jTMedicoesKeyReleased(java.awt.event.KeyEvent evt) {                                       
       if(jTMedicoes.getSelectedRow() != -1){
            jComboBoxNome.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 0));
            jComboBoxLargura.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 1));
            jComboBoxAltura.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 2));
            jComboBoxPeitoril.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 3));
            jComboBoxQuantidade.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 4));
            jComboBoxTipo.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 5));
        }else{
            JOptionPane.showMessageDialog(null, "SELECIONE ITEM A SER ALTERADO!");
        }
        
    }                                      

    private void jButtonAlterarActionPerformed(java.awt.event.ActionEvent evt) {                                               
         if(jTMedicoes.getSelectedRow() != -1){
             jTMedicoes.setValueAt(jComboBoxNome.getSelectedItem(), jTMedicoes.getSelectedRow(), 0);
             jTMedicoes.setValueAt(jComboBoxLargura.getSelectedItem(), jTMedicoes.getSelectedRow(), 1);
             jTMedicoes.setValueAt(jComboBoxAltura.getSelectedItem(), jTMedicoes.getSelectedRow(), 2);
             jTMedicoes.setValueAt(jComboBoxPeitoril.getSelectedItem(), jTMedicoes.getSelectedRow(), 3);
             jTMedicoes.setValueAt(jComboBoxQuantidade.getSelectedItem(), jTMedicoes.getSelectedRow(), 4);
             jTMedicoes.setValueAt(jComboBoxTipo.getSelectedItem(), jTMedicoes.getSelectedRow(), 5);
            
         
         }
    }                                              


    
    private void jButtonBaixarActionPerformed(java.awt.event.ActionEvent evt) {                                              

    
    
              //BOTAO PARA SALVAR A JTABLE EM IMAGEM
              
              
    }                                             
    


      
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
     

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Planilha2().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton jButtonAdicionar;
    private javax.swing.JButton jButtonAlterar;
    private javax.swing.JButton jButtonBaixar;
    private javax.swing.JButton jButtonExcluir;
    private javax.swing.JComboBox<String> jComboBoxAltura;
    private javax.swing.JComboBox<String> jComboBoxLargura;
    private javax.swing.JComboBox<String> jComboBoxNome;
    private javax.swing.JComboBox<String> jComboBoxPeitoril;
    private javax.swing.JComboBox<String> jComboBoxQuantidade;
    private javax.swing.JComboBox<String> jComboBoxTipo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTMedicoes;
    private javax.swing.JTable jTable1;
    // End of variables declaration                   
}

Ué, mas você até pôs um comentário no código abaixo, que é onde você vai implementar a exportação da imagem:

private void jButtonBaixarActionPerformed(java.awt.event.ActionEvent evt) {
    // BOTAO PARA SALVAR A JTABLE EM IMAGEM
}

É só você adicionar o método salvarImagem, que eu postei antes, na sua tela.

Depois, no lugar daquele comentário tu coloca o código pra chamar o salvarImagem:

private void jButtonBaixarActionPerformed(java.awt.event.ActionEvent evt) {
    salvarImagem(jTMedicoes, "jpg", new File("C:\\medicoes.jpg"));
    salvarImagem(jTMedicoes, "png", new File("C:\\medicoes.png"));
}
1 curtida

Deu uns erros.

Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: Width (1026) and height (0) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016)
at java.awt.image.BufferedImage.(BufferedImage.java:324)
at manel2.Planilha2.salvarImagem(Planilha2.java:370)
at manel2.Planilha2.jButtonBaixarActionPerformed(Planilha2.java:362)
at manel2.Planilha2.access$600(Planilha2.java:30)
at manel2.Planilha2$8.actionPerformed(Planilha2.java:177)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Se traduzir a mensagem, vai entender que a altura da tabela está em zero.
Provavelmente não tem itens nela.

Pronto! Deu tudo certo, vou dar mais umas pesquisadas para melhorar mais o codigo.
Muito Obrigado, pela ajuda.
Deus abençoe.

1 curtida

Boa noite, naquela parte do metodo que voce me passou…

salvarImagem(jTMedicoes, “jpg”, new File(“C:\Users\JuniorMaia\Medicao.jpg”));
salvarImagem(jTMedicoes, “png”, new File(“C:\Users\JuniorMaia\Desktop\medicoes.png”));

Teria como eu trocar esse caminho, para ele salvar em qualquer lugar?

Tava vendo o JFileChoosser, quando eu clico no jButton ele abre a janela, mas falta salvar

como faço para tirar aquele caminho do metodo que voce me passou, e cololocar esse JFileChooser, ou se voce conhece um metodo melhor de fazer essa alteração?

------------------------------CODIGO---------------------------------------------

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package manel2;


import java.awt.Component;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import javax.imageio.ImageIO;
import javax.swing.JComponent;
import javax.swing.JFileChooser;




import javax.swing.JOptionPane;

import javax.swing.table.DefaultTableModel;

/**
 *
 * @author JuniorMaia
 */
public class Planilha2 extends javax.swing.JFrame {
     private static String filePath;
     private static Path caminho = null;
     private static final Charset iso_8859_1 = StandardCharsets.ISO_8859_1;
     private static int contador_arquivo = 0;
     final JFileChooser fc = new JFileChooser();

    /**
     * Creates new form Planilha2
     */
    public Planilha2() {
        initComponents();
    }

    /**
     * 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">                          
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jComboBoxNome = new javax.swing.JComboBox<>();
        jComboBoxLargura = new javax.swing.JComboBox<>();
        jComboBoxAltura = new javax.swing.JComboBox<>();
        jComboBoxPeitoril = new javax.swing.JComboBox<>();
        jComboBoxTipo = new javax.swing.JComboBox<>();
        jComboBoxQuantidade = new javax.swing.JComboBox<>();
        jButtonAdicionar = new javax.swing.JButton();
        jButtonExcluir = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTMedicoes = new javax.swing.JTable();
        jButtonAlterar = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jComboBoxMateriais = new javax.swing.JComboBox<>();
        jLabel8 = new javax.swing.JLabel();
        jButtonBaixar = new javax.swing.JButton();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle(" Architect V 1.1");
        setResizable(false);

        jLabel1.setText("NOME");

        jLabel2.setText("LARGURA(cm)");

        jLabel3.setText("ALTURA(m)");

        jLabel4.setText("PEITORIL(cm)");

        jLabel5.setText("QUANTIDADE");

        jLabel6.setText("TIPO");

        jComboBoxNome.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "-", "PORTA", "JANELA" }));

        jComboBoxLargura.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0cm", "40cm", "60cm", "70cm", "80cm", "90cm", "100cm", "120cm", "150cm" }));

        jComboBoxAltura.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0cm", "40cm", "50cm", "60cm", "80cm", "100cm", "120cm", "150cm", "200cm" }));

        jComboBoxPeitoril.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0cm", "20cm", "30cm", "40cm", "50cm", "60cm", "70cm", "80cm", "90cm", "100cm", "110cm", "120cm", "130cm", "140cm", "150cm", "160cm", "170cm", "180 cm", "190cm", "200cm" }));

        jComboBoxTipo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "-", "Correr", "Correr 2 folhas", "Correr 3 folhas", "Correr 4 folhas", "Giro para direita", "Giro para esquerda", "Basculante", "Rôlo" }));
        jComboBoxTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxTipoActionPerformed(evt);
            }
        });

        jComboBoxQuantidade.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }));

        jButtonAdicionar.setText("ADICIONAR");
        jButtonAdicionar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAdicionarActionPerformed(evt);
            }
        });

        jButtonExcluir.setText("EXCLUIR");
        jButtonExcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonExcluirActionPerformed(evt);
            }
        });

        jTMedicoes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "NOME", "LARGURA(m)", "ALTURA", "PEITORIL", "QUANTIDADE", "TIPO", "MATERIAIS"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTMedicoes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTMedicoesMouseClicked(evt);
            }
        });
        jTMedicoes.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTMedicoesKeyReleased(evt);
            }
        });
        jScrollPane2.setViewportView(jTMedicoes);

        jButtonAlterar.setText("ALTERAR");
        jButtonAlterar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAlterarActionPerformed(evt);
            }
        });

        jLabel7.setText("MATERIAIS");

        jComboBoxMateriais.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "-", "Madeira", "Alumínio", "Vidro", "Alumínio/vidro", "Madeira/vidro", "Ferro Compensado", "MDF", "Inox" }));

        jLabel8.setText("JM SOFTWARE");

        jButtonBaixar.setText("BAIXAR");
        jButtonBaixar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBaixarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(105, 105, 105)
                .addComponent(jButtonAdicionar)
                .addGap(133, 133, 133)
                .addComponent(jButtonExcluir)
                .addGap(71, 71, 71)
                .addComponent(jLabel8)
                .addGap(58, 58, 58)
                .addComponent(jButtonAlterar)
                .addGap(173, 173, 173)
                .addComponent(jButtonBaixar))
            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 1024, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(46, 46, 46)
                        .addComponent(jLabel1)
                        .addGap(89, 89, 89)
                        .addComponent(jLabel2))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(jComboBoxNome, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(61, 61, 61)
                        .addComponent(jComboBoxLargura, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(67, 67, 67)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jComboBoxAltura, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(49, 49, 49)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jComboBoxPeitoril, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(96, 96, 96)
                        .addComponent(jComboBoxQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(47, 47, 47)
                        .addComponent(jComboBoxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(38, 38, 38)
                        .addComponent(jComboBoxMateriais, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(82, 82, 82)
                        .addComponent(jLabel5)
                        .addGap(61, 61, 61)
                        .addComponent(jLabel6)
                        .addGap(122, 122, 122)
                        .addComponent(jLabel7))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jComboBoxNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxLargura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxAltura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxPeitoril, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxMateriais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(15, 15, 15)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButtonAdicionar)
                            .addComponent(jButtonExcluir)
                            .addComponent(jButtonAlterar)
                            .addComponent(jButtonBaixar))))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>                        

    private void jComboBoxTipoActionPerformed(java.awt.event.ActionEvent evt) {                                              
        // TODO add your handling code here:
    }                                             

    private void jTMedicoesMouseClicked(java.awt.event.MouseEvent evt) {                                        
        
       if(jTMedicoes.getSelectedRow() != -1){
           
            jComboBoxNome.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 0));
            jComboBoxLargura.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 1));
            jComboBoxAltura.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 2));
            jComboBoxPeitoril.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 3));
            jComboBoxQuantidade.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 4));
            jComboBoxTipo.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 5));
            jComboBoxMateriais.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 6));
        }else{
            JOptionPane.showMessageDialog(null, "SELECIONE ITEM A SER ALTERADO!");
        }
        
    }                                       

    private void jButtonAdicionarActionPerformed(java.awt.event.ActionEvent evt) {                                                 
    
        DefaultTableModel dtmMedicoes = (DefaultTableModel) jTMedicoes.getModel();
        Object[] dados = {jComboBoxNome.getSelectedItem(),jComboBoxLargura.getSelectedItem(),
                          jComboBoxAltura.getSelectedItem(), jComboBoxPeitoril.getSelectedItem(),
                          jComboBoxQuantidade.getSelectedItem(), jComboBoxTipo.getSelectedItem(),
                          jComboBoxMateriais.getSelectedItem()
        };
        
        dtmMedicoes.addRow(dados);
        
        
    }                                                

    private void jButtonExcluirActionPerformed(java.awt.event.ActionEvent evt) {                                               
        //jTMedicoes.getSelectedRow();
        
        if(jTMedicoes.getSelectedRow() != -1){
        
        DefaultTableModel dtmMedicoes = (DefaultTableModel) jTMedicoes.getModel();
        dtmMedicoes.removeRow(jTMedicoes.getSelectedRow());
        }else{
                JOptionPane.showMessageDialog(null, "SELECIONE UM PRODUTO PARA EXCLUIR.", "ALERTA!", JOptionPane.ERROR_MESSAGE);
                    
            //JOptionPane.showMessageDialog(null, "SELECIONE UM PRODUTO PARA EXCLUIR.");
        }
        
        
        
    }                                              

    private void jTMedicoesKeyReleased(java.awt.event.KeyEvent evt) {                                       
       if(jTMedicoes.getSelectedRow() != -1){
            jComboBoxNome.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 0));
            jComboBoxLargura.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 1));
            jComboBoxAltura.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 2));
            jComboBoxPeitoril.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 3));
            jComboBoxQuantidade.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 4));
            jComboBoxTipo.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 5));
            jComboBoxMateriais.setSelectedItem(jTMedicoes.getValueAt(jTMedicoes.getSelectedRow(), 6));
        }else{
            JOptionPane.showMessageDialog(null, "SELECIONE ITEM A SER ALTERADO!");
        }
        
    }                                      

    private void jButtonAlterarActionPerformed(java.awt.event.ActionEvent evt) {                                               
        
        
        if(jTMedicoes.getSelectedRow() != -1){
             jTMedicoes.setValueAt(jComboBoxNome.getSelectedItem(), jTMedicoes.getSelectedRow(), 0);
             jTMedicoes.setValueAt(jComboBoxLargura.getSelectedItem(), jTMedicoes.getSelectedRow(), 1);
             jTMedicoes.setValueAt(jComboBoxAltura.getSelectedItem(), jTMedicoes.getSelectedRow(), 2);
             jTMedicoes.setValueAt(jComboBoxPeitoril.getSelectedItem(), jTMedicoes.getSelectedRow(), 3);
             jTMedicoes.setValueAt(jComboBoxQuantidade.getSelectedItem(), jTMedicoes.getSelectedRow(), 4);
             jTMedicoes.setValueAt(jComboBoxTipo.getSelectedItem(), jTMedicoes.getSelectedRow(), 5);
            
         
         }else{
                JOptionPane.showMessageDialog(null, "SELECIONE UM PRODUTO PARA ALTERAR.", "ALERTA!", JOptionPane.ERROR_MESSAGE);
        }
    }                                              

    private void jButtonBaixarActionPerformed(java.awt.event.ActionEvent evt) {                                              
          
       
        
           if(jTMedicoes.getRowCount() == 0 ){  
               JOptionPane.showMessageDialog(null, "ERRO AO BAIXAR, PREENCHA A TABELA!", "ERRO!", JOptionPane.ERROR_MESSAGE);
            
           }else{
            
   
               caminhoSalvar();
               
               
              

             
           
                    }
             
    }                                             
      
  
    
    private void salvarImagem(JComponent componente, String formato, File arquivo) {
    try {      
        Dimension tamanho = componente.getSize();
        BufferedImage imagem = new BufferedImage(tamanho.width, tamanho.height, BufferedImage.TYPE_INT_RGB);
        componente.paint(imagem.getGraphics());
        boolean write = ImageIO.write(imagem, formato, arquivo);
    } catch (IOException e) {
        e.printStackTrace();
    }   
    
}
    
    public void caminhoSalvar(){
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setDialogTitle("Salvar");
        //fileChooser.showOpenDialog(this);
        fileChooser.showSaveDialog(jTMedicoes);
        //File selFile = fileChooser.getSelectedFile();
        
        //if(retorno == JFileChooser.APPROVE_OPTION){
        
        
        //}
        
        
        
        
        
        /*salvarImagem(jTMedicoes, "jpg", new File("C:\\Users\\JuniorMaia\\Medicao " + contador_arquivo +".jpg"));
            //salvarImagem(jTMedicoes, "png", new File("C:\\Users\\JuniorMaia\\Desktop\\medicoes.png"));
            JOptionPane.showMessageDialog(null, "INFORMAÇÃO BAIXADA COM SUCESSO!", "BAIXADO!", JOptionPane.INFORMATION_MESSAGE);
            
            contador_arquivo++;*/
       
    
    }

        


      
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
     

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                
                
                new Planilha2().setVisible(true);
                
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton jButtonAdicionar;
    private javax.swing.JButton jButtonAlterar;
    private javax.swing.JButton jButtonBaixar;
    private javax.swing.JButton jButtonExcluir;
    private javax.swing.JComboBox<String> jComboBoxAltura;
    private javax.swing.JComboBox<String> jComboBoxLargura;
    private javax.swing.JComboBox<String> jComboBoxMateriais;
    private javax.swing.JComboBox<String> jComboBoxNome;
    private javax.swing.JComboBox<String> jComboBoxPeitoril;
    private javax.swing.JComboBox<String> jComboBoxQuantidade;
    private javax.swing.JComboBox<String> jComboBoxTipo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTMedicoes;
    private javax.swing.JTable jTable1;
    // End of variables declaration                   
}

Assim deve resolver:

public void caminhoSalvar() {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle("Salvar");
    FileNameExtensionFilter filter = new FileNameExtensionFilter("Arquivos jpg (*.jpg)", "jpg");
    fileChooser.addChoosableFileFilter(filter);
    fileChooser.setFileFilter(filter);
    int option = fileChooser.showSaveDialog(this);
    if (option == JFileChooser.APPROVE_OPTION) {
        File arquivo = fileChooser.getSelectedFile();
        if (!arquivo.getName().toLowerCase().endsWith(".jpg")) {
            arquivo = new File(arquivo.getParent(), arquivo.getName() + ".jpg");
        }
        salvarImagem(jTMedicoes, "jpg", arquivo);
        JOptionPane.showMessageDialog(this, "INFORMAÇÃO BAIXADA COM SUCESSO!", "BAIXADO!", JOptionPane.INFORMATION_MESSAGE);
    }
}
1 curtida

@Blessed15 quando for postar códigos no fórum, deixa ele formatado para os colegas entederem melhor. (E passe apenas o trecho que você está com dúvidas, não precisa passar o source completo)

Pra fazer isso é só selecionar todo o trecho do código e apertar em </>

image

1 curtida

Opa, tudo bem. Obrigado pelo conselho, evitarei esse tipo de transtorno novamente!

Funcionou, eu nao sabia como fazer essa parte de escolher o caminho mas agora entendi.
Muito Obrigado pela atenção meu amigo!
Deus abençoe.

1 curtida