Skip to content

Delete file2.txt

Delete file2.txt #116

Workflow file for this run

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
public class ComplaintsGUI extends JFrame {
private JTextArea complaintsTextArea;
private JButton sendButton;
private JLabel statusLabel;
private boolean isComplaintAvailable;
private Date lastComplaintTimestamp;
public ComplaintsGUI() {
setTitle("Student Marks Complaints");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400, 300);
setLayout(new BorderLayout());
complaintsTextArea = new JTextArea();
add(complaintsTextArea, BorderLayout.CENTER);
sendButton = new JButton("Send Complaint");
sendButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sendComplaint();
}
});
add(sendButton, BorderLayout.SOUTH);
statusLabel = new JLabel("Status: Ready");

Check failure on line 34 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

You have an error in your yaml syntax on line 34
add(statusLabel, BorderLayout.NORTH);
isComplaintAvailable = true;
lastComplaintTimestamp = new Date();
}
private synchronized void sendComplaint() {
if (!isComplaintAvailable) {
Date currentTimestamp = new Date();
long timeDifference = currentTimestamp.getTime() - lastComplaintTimestamp.getTime();
long maxWaitingTime = 3 * 24 * 60 * 60 * 1000; // 3 days in milliseconds
if (timeDifference <= maxWaitingTime) {
statusLabel.setText("Status: Please wait before sending another complaint.");
return;
}
}
String complaint = complaintsTextArea.getText();
// Process the complaint (e.g., send it to the appropriate department, store it in a database, etc.)
isComplaintAvailable = false;
lastComplaintTimestamp = new Date();
complaintsTextArea.setText("");
statusLabel.setText("Status: Complaint sent successfully.");
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
ComplaintsGUI complaintsGUI = new ComplaintsGUI();
complaintsGUI.setVisible(true);
}
});
}
}