use of org.magic.services.extra.MTGEventProvider in project MtgDesktopCompanion by nicho92.
the class MagicEventsDashlet method initGUI.
public void initGUI() {
provider = new MTGEventProvider();
JPanel panneauHaut = new JPanel();
getContentPane().add(panneauHaut, BorderLayout.NORTH);
cboYear = new JComboBox<>();
cboYear.addItemListener(ie -> init());
panneauHaut.add(cboYear);
lblLoading = new JLabel("");
lblLoading.setIcon(MTGConstants.ICON_LOADING);
lblLoading.setVisible(false);
cboMonth = new JComboBox<>();
panneauHaut.add(cboMonth);
panneauHaut.add(lblLoading);
JScrollPane scrollPane = new JScrollPane();
getContentPane().add(scrollPane, BorderLayout.CENTER);
eventsModel = new MagicEventsTableModel();
table = new JXTable();
scrollPane.setViewportView(table);
c = GregorianCalendar.getInstance();
c.setTime(new Date());
for (int i = c.get(Calendar.YEAR) - 1; i <= c.get(Calendar.YEAR) + 1; i++) cboYear.addItem(i);
for (int i = 1; i < 13; i++) cboMonth.addItem(i);
cboYear.setSelectedItem(c.get(Calendar.YEAR));
cboMonth.setSelectedItem(c.get(Calendar.MONTH) + 1);
cboYear.addItemListener(ie -> {
if (ie.getStateChange() == ItemEvent.SELECTED) {
init();
}
});
cboMonth.addItemListener(ie -> {
if (ie.getStateChange() == ItemEvent.SELECTED) {
init();
}
});
if (getProperties().size() > 0) {
Rectangle r = new Rectangle((int) Double.parseDouble(getProperty("x")), (int) Double.parseDouble(getProperty("y")), (int) Double.parseDouble(getProperty("w")), (int) Double.parseDouble(getProperty("h")));
setBounds(r);
}
setVisible(true);
}
Aggregations