import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MainFrame extends JFrame{
JMenuBar main=new JMenuBar();
JMenu menu1=new JMenu("File");
JMenu menu2=new JMenu("Search");
JMenu menu3=new JMenu("Display");
JMenu menu4=new JMenu("About");
JMenuItem exit=new JMenuItem("Exit");
JMenuItem pw=new JMenuItem("Piece Worker");
JMenuItem hw=new JMenuItem("Hourly Employee");
JMenuItem pcw=new JMenuItem("Piece Worker");
JMenuItem hrly=new JMenuItem("Hourly Worker");
JMenuItem author=new JMenuItem("Author");
JLabel label=new JLabel("Hello");
public MainFrame(){
setTitle("Employee Entry");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
setJMenuBar(main);
main.add(menu1);
main.add(menu2);
main.add(menu3);
main.add(menu4);
menu1.add(exit);
menu2.add(pw);
menu2.add(hw);
menu3.add(pcw);
menu3.add(hrly);
menu4.add(author);
label.setFont(new Font("Arial",Font.BOLD,26));
}
public static void main(String [] args){
MainFrame frame=new MainFrame();
frame.setSize(500,200);
frame.setVisible(true);
frame.setResizable(false);
}
}
Can someone teach me how to put an image to the whole space of the frame....