I want to create a new window that contains JTable
as a result of pressing a JMenuItem
, i tried creating a new class inside of the action listener, not sure how correct that is. Anyways it doesn't work, please advise.
...
help.add(currencyTable);
...
//action listener for the currency table JMenuItem button
currencyTable.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)
{
class currencyJTableClass extends JFrame
{
JTable currencyTable;
public currencyJTableClass()
{
setLayout(new FlowLayout());
String[] headLine = {"x","y","z"} ;
String [][] currencyData =
{
{
"a","b","c"
},
{
"d","e","f"
},
};
currencyJTable = new JTable(currencyData,headLine);
}
}