Liebe Kollegen,
Hat Jemand schonmal gleiches Problem mit meinem?
Ich schreibe ein Program in Modular Forme. Die sind alle 3 Dateien zusammen,
und zwar: gudangit.java ; jendelautama.java ; deitem.java .
Mein 'deitem' (JInternalFrame) zeigt leeren Formular. Es zeight gar keine was
ich schon mit GridBagLayout geschrieben habe.
Weiss Jemand welche mein Fehle ist?
Danke Vorher.
====
//gudangit.java
public class gudangit{
public static void main(String args[]){
new jendelautama();
}
}
====
====
//jendelautama.java
import java.sql.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class jendelautama extends JFrame implements ActionListener{
String usr="root";
String pw="***";
String db="gudang";
String buff,item,description;
public JFrame frame=new JFrame();
public JDesktopPane dt=new JDesktopPane();
public JMenuBar menu=new JMenuBar();
public JMenu mitem=new JMenu("Nama Barang");
public JMenu mother=new JMenu("DLL");
public JMenuItem iitem=new JMenuItem("Data Entry",'E');
public JSeparator space=new JSeparator(0);
public JMenuItem iset=new JMenuItem("Setting",'S');
public JMenuItem iquit=new JMenuItem("Qeluar",'Q');
public Container container=new Container();
jendelautama(){
super("Gudangku");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(800,600);
setJMenuBar(menu);
mitem.setMnemonic('I');
mother.setMnemonic('O');
iitem.setMnemonic('E');
iitem.addActionListener(this);
iquit.setMnemonic('Q');
iquit.addActionListener(this);
menu.add(mitem);
menu.add(space);
menu.add(mother);
mitem.add(iitem);
mother.add(iset);
mother.addSeparator();
mother.add(iquit);
menu.setSize(800,100);
menu.setLocation(0,0);
menu.setVisible(true);
container=getContentPane();
container.setLayout(new FlowLayout());
show();
}
public void actionPerformed(ActionEvent ae){
if (ae.getSource()==iitem){
calldepageitem();
}
if (ae.getSource()==iquit){
System.exit(0);
}
}
public JInternalFrame calldepageitem(){
deitem pagedeitem=new deitem();
dt.add(pagedeitem);
setContentPane(dt);
show();
return pagedeitem;
}
}
====
====
//deitem.java
import java.sql.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class deitem extends JInternalFrame implements ActionListener{
public String usr="root";
public String pw="***";
public String db="gudang";
public String buff,item,description;
public int amount;
public JInternalFrame ifdeitem=new JInternalFrame();
public JLabel litem=new JLabel("Nama Barang:");
public JLabel ldeskripsi=new JLabel("Penjelasan:");
public JLabel ljumlah=new JLabel("Jumlah:");
public JTextField tfitem=new JTextField(20);
public JTextField tfdeskripsi=new JTextField(40);
public JTextField tfjumlah=new JTextField(4);
public JButton bok=new JButton("Simpan");
public JButton bcancel=new JButton("Batal");
public Container panel = ifdeitem.getContentPane();
public GridBagConstraints gbc=new GridBagConstraints();
public GridBagLayout gbl=new GridBagLayout();
deitem(){
super("Gudangku - barang2x", true, true, true, true);
setSize(600,300);
gbc.fill = GridBagConstraints.HORIZONTAL;
ifdeitem.getContentPane().setLayout(gbl);
gbc.gridx=0;
gbc.gridy=0;
panel.add(litem,gbc);
gbc.gridx=1;
gbc.gridy=0;
panel.add(tfitem,gbc);
gbc.gridx=0;
gbc.gridy=1;
panel.add(ldeskripsi,gbc);
gbc.gridx=1;
gbc.gridy=1;
panel.add(tfdeskripsi,gbc);
gbc.gridx=0;
gbc.gridy=2;
panel.add(ljumlah,gbc);
gbc.gridx=1;
gbc.gridy=2;
panel.add(tfjumlah,gbc);
gbc.gridx=0;
gbc.gridy=3;
panel.add(bok,gbc);
gbc.gridx=1;
gbc.gridy=3;
panel.add(bcancel,gbc);
show();
}
public void actionPerformed(ActionEvent eu){
}
}
====