Search in sources :

Example 1 with CardsShakerTableModel

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

the class BestTrendingDashlet method initGUI.

@Override
public void initGUI() {
    JPanel panneauHaut = new JPanel();
    getContentPane().add(panneauHaut, BorderLayout.NORTH);
    Action a = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            init();
        }
    };
    boxS = new JCheckBox();
    boxS.setAction(a);
    boxS.setText("STD");
    boxM = new JCheckBox();
    boxM.setAction(a);
    boxM.setText("MDN");
    boxL = new JCheckBox();
    boxL.setAction(a);
    boxL.setText("LEG");
    boxV = new JCheckBox("V");
    boxV.setAction(a);
    boxV.setText("VIN");
    spinner = new JSpinner();
    spinner.addChangeListener(ce -> init());
    spinner.setModel(new SpinnerNumberModel(5, 1, null, 1));
    panneauHaut.add(spinner);
    panneauHaut.add(boxS);
    panneauHaut.add(boxM);
    panneauHaut.add(boxL);
    panneauHaut.add(boxV);
    JScrollPane scrollPane = new JScrollPane();
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    modStandard = new CardsShakerTableModel();
    table = new JXTable(modStandard);
    scrollPane.setViewportView(table);
    initToolTip(table, 0, 1);
    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 {
            spinner.setValue(Integer.parseInt(getProperty("LIMIT", "5")));
        } catch (Exception e) {
            logger.error("can't get LIMIT value", e);
        }
        try {
            boxS.setSelected(Boolean.parseBoolean(getProperty("STD", "false")));
            boxM.setSelected(Boolean.parseBoolean(getProperty("MDN", "true")));
            boxL.setSelected(Boolean.parseBoolean(getProperty("LEG", "false")));
            boxV.setSelected(Boolean.parseBoolean(getProperty("VIN", "false")));
        } catch (Exception e) {
            logger.error("can't get LIMIT value", e);
        }
        setBounds(r);
    }
    setVisible(true);
}
Also used : JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) JXTable(org.jdesktop.swingx.JXTable) ActionEvent(java.awt.event.ActionEvent) Rectangle(java.awt.Rectangle) JSpinner(javax.swing.JSpinner) CardsShakerTableModel(org.magic.gui.models.CardsShakerTableModel) AbstractAction(javax.swing.AbstractAction) IOException(java.io.IOException)

Example 2 with CardsShakerTableModel

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

the class TrendingDashlet method initGUI.

public void initGUI() {
    JButton btnRefresh;
    JPanel panel;
    JPanel panneauHaut = new JPanel();
    getContentPane().add(panneauHaut, BorderLayout.NORTH);
    cboFormats = new JComboBox<>(new DefaultComboBoxModel<FORMAT>(FORMAT.values()));
    cboFormats.addItemListener(ie -> init());
    panneauHaut.add(cboFormats);
    lblLoading = new JLabel("");
    lblLoading.setIcon(MTGConstants.ICON_LOADING);
    lblLoading.setVisible(false);
    btnRefresh = new JButton("");
    btnRefresh.addActionListener(ae -> init());
    btnRefresh.setIcon(MTGConstants.ICON_REFRESH);
    panneauHaut.add(btnRefresh);
    panneauHaut.add(lblLoading);
    JScrollPane scrollPane = new JScrollPane();
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    modStandard = new CardsShakerTableModel();
    table = new JXTable();
    scrollPane.setViewportView(table);
    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 {
            cboFormats.setSelectedItem(FORMAT.valueOf(getProperty("FORMAT")));
        } catch (Exception e) {
            MTGLogger.printStackTrace(e);
        }
        setBounds(r);
    }
    new TableFilterHeader(table, AutoChoices.ENABLED);
    initToolTip(table, 0, 1);
    panel = new JPanel();
    getContentPane().add(panel, BorderLayout.SOUTH);
    lblInfoUpdate = new JLabel("");
    panel.add(lblInfoUpdate);
    setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JXTable(org.jdesktop.swingx.JXTable) JButton(javax.swing.JButton) Rectangle(java.awt.Rectangle) JLabel(javax.swing.JLabel) CardsShakerTableModel(org.magic.gui.models.CardsShakerTableModel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) TableFilterHeader(net.coderazzi.filters.gui.TableFilterHeader)

Aggregations

Rectangle (java.awt.Rectangle)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)2 JXTable (org.jdesktop.swingx.JXTable)2 CardsShakerTableModel (org.magic.gui.models.CardsShakerTableModel)2 ActionEvent (java.awt.event.ActionEvent)1 IOException (java.io.IOException)1 AbstractAction (javax.swing.AbstractAction)1 Action (javax.swing.Action)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 JButton (javax.swing.JButton)1 JCheckBox (javax.swing.JCheckBox)1 JLabel (javax.swing.JLabel)1 JSpinner (javax.swing.JSpinner)1 SpinnerNumberModel (javax.swing.SpinnerNumberModel)1 TableFilterHeader (net.coderazzi.filters.gui.TableFilterHeader)1