how to fill a jtable with a dropdown menue in each cell
i need to create a dropdown menu in the cells so that the user choose one option for every cell. what piece of code should i add to this code inorder to create it??
Code:
public void CreateScheduler(){
newFrame = new JFrame("Create Scheduler");
newFrame.setSize(600,300);
newFrame.setLocation(screenWidth/4,screenHeight/4);
newFrame.setResizable(false);
Employee emp = new Employee();
String columnNames[] = {"Names","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
Object data[][] = new Object [v.size()][8];
for (int j=0; j<v.size();j++){
emp = (Employee) v.elementAt(k);
data[j][0] = emp.getFName();
}
JTable abtable = new JTable(data,columnNames);
JScrollPane scrollPane = new JScrollPane(abtable);
abtable.setPreferredScrollableViewportSize(new Dimension(500, 370));
JPanel topPane = new JPanel();
JLabel label = new JLabel("Create Scheduler");
topPane.add(label);
JPanel bottomPane = new JPanel();
newFrame.getContentPane().add(topPane,BorderLayout.SOUTH);
newFrame.getContentPane().add(scrollPane,BorderLayout.CENTER);
newFrame.setLocation(screenWidth/4,screenHeight/4);
newFrame.show();
JButton bttnSave = new JButton("Save");
bottomPane.add(bttnSave);
bttnSave.addActionListener(this);
newFrame.getContentPane().add(topPane,BorderLayout.NORTH);
newFrame.getContentPane().add(topPane,BorderLayout.CENTER);
newFrame.getContentPane().add(bottomPane,BorderLayout.SOUTH);
newFrame.show();
}