Search in sources :

Example 1 with CardDominanceTableModel

use of org.magic.gui.models.CardDominanceTableModel in project MtgDesktopCompanion by nicho92.

the class BestCardsDashlet method initGUI.

@Override
public void initGUI() {
    JPanel panneauHaut = new JPanel();
    getContentPane().add(panneauHaut, BorderLayout.NORTH);
    cboFormat = new JComboBox<>();
    cboFormat.setModel(new DefaultComboBoxModel<>(FORMAT.values()));
    panneauHaut.add(cboFormat);
    cboFilter = new JComboBox<>();
    cboFilter.setModel(new DefaultComboBoxModel<>(MTGControler.getInstance().getEnabledDashBoard().getDominanceFilters()));
    panneauHaut.add(cboFilter);
    lblLoading = new JLabel("");
    lblLoading.setIcon(MTGConstants.ICON_LOADING);
    panneauHaut.add(lblLoading);
    JScrollPane scrollPane = new JScrollPane();
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    models = new CardDominanceTableModel();
    table = new JXTable(models);
    scrollPane.setViewportView(table);
    initToolTip(table, 0, null);
    cboFormat.addActionListener(ae -> init());
    cboFilter.addActionListener(ae -> 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")));
        try {
            cboFormat.setSelectedItem(getProperty("FORMAT", "standard"));
            cboFilter.setSelectedItem(getProperty("FILTER", "all"));
        } catch (Exception e) {
            logger.error("can't get value", e);
        }
        setBounds(r);
    }
    setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JXTable(org.jdesktop.swingx.JXTable) CardDominanceTableModel(org.magic.gui.models.CardDominanceTableModel) Rectangle(java.awt.Rectangle) JLabel(javax.swing.JLabel)

Aggregations

Rectangle (java.awt.Rectangle)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JXTable (org.jdesktop.swingx.JXTable)1 CardDominanceTableModel (org.magic.gui.models.CardDominanceTableModel)1