i dont have any idea help
heloo
this is code for My jframe
i put filemenue but there is problem when i click on menue drop menu is not visible but menue item do work (if u now where the items are )
if you have no idea then is it possible to create 3 different menue and ask action performed to look at their event instead of Jmenue item.
because if i cant find solution then thats my only way
but how should i ask for actionPerforme to listen to them.
class ChessMaextends JFrameimplements ActionListener{
JMenuItem item;
JMenu m;
JMenuBar bar;
public ChessMa()
{ setTitle("CHESS PLAYER GAME" );
setSize(400,490);
addWindowListener(new java.awt.event.WindowAdapter(){
publicvoid windowClosing(java.awt.event.WindowEvent e){
System.exit(0);
}
});
JMenu m=new JMenu ("File");
m.addActionListener(this);
m.setPopupMenuVisible(true);
item =new JMenuItem("Save");
item.addActionListener(this);
m.add(item);
repaint();
item=new JMenuItem("Load");
item.addActionListener(this);
m.add(item);
JMenuBar bar =new JMenuBar () ;
bar.add(m) ;
setJMenuBar(bar);
}
publicvoid actionPerformed(ActionEvent e)
{
//if (e .getSource() instanceof item)
String arg= e.getActionCommand();
if (arg.equals("Save"))
{ System.out.println("save");}
elseif (arg.equals("Load"))
{System.out.println("load");}
elseif (arg.equals("File"))
{System.out.println("?2222222?!");}
}
}
[code]
publicclass ChessMan{
publicstaticvoid main(String[] args){
JFrame frame =new ChessMa();
ImageIcon customImageIcon =new ImageIcon("ac516.gif");
Image customImage = customImageIcon.getImage();
frame.setIconImage(customImage);
// Japplet Class
ChessPlayer javaAppletication =new ChessPlayer();
javaAppletication.init();
javaAppletication.start();
Container content = frame.getContentPane();
content.add(javaAppletication, BorderLayout.CENTER);
javaAppletication.setBackground (Color.black);
frame.setVisible(true);
frame.show();
frame.pack();// invokes getPreferredSize()
// invokes paint();
}
i cant see any thing when i press on menu
menue items do work but they are invisible
|_
|File|
|-
now when i press file i cant see any menu item
they do work but not viewable.
tanx

