Help Gigante JAVA

3 respostas
F

alô, turma do PJ.
Preciso - mais uma vez - de um help muito importante pra mim.
No codigo abaixo, tem o JSeparator que indica os “Itens Cadastrados”.
Como fazer aparecer nesse retangulo os Produtos que cadastro na GUI de cadastramento de Produtos ??? JTable, JComboBox, ???
Alguem pode me dar uma ideia ?? De preferência, um código básico ???
Obrigado e obrigado.
Ateh.
Formiga

Codigo:

public class JanelaItens extends JDialog {
        
        /** Creates new form jdItensCarga */
        public JanelaItens(Frame owner, String title, boolean modal){
            super(owner, title, modal);
            initComponents2();
            //            setTitle("Cadastro de Itens p/ Carga");
            //            setResizable(false);
            //            setSize(700,500);
            //            setLocationRelativeTo(null);
            //            setVisible(true);
            
        }
        
        /** 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.
         */
        private void initComponents2() {
            jSeparator4 = new JSeparator();
            jtfCodCarga = new JTextField();
            jcbPedido = new JComboBox();
            jlCodCarga = new JLabel();
            jlPedido = new JLabel();
            jSeparator5 = new JSeparator();
            jcbFabrica = new JComboBox();
            jlFabrica = new JLabel();
            jlProduto = new JLabel();
            jtfDescProduto = new JTextField();
            jlDescProduto = new JLabel();
            jtfSeq = new JTextField();
            jlSeq = new JLabel();
            jtfQuantde = new JTextField();
            jlQuantde = new JLabel();
            jcbProduto = new JComboBox();
            jtfQtTot = new JTextField();
            jtfQtEmb = new JTextField();
            jtfQtProg = new JTextField();
            jlQtTot = new JLabel();
            jlQtEmb = new JLabel();
            jlQtProg = new JLabel();
            jSeparator6 = new JSeparator();
            jbCadItem = new JButton();
            jbAltItem = new JButton();
            jbExcItem = new JButton();
            jbSairItem = new JButton();
            
            getContentPane().setLayout(null);
            
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            //            jSeparator1.setBorder(new border.TitledBorder("Itens p/ Carga"));
            getContentPane().add(jSeparator4);
            jSeparator4.setBounds(10, 10, 680, 170);
            
            jtfCodCarga.setEditable(false);
            getContentPane().add(jtfCodCarga);
            jtfCodCarga.setBounds(90, 30, 80, 21);
            
            getContentPane().add(jcbPedido);
            jcbPedido.setBounds(570, 30, 100, 21);
            
            jlCodCarga.setFont(new java.awt.Font("MS Sans Serif", 1, 14));
            jlCodCarga.setText("Carga :");
            getContentPane().add(jlCodCarga);
            jlCodCarga.setBounds(30, 30, 50, 19);
            
            jlPedido.setFont(new java.awt.Font("MS Sans Serif", 1, 14));
            jlPedido.setText("Pedido :");
            getContentPane().add(jlPedido);
            jlPedido.setBounds(500, 30, 60, 19);
            
            getContentPane().add(jSeparator5);
            jSeparator5.setBounds(10, 60, 680, 10);
            
            getContentPane().add(jcbFabrica);
            jcbFabrica.setBounds(250, 30, 240, 21);
            
            jlFabrica.setFont(new java.awt.Font("MS Sans Serif", 1, 14));
            jlFabrica.setText("Fabrica :");
            getContentPane().add(jlFabrica);
            jlFabrica.setBounds(180, 30, 70, 19);
            
            jlProduto.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
            jlProduto.setText("Produto");
            getContentPane().add(jlProduto);
            jlProduto.setBounds(20, 70, 60, 15);
            
            jtfDescProduto.setEditable(false);
            getContentPane().add(jtfDescProduto);
            jtfDescProduto.setBounds(170, 90, 250, 21);
            
            jlDescProduto.setFont(new java.awt.Font("MS Sans Serif", 2, 11));
            jlDescProduto.setText("Descricao");
            getContentPane().add(jlDescProduto);
            jlDescProduto.setBounds(360, 70, 60, 15);
            
            getContentPane().add(jtfSeq);
            jtfSeq.setBounds(430, 90, 30, 21);
            
            jlSeq.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
            jlSeq.setText("Seq");
            getContentPane().add(jlSeq);
            jlSeq.setBounds(430, 70, 30, 15);
            
            getContentPane().add(jtfQuantde);
            jtfQuantde.setBounds(630, 90, 50, 21);
            
            jlQuantde.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
            jlQuantde.setText("Quantde");
            getContentPane().add(jlQuantde);
            jlQuantde.setBounds(630, 70, 50, 15);
            
            getContentPane().add(jcbProduto);
            jcbProduto.setBounds(20, 90, 150, 21);
            
            jtfQtTot.setEditable(false);
            jtfQtTot.setFocusable(false);
            getContentPane().add(jtfQtTot);
            jtfQtTot.setBounds(470, 90, 50, 21);
            
            jtfQtEmb.setEditable(false);
            jtfQtEmb.setFocusable(false);
            getContentPane().add(jtfQtEmb);
            jtfQtEmb.setBounds(520, 90, 50, 21);
            
            jtfQtProg.setEditable(false);
            jtfQtProg.setFocusable(false);
            getContentPane().add(jtfQtProg);
            jtfQtProg.setBounds(570, 90, 50, 21);
            
            jlQtTot.setText("Qt.Tot");
            getContentPane().add(jlQtTot);
            jlQtTot.setBounds(470, 70, 34, 15);
            
            jlQtEmb.setText("Qt.Emb");
            getContentPane().add(jlQtEmb);
            jlQtEmb.setBounds(520, 70, 34, 15);
            
            jlQtProg.setText("Qt.Prog");
            getContentPane().add(jlQtProg);
            jlQtProg.setBounds(570, 70, 40, 15);
            
            jSeparator6.setBorder(new javax.swing.border.TitledBorder("Itens Cadastrados"));
            getContentPane().add(jSeparator6);
            jSeparator6.setBounds(10, 180, 680, 290);
            
            jbCadItem.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
            jbCadItem.setText("Cadastrar");
            jbCadItem.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbCadItemActionPerformed(evt);
                }
            });
            
            getContentPane().add(jbCadItem);
            jbCadItem.setBounds(150, 130, 100, 25);
            
            jbAltItem.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
            jbAltItem.setText("Alterar");
            getContentPane().add(jbAltItem);
            jbAltItem.setBounds(250, 130, 100, 25);
            
            jbExcItem.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
            jbExcItem.setText("Excluir");
            getContentPane().add(jbExcItem);
            jbExcItem.setBounds(350, 130, 100, 25);
            
            jbSairItem.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
            jbSairItem.setText("Sair");
            
            jbSairItem.addActionListener(
            new ActionListener(){
                public void actionPerformed(ActionEvent e){
                    JanelaItens.setVisible(false);
                    jdCadCargasItens = new jdCadCargasItens(null,true);
                }
            }
            );
            
            getContentPane().add(jbSairItem);
            jbSairItem.setBounds(460, 130, 100, 25);
            
            pack();
        }
        
        private void jbCadItemActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
        }
        
        // Variables declaration - do not modify
        private JSeparator jSeparator4;
        private JSeparator jSeparator5;
        private JSeparator jSeparator6;
        private JButton jbAltItem;
        private JButton jbCadItem;
        private JButton jbExcItem;
        private JButton jbSairItem;
        private JComboBox jcbFabrica;
        private JComboBox jcbPedido;
        private JComboBox jcbProduto;
        private JLabel jlCodCarga;
        private JLabel jlDescProduto;
        private JLabel jlFabrica;
        private JLabel jlPedido;
        private JLabel jlProduto;
        private JLabel jlQtEmb;
        private JLabel jlQtProg;
        private JLabel jlQtTot;
        private JLabel jlQuantde;
        private JLabel jlSeq;
        private JTextField jtfCodCarga;
        private JTextField jtfDescProduto;
        private JTextField jtfQtEmb;
        private JTextField jtfQtProg;
        private JTextField jtfQtTot;
        private JTextField jtfQuantde;
        private JTextField jtfSeq;
        // End of variables declaration
        
    }

[color=“red”]EDITADO por DanielBadawi para conter as tags BBCode[/color]
Sempre utilize as tags BBCode qdo for postar códigos! Assim a pessoa q for ler o seu post, pode visualizar melhor o código. :wink:

3 Respostas

M

formiga,

Use JTable, acho que seria o mais ideal…
Ainda mais que vc não está usando banco de dados, ou está ?

Abraço,
Maicon

F

Sim, Maicon, estou usando PostgreSQL e Oracle.
Ateh.
Formiga

M

formiga,

acho que o JTable ainda assim é o melhor pra vc utilizar,
aí tens que ver da sua necessidade.

Abraço,
Maicon

Criado 22 de outubro de 2004
Ultima resposta 11 de nov. de 2004
Respostas 3
Participantes 2