Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I asked this earlier but I have narrowed down the problem. Here is my code: public class mainScreen extends JPanel implements ActionListener { JFrame mainFrame

I asked this earlier but I have narrowed down the problem. Here is my code:

public class mainScreen extends JPanel implements ActionListener { JFrame mainFrame = new JFrame("Task Board"); JPanel mainPanel = new JPanel(); JButton editButton; taskBoardModel userBoard; public void mainScreen(taskBoardModel getBoard) { userBoard = getBoard; JFrame mainFrame = new JFrame("Task Board");

this.drawMenu(userBoard); this.drawColumns(userBoard.columns); } public void drawMenu(taskBoardModel userBoard) { JPanel menuPanel = new JPanel(); mainFrame.setLayout(new BorderLayout()); mainPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); menuPanel.setLayout(new BorderLayout()); JPanel menuLeft = new JPanel(); JPanel menuRight = new JPanel(); menuLeft.setLayout(new FlowLayout()); menuRight.setLayout(new FlowLayout()); JLabel selectLabel = new JLabel("Select Project: "); JComboBox selectBox = new JComboBox(); selectBox.addItem(""); JButton editButton = new JButton("Edit"); JButton saveButton = new JButton("Save"); JButton deleteButton = new JButton("Delete"); //JButton editButton = new JButton("Edit"); editButton.addActionListener(this); menuLeft.add(selectLabel); menuLeft.add(selectBox); menuLeft.add(saveButton); menuLeft.add(editButton); menuLeft.add(deleteButton); JButton loadButton = new JButton("Load..."); JButton createButton = new JButton("Create new"); JButton logoutButton = new JButton("Logout"); menuRight.add(loadButton); menuRight.add(createButton); menuRight.add(logoutButton); menuPanel.add(menuLeft,BorderLayout.WEST); menuPanel.add(menuRight,BorderLayout.EAST); menuPanel.setBorder(BorderFactory.createLineBorder(Color.black)); userBoard.columns.get(0).columnName = "WORK DAMNITG"; mainFrame.add(menuPanel,BorderLayout.NORTH); mainFrame.add(mainPanel,BorderLayout.CENTER); mainFrame.setSize(1000, 1000); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.setVisible(true); } public void actionPerformed(ActionEvent ae) { if(ae.getSource() == editButton) { JOptionPane.showMessageDialog(null, "I am happy.");

} } My problem seems to be that the editButton isn't working. I have added an actionlistener and I wrote an actionlistener method, but it still doesnt do anything when i click it.

Thanks.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions