Italo, experimente colocar um show no final desse código.
show();
T+
I
italobrazPJ
hehehe sou muito iniciante mesmo… hauhauahuahua
Brigado Funcionou!!!
mas deu outro problema…
ele atualiza o JPanel legalzinho… mas se eu tentar acessar o MENU (JMenu) ele naum aparece… tipo eu clicko… aparece ele como clikado… mas naum aparece os JMenuItem…
J
jeveauxPJ
Oi
Italo, aí nesse outro problema deve ser algum problema com a lógica de montagem de tua interface… se quiseres postar o código poderemos analisa-lo e descobrir o problema.
T+
I
italobrazPJ
Opa ta ai o código... é só a titulo de aprendizagem... naum é nada demais....
to usando o NETBEANS 3.6
/* * pedido.java * * Created on 10 de Maio de 2004, 08:44 */importjava.awt.*;publicclasspedidoextendsjavax.swing.JFrame{Containerpanel2;publicpedido(){initComponents();}privatevoidinitComponents(){Panel=newjavax.swing.JPanel();BarraMenu=newjavax.swing.JMenuBar();Pedido=newjavax.swing.JMenu();Inserir=newjavax.swing.JMenuItem();Consulta=newjavax.swing.JMenuItem();Alterar=newjavax.swing.JMenuItem();jSeparator1=newjavax.swing.JSeparator();jMenuItem1=newjavax.swing.JMenuItem();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);setTitle("ControledeEntregas");addWindowListener(newjava.awt.event.WindowAdapter(){publicvoidwindowClosing(java.awt.event.WindowEventevt){exitForm(evt);}});Panel.setLayout(null);Panel.setPreferredSize(newjava.awt.Dimension(600,400));getContentPane().add(Panel,java.awt.BorderLayout.CENTER);Pedido.setMnemonic('P');Pedido.setLabel("Pedido");Inserir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I,java.awt.event.InputEvent.CTRL_MASK));Inserir.setMnemonic('I');Inserir.setText("Inserir");Inserir.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){InserirActionPerformed(evt);}});Pedido.add(Inserir);Consulta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C,java.awt.event.InputEvent.CTRL_MASK));Consulta.setMnemonic('C');Consulta.setText("Consulta/Exclui");Pedido.add(Consulta);Alterar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A,java.awt.event.InputEvent.CTRL_MASK));Alterar.setMnemonic('A');Alterar.setText("Alterar");Pedido.add(Alterar);Pedido.add(jSeparator1);jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X,java.awt.event.InputEvent.CTRL_MASK));jMenuItem1.setMnemonic('r');jMenuItem1.setText("Sair");jMenuItem1.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jMenuItem1ActionPerformed(evt);}});Pedido.add(jMenuItem1);BarraMenu.add(Pedido);setJMenuBar(BarraMenu);pack();}privatevoidInserirActionPerformed(java.awt.event.ActionEventevt){panel2=super.getContentPane();Buttonteste=newButton("nome");panel2.add(teste);show();}privatevoidjMenuItem1ActionPerformed(java.awt.event.ActionEventevt){System.exit(0);}privatevoidexitForm(java.awt.event.WindowEventevt){System.exit(0);}publicstaticvoidmain(Stringargs[]){newpedido().show();}// Variables declaration - do not modifyprivatejavax.swing.JMenuItemAlterar;privatejavax.swing.JMenuBarBarraMenu;privatejavax.swing.JMenuItemConsulta;privatejavax.swing.JMenuItemInserir;privatejavax.swing.JPanelPanel;privatejavax.swing.JMenuPedido;privatejavax.swing.JMenuItemjMenuItem1;privatejavax.swing.JSeparatorjSeparator1;// End of variables declaration}
I
italobrazPJ
Já descobri o q é já…
O Jpanel tá ficando por cima do JMENUITEM… provavelmente por problemas de lógica… mas como posso arrumar isso???
J
jeveauxPJ
Oi
Iatalo, cara aí no meu caso é só testando, não sou muito bom com GUI cara… Tente colocar o show em algum objeto especifico ou direto na classe… Aí não sei bem… agora é a hora de testar… :oops:
T+
R
RenanCCPPJ
Que tal colocar um Nome_do_painel.setVisible(true);