I want to create a Subscription alert system.
I have a created a table in my database as such
CREATE TABLE "Subs" ("SubsID" VARCHAR PRIMARY KEY NOT NULL , "PartnerID" VARCHAR NOT NULL , "ItemsID" VARCHAR NOT NULL , "EstQty" INTEGER NOT NULL , "Frequency" VARCHAR NOT NULL , "Duration" INTEGER NOT NULL , "Type" VARCHAR NOT NULL , "StartDate" DATE NOT NULL DEFAULT CURRENT_DATE, "EndDate" DATE NOT NULL )
The Frequency (either in MONTHS or YEARS).
I want to create something like an alert table that will display all such instances of the table Subs, considering the startDate and the chosen frequency(eg. Monthly). For example if one instance of the table Subs has a startDate = 2016-02-02, with frequency= Monthly, then the table should display that instance if queried on the date= 2016-03-02 i.e on the 2nd of every month .
With Eclipse, I have a created a simple JFrame that has a table.
I have cracked my head and still don't know how to go about this
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTable;
import javax.swing.JButton;
import javax.swing.JScrollPane;
public class alerttabs extends JFrame {
private JPanel contentPane;
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
alerttabs frame = new alerttabs();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public alerttabs() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 749, 459);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(163, 50, 560, 200);
contentPane.add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
JButton btnNewButton = new JButton("New button");
btnNewButton.setBounds(43, 40, 89, 23);
contentPane.add(btnNewButton);
}
}
Aucun commentaire:
Enregistrer un commentaire