D
Deleted member 1079204
hi guys, may error na lumalabas sa loob ng Action Listener ng button, pero meron naman ng main method sa class na nilagay ko like yung patient.main(null);, nasa baba po yung code, mat mali ba sa flow or sa pag declare
"The method main(null) is undefined for the type JButton"
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class dashBoard extends JFrame {
public void userDashboard() {
JButton patient = new JButton("JButton");
patient.setBounds(30, 50, 150, 40);
patient.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
patient.main(null);
}
});
JButton labs = new JButton("Labs");
labs.setBounds(200, 50, 150, 40);
labs.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
labs.main(null);
}
});
JButton branches = new JButton("Branches");
branches.setBounds(370, 50, 150, 40)
branches.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
branches.main(null);
}
});
JButton medicine = new JButton("Medicine");
medicine.setBounds(540, 50, 150, 40);
medicine.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
medicine.main(null);
}
});
JButton appointment = new JButton("Appointment");
appointment.setBounds(90, 100, 150, 40);
appointment.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
appointment.main(null);
}
});
JButton suppliesAndEquipment = new JButton("Supplies & Equipment");
suppliesAndEquipment.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
equipmentSupplies.main(null);
}
});
JButton exit = new JButton("Close");
exit.setBounds(550, 466, 150, 40);
exit.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
add(patient);
add(exit);
add(suppliesAndEquipment);
add(appointment);
add(branches);
add(labs);
setSize(1000, 1000);
setVisible(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setLayout(null);
}
public static void main(String args[]) {
dashBoard dashboard = new dashBoard();
dashboard.userDashboard();
}
}
"The method main(null) is undefined for the type JButton"
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class dashBoard extends JFrame {
public void userDashboard() {
JButton patient = new JButton("JButton");
patient.setBounds(30, 50, 150, 40);
patient.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
patient.main(null);
}
});
JButton labs = new JButton("Labs");
labs.setBounds(200, 50, 150, 40);
labs.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
labs.main(null);
}
});
JButton branches = new JButton("Branches");
branches.setBounds(370, 50, 150, 40)
branches.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
branches.main(null);
}
});
JButton medicine = new JButton("Medicine");
medicine.setBounds(540, 50, 150, 40);
medicine.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
medicine.main(null);
}
});
JButton appointment = new JButton("Appointment");
appointment.setBounds(90, 100, 150, 40);
appointment.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
appointment.main(null);
}
});
JButton suppliesAndEquipment = new JButton("Supplies & Equipment");
suppliesAndEquipment.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
equipmentSupplies.main(null);
}
});
JButton exit = new JButton("Close");
exit.setBounds(550, 466, 150, 40);
exit.addActionListener(new ActionListener() {
Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
add(patient);
add(exit);
add(suppliesAndEquipment);
add(appointment);
add(branches);
add(labs);
setSize(1000, 1000);
setVisible(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setLayout(null);
}
public static void main(String args[]) {
dashBoard dashboard = new dashBoard();
dashboard.userDashboard();
}
}