The items to choose from with my menu bar show up behind the textarea. I cannot figure out how to get them on top. The commented out area is what I thought might work but it did not any suggestions?? I am fairly new at this so any suggestions are greatly appreciated.
Thank you for all your help,
David Mohr
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
public class Menu implements ActionListener {
JLabel label = new JLabel();
JPanel menupanel = new JPanel();
JPanel mainpanel = new JPanel();
String path = null;
Filereaderclass obj;
TextArea jScrollPane1;
BorderLayout borderLayout1 = new BorderLayout();
JFileChooser jfc;
int result = 0;
String filename;
File file;
JFrame frame;
JMenuItem item;
JMenuItem item1;
Container content;
//JInternalFrame Iframe;
public Menu() {
frame = new JFrame("menu test");
frame.setSize(300,300);
content = frame.getContentPane();
jScrollPane1 = new TextArea();
content.setLayout(borderLayout1);
//Iframe = new JInternalFrame("");
//content.add(Iframe);
//Iframe.add(jScrollPane1, BorderLayout.CENTER);
content.add(jScrollPane1, BorderLayout.CENTER);
content.add(menupanel, BorderLayout.NORTH);
JMenuBar mb = new JMenuBar();
frame.setJMenuBar(mb);
JMenu file1 = new JMenu("file");
mb.add(file1);
item1 = new JMenuItem("open");
item1.addActionListener(this);
file1.add(item1);
item = new JMenuItem("quit");
item.addActionListener(this);
file1.add(item);
frame.setVisible(true);
//Iframe.setVisible(true);
}
public void actionPerformed(ActionEvent event) {
if(event.getSource().equals(item1)){
jfc = new JFileChooser(".");
result = jfc.showOpenDialog(frame);
filename = jfc.getSelectedFile().getName();
file = new File(filename);
path = file.getAbsolutePath();
obj = new Filereaderclass();
String a = obj.getinfo(path);
if(result == jfc.APPROVE_OPTION)
jScrollPane1.setText(a);
else
label.setText("selection cancelled");
} //ends if
}// ends ap
public static void main(String args[]) {
new Menu();
}//ends main
} //ends class
[ April 02, 2002: Message edited by: david mohr ]