Java Code Examples for org.jdesktop.swingx.JXTable#setModel()

The following examples show how to use org.jdesktop.swingx.JXTable#setModel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportPanel.java    From BART with MIT License 6 votes vote down vote up
private void initJTableFiles()   {
    jTableFiles = new JXTable();
    jTableFilesTableModel = new DBMSImportTableModel(jTableFiles);
    jTableFiles.setColumnControlVisible(true);
    jTableFiles.setEditable(false);
    jTableFiles.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jTableFiles.setModel(jTableFilesTableModel);
    jTableFiles.setShowGrid(true);
    jTableFiles.setDragEnabled(false); 
    jTableFiles.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if(jTableFiles.getSelectedRow() < 0)   {
                delFileButton.setEnabled(false);
            }else{
                delFileButton.setEnabled(true);
            }
        }
    });
    scrollPaneFiles.setViewportView(jTableFiles);   
}
 
Example 2
Source File: TableDataView.java    From BART with MIT License 5 votes vote down vote up
private void initJTable()   {
    valueTable = new JXTable();
    valueTable.setColumnControlVisible(true);
    valueTable.setEditable(false);
    valueTable.setDefaultRenderer(Object.class, new TableValueCellRender());
    valueTable.setCellSelectionEnabled(true);
    valueTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    valueTable.setModel(dataModel);
    valueTable.setShowGrid(true);
    valueTable.setDragEnabled(false); 
    valueTable.setSelectionBackground(new Color(214, 217, 223));
    valueTable.setVisibleRowCount(20);
    pageCtrlPanel.setVisibleRow(20+"");
}
 
Example 3
Source File: ChartTopComponent.java    From BART with MIT License 5 votes vote down vote up
private void initTable()   {
    cellChangesTable = new JXTable();
    cellChangesTable.setEditable(false);
    cellChangesTable.setColumnControlVisible(true);
    cellChangesTable.setShowGrid(true);
    cellChangesTable.setDragEnabled(false); 
    cellChangesTable.setSelectionBackground(new Color(214, 217, 223));
    cellChangesTable.setModel(model);
}
 
Example 4
Source File: AlarmGUI.java    From MtgDesktopCompanion with GNU General Public License v3.0 4 votes vote down vote up
public void initGUI() {
		splitPanel = new JSplitPane();

		table = new JXTable();
		model = new CardAlertTableModel();
		JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);
		magicCardDetailPanel = new MagicCardDetailPanel();
		variationPanel = new HistoryPricesPanel(true);
		JPanel panelRight = new JPanel();
		resultListModel = new DefaultListModel<>();
		list = new JList<>(resultListModel);
		JPanel panel = new JPanel();
		btnRefresh = UITools.createBindableJButton(null, MTGConstants.ICON_REFRESH, KeyEvent.VK_R, "refresh Alarm");
		btnImport = UITools.createBindableJButton(null, MTGConstants.ICON_IMPORT, KeyEvent.VK_I, "import Alarm");
		btnDelete = UITools.createBindableJButton(null, MTGConstants.ICON_DELETE, KeyEvent.VK_D, "delete Alarm");
		btnSuggestPrice = UITools.createBindableJButton(null, MTGConstants.ICON_EURO, KeyEvent.VK_S, "suggestPrices Alarm");
		lblLoading = AbstractBuzyIndicatorComponent.createProgressComponent();
		JPanel serversPanel = new JPanel();
		ServerStatePanel oversightPanel = new ServerStatePanel(false,MTGControler.getInstance().getPlugin("Alert Trend Server", MTGServer.class));
		ServerStatePanel serverPricePanel = new ServerStatePanel(false,MTGControler.getInstance().getPlugin("Alert Price Checker", MTGServer.class));
		UITools.initTableFilter(table);

		
///////CONFIG		
		setLayout(new BorderLayout());
		splitPanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
		table.setModel(model);
		table.getColumnModel().getColumn(3).setCellRenderer(new AlertedCardsRenderer());
		magicCardDetailPanel.enableThumbnail(true);
		list.setCellRenderer((JList<? extends MagicPrice> obj, MagicPrice value, int index, boolean isSelected,boolean cellHasFocus) -> new MagicPricePanel(value));
		table.getColumnModel().getColumn(4).setCellRenderer(new CardShakeRenderer());
		table.getColumnModel().getColumn(5).setCellRenderer(new CardShakeRenderer());
		table.getColumnModel().getColumn(6).setCellRenderer(new CardShakeRenderer());
		table.getColumnModel().getColumn(1).setCellRenderer(new MagicEditionsComboBoxCellRenderer(false));
		table.getColumnModel().getColumn(1).setCellEditor(new MagicEditionsComboBoxCellEditor());
		table.setRowHeight(MTGConstants.TABLE_ROW_HEIGHT);

		btnSuggestPrice.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("SUGGEST_PRICE"));
		
		panelRight.setLayout(new BorderLayout());
	
///////ADDS	
		splitPanel.setLeftComponent(new JScrollPane(table));
		add(splitPanel, BorderLayout.CENTER);
		splitPanel.setRightComponent(tabbedPane);
		
		serversPanel.setLayout(new GridLayout(2, 1, 0, 0));
		serversPanel.add(oversightPanel);
		serversPanel.add(serverPricePanel);
		panelRight.add(serversPanel,BorderLayout.SOUTH);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("DETAILS"), MTGConstants.ICON_TAB_DETAILS, magicCardDetailPanel, null);
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("PRICE_VARIATIONS"), MTGConstants.ICON_TAB_VARIATIONS, variationPanel, null);
		pricesTablePanel = new PricesTablePanel();
		tabbedPane.addTab(MTGControler.getInstance().getLangService().getCapitalize("PRICES"), MTGConstants.ICON_TAB_PRICES, pricesTablePanel, null);
		add(panelRight, BorderLayout.EAST);
		panelRight.add(new JScrollPane(list),BorderLayout.CENTER);
		add(panel, BorderLayout.NORTH);
		panel.add(btnDelete);
		panel.add(btnImport);
		panel.add(btnRefresh);
		panel.add(btnSuggestPrice);
		panel.add(lblLoading);
		
	}
 
Example 5
Source File: OrderImporterDialog.java    From MtgDesktopCompanion with GNU General Public License v3.0 4 votes vote down vote up
public OrderImporterDialog() {
	
	setSize(new Dimension(500, 300));
	setTitle(MTGControler.getInstance().getLangService().getCapitalize("FINANCIAL_MODULE"));
	setIconImage(MTGConstants.ICON_SHOP.getImage());
	setModal(true);
	getContentPane().setLayout(new BorderLayout(0, 0));

	table = new JXTable();
	model = new ShoppingEntryTableModel();
	panelChoose = new JPanel();
	JPanel panel = new JPanel();
	JPanel panelButton = new JPanel();
	JButton btnClose = new JButton(MTGConstants.ICON_CANCEL);
	JButton btnLoad = new JButton(MTGConstants.ICON_OPEN);
	btnImport = new JButton(MTGConstants.ICON_CHECK);
	cboSniffers =UITools.createCombobox(MTGShopper.class,false);
	
	table.setModel(model);
	panel.setLayout(new BorderLayout(0, 0));
	
	
	getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);		
	getContentPane().add(panel, BorderLayout.NORTH);
	
	panel.add(panelChoose, BorderLayout.WEST);
	panelChoose.add(cboSniffers);
	panelChoose.add(btnLoad);
	panelChoose.add(lblLoad);
	getContentPane().add(panelButton, BorderLayout.SOUTH);
	panelButton.add(btnClose);
	panelButton.add(btnImport);
	
	selectedSniffer = MTGControler.getInstance().listEnabled(MTGShopper.class).get(0);
	
	
			
	cboSniffers.addActionListener(e -> selectedSniffer = (MTGShopper) cboSniffers.getSelectedItem());

	btnLoad.addActionListener(ae->{
		AbstractObservableWorker<List<OrderEntry>, OrderEntry, MTGShopper> sw = new AbstractObservableWorker<>(lblLoad,selectedSniffer) {
			@Override
			protected List<OrderEntry> doInBackground() throws Exception {
				return plug.listOrders();
			}
			@Override
			protected void done() {
				super.done();
				model.init(getResult());
			}
		};
		ThreadManager.getInstance().runInEdt(sw, "loading orders");
	});
	
	
	btnClose.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("CANCEL"));
	
	btnClose.addActionListener(e -> dispose());

	btnImport.setToolTipText(MTGControler.getInstance().getLangService().getCapitalize("IMPORT"));
	
	btnImport.addActionListener(e -> 
		ThreadManager.getInstance().invokeLater(() -> {
				try {
					btnImport.setEnabled(false);
					selectedEntries = UITools.getTableSelections(table, 0);
					btnImport.setEnabled(true);
					dispose();
				} catch (Exception e1) {
					logger.error("Error snif",e1);
					MTGControler.getInstance().notify(e1);
					btnImport.setEnabled(true);
				}
				finally
				{
					selectedSniffer.removeObserver(lblLoad);
				}
			})
	);

	
	setLocationRelativeTo(null);
}