I'm hoping someone out there can help me.
i have to use a 2nd class to create a JMenuBar to attach to a JFrame
i get an error :49: incompatible types
found : javax.swing.JFrame
required: java.lang.String
return aTestFrame;
(i have also tried something else and got a static/non static error)
here's the code thanks for any help!
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);
return aTestFrame;
}}
class MenuFactory {
String MenuFactory (String menuInput){
JFrame aTestFrame= null;
JMenuBar generate= null;
JMenu createMenu;
JMenuItem createMenuItem;
// File Menu, F - Mnemonic
createMenu = new JMenu("File");
createMenu.setMnemonic(KeyEvent.VK_F);
generate.add(createMenu );
// File->New, N - Mnemonic
createMenuItem = new JMenuItem("New", KeyEvent.VK_N);
createMenu.add(createMenuItem);
aTestFrame.setJMenuBar (generate );
return aTestFrame;
}
}