please tell me where i'm off
the window opens but no menu bar.
the error says :
java:52: '.class' expected
menuInput[][] = array [row][col];

thanks hs

import java.awt.*;
      import java.awt.event.KeyEvent;
      import javax.swing.*;
    
      public class Driver{
      public static void main(String[] args) {
      TheWindowObject aTestFrame = new TheWindowObject ("test");  
   
      }      }
 
      class TheWindowObject{
 
      TheWindowObject(String title){
      CreateWindow () ;
        }
      TheWindowObject(String title, int height, int width){
        }
        JFrame CreateWindow (){
   
      String title ="test";
      int height =200 ;
      int width=400 ;
      JFrame aTestFrame= null;
    
     aTestFrame =new JFrame("test");
        aTestFrame.setSize (width, height);
      aTestFrame.setVisible (true);
       aTestFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        aTestFrame.setJMenuBar (new MenuFactory().generate());
        return aTestFrame;
        }}
        class MenuFactory {
        JMenuBar generate(){
   
      JFrame aTestFrame= null;
        JMenuBar generate= new JMenuBar();
        JMenu createMenu=null;
        JMenuItem createMenuItem;
      String  menuInput= null;
        array();
        createMenu = new JMenu(menuInput);
        generate.add(createMenu );
        return generate;
          }
        
            
          String [][]array(){
		  String [][] array = null;
          String [][] menuInput ={{"File", "Edit", "Windows", "Help"},{"Open","Cut","First","About"},{"Close","Paste","Second", null},{"Exit","Copy",null, null},{null, "Select All", null, null,}};                    
                           for ( row=0; row<array.length; row++){
                 for ( col=0; col< array[row].length; col++) 
 			menuInput[][] =  array [row][col];
  }
  return menuInput;
   }
}

Recommended Answers

All 3 Replies

have you tried updating your java?
(use search 'java' & update)
M

In case you haven't found it:

String [][] menuInput ={{"File", "Edit", "Windows", "Help"},{"Open","Cut","First","About"},{"Close","Paste","Second", null},{"Exit","Copy",null, null},{null, "Select All", null, null[B],[/B]}};

I think it is the extra ',' you have at the end:
{null, "Select All", null, null,}

thanks

In case you haven't found it:

String [][] menuInput ={{"File", "Edit", "Windows", "Help"},{"Open","Cut","First","About"},{"Close","Paste","Second", null},{"Exit","Copy",null, null},{null, "Select All", null, null[B],[/B]}};

I think it is the extra ',' you have at the end:
{null, "Select All", null, null,}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.