use of org.magic.gui.models.CardAlertTableModel in project MtgDesktopCompanion by nicho92.
the class AlertedCardsTrendingDashlet method initGUI.
@Override
public void initGUI() {
JScrollPane scrollPane = new JScrollPane();
getContentPane().add(scrollPane, BorderLayout.CENTER);
model = new CardAlertTableModel();
JTable table = new JTable(model);
scrollPane.setViewportView(table);
HistoryPricesPanel historyPricesPanel = new HistoryPricesPanel();
historyPricesPanel.setMaximumSize(new Dimension(2147483647, 200));
historyPricesPanel.setPreferredSize(new Dimension(119, 200));
getContentPane().add(historyPricesPanel, BorderLayout.SOUTH);
table.getSelectionModel().addListSelectionListener(event -> {
if (!event.getValueIsAdjusting()) {
ThreadManager.getInstance().execute(() -> {
int row = table.getSelectedRow();
MagicCardAlert alt = (MagicCardAlert) table.getValueAt(row, 0);
historyPricesPanel.init(alt.getCard(), alt.getCard().getEditions().get(0), alt.getCard().toString());
historyPricesPanel.revalidate();
});
}
});
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