/ I also come a 2012 summary

JFrame doesn't add TabbedPane

My JFrame is not adding the JTabbedPane & I don’t know if the crash is some sort of bug of my eclipse. There are no syntaxes errors or anything that seems to be to me wrong. Could anyone else try to run it & see if it works? The code is already ready to run. Thanks in advance

public class MainScreen extends JFrame implements ActionListener { JMenuBar bar; JMenu file, register; JMenuItem close, search; ImageIcon logo= new ImageIcon("rsc/img/sh-logo.jpg"); ImageIcon worldIcon= new ImageIcon("rsc/img/world-icon.png"); JLabel lbImage1; JTabbedPane tabbedPane = new JTabbedPane(); JPanel entrance = new JPanel(); public MainScreen() { JFrame mainFrame = new JFrame(); lbImage1= new JLabel(logo, JLabel.CENTER); entrance.add(lbImage1); tabbedPane.addTab("SHST", worldIcon, entrance); mainFrame.add( tabbedPane, BorderLayout.CENTER); bar= new JMenuBar(); file= new JMenu("File"); register= new JMenu("Search"); close= new JMenuItem("Close"); close.addActionListener(this); search= new JMenuItem("Request Query"); search.addActionListener(this); //Keyboard Shortcut register.setMnemonic(KeyEvent.VK_S); file.setMnemonic(KeyEvent.VK_F); search.setMnemonic(KeyEvent.VK_R); //mainFrame Setup bar.add(file); bar.add(register); file.add(close); register.add(search); mainFrame.add(bar); mainFrame.setExtendedState(getExtendedState() | mainFrame.MAXIMIZED_BOTH); // Maximized Window or setSize(getMaximumSize()); mainFrame.setTitle("SHST"); mainFrame.setJMenuBar(bar); mainFrame.setDefaultCloseOperation(0); mainFrame.setVisible(true); WindowListener J=new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }; addWindowListener(J); } public void actionPerformed(ActionEvent e){ if(e.getSource()==close){ System.exit(0); } } public static void main (String[] args){ MainScreen m= new MainScreen(); } }

You’ve added JMenuBar in Content pane. It is not required.

remove this line in your code mainFrame.add(bar); & mainFrame.setJMenuBar(bar); is already added.