下面列出了javax.swing.JTable#setRowSorter ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private JScrollPane tableScrollPane(){
table_model = new CharSetsTableModel(getTableDataWithAvailableCharsets(), columns);
JTable table = new JTable(table_model);
TableColumn col = table.getColumnModel().getColumn(0);
col.setMinWidth(50);
col.setMaxWidth(50);
table.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
if(0==table.getSelectedColumn()){
return;
}
table.setValueAt(!(Boolean)table.getValueAt(table.getSelectedRow(), 0), table.getSelectedRow(),0);
}
});
sorter = new TableRowSorter<CharSetsTableModel>(table_model);
table.setRowSorter(sorter);
JScrollPane jscrollPane = new JScrollPane(table);
return jscrollPane;
}
/**
* Loads the Data Array into the tmodel with custom datatype
*
* @param table to be populated
* @param header column header
* @param rows nullRoww data
* @return populated tmodel
*/
public static void populatetable(JTable table, List<String[]> rows) {
removeRowSelection(table);
DefaultTableModel tablemodel = (DefaultTableModel) table.getModel();
table.setRowSorter(null);
tablemodel.setRowCount(0);
for (String[] row : rows) {
int colsize = row.length;
Object[] newRow = new Object[colsize];
for (int col = 0; col < colsize; col++) {
newRow[col] = col > 0 ? row[col] : Boolean.valueOf(row[0]);
}
tablemodel.addRow(newRow);
}
table.setModel(tablemodel);
}
protected void initFilters(JTable table) {
TableRowSorter sorter = new TableRowSorter(table.getModel());
table.setRowSorter(sorter);
if (visualsFilter == null) {
visualsFilter = new RowFilter<UIDefaultsTableModel,Integer>() {
public boolean include(Entry<? extends UIDefaultsTableModel, ? extends Integer> entry) {
UIDefaultsTableModel model = entry.getModel();
Object defaultsValue = model.getValueAt(entry.getIdentifier().intValue(),
UIDefaultsTableModel.VALUE_COLUMN);
return defaultsValue instanceof Color ||
defaultsValue instanceof Font ||
defaultsValue instanceof Icon;
}
};
}
if (onlyVisualsCheckBox.isSelected()) {
sorter.setRowFilter(visualsFilter);
}
}
public Discrete1BandTabularForm(ColorManipulationForm parentForm) {
this.parentForm = parentForm;
tableModel = new ImageInfoTableModel();
moreOptionsForm = new MoreOptionsForm(this, false);
final JTable table = new JTable(tableModel);
table.setRowSorter(new TableRowSorter<>(tableModel));
table.setDefaultRenderer(Color.class, new ColorTableCellRenderer());
table.setDefaultEditor(Color.class, new ColorTableCellEditor());
table.getTableHeader().setReorderingAllowed(false);
table.getColumnModel().getColumn(1).setPreferredWidth(140);
table.getColumnModel().getColumn(3).setCellRenderer(new PercentageRenderer());
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
final JScrollPane tableScrollPane = new JScrollPane(table);
tableScrollPane.getViewport().setPreferredSize(table.getPreferredSize());
contentPanel = tableScrollPane;
}
/**
* Re-draw all keystore tables
* @param applicationSettings
*/
public void redrawKeyStores(ApplicationSettings applicationSettings) {
if (keyStoreTables != null) {
keyStoreTableColumns = applicationSettings.getKeyStoreTableColumns();
for (JTable keyStoreTable : keyStoreTables) {
KeyStoreHistory history = ((KeyStoreTableModel) keyStoreTable.getModel()).getHistory();
KeyStoreTableModel ksModel = new KeyStoreTableModel(keyStoreTableColumns);
try {
ksModel.load(history);
keyStoreTable.setModel(ksModel);
RowSorter<KeyStoreTableModel> sorter = new TableRowSorter<>(ksModel);
keyStoreTable.setRowSorter(sorter);
setColumnsToIconSize(keyStoreTable, 0, 1, 2);
colAdjust(keyStoreTable);
} catch (GeneralSecurityException | CryptoException e) {
DError.displayError(frame, e);
}
}
}
}
/**
* Creates a new panel object.
*
* @param processList Process list shown in the table.
*/
public CProcessListPanel(final ProcessList processList) {
super(new BorderLayout());
m_processList = processList;
final CProcessListModel model = new CProcessListModel(processList);
m_sorter = new TableRowSorter<CProcessListModel>(model);
m_table = new JTable(model);
m_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
m_table.setRowSorter(m_sorter);
final JScrollPane scrollPane = new JScrollPane(m_table);
scrollPane.setBorder(new TitledBorder("Please select a process to debug"));
add(scrollPane);
setPreferredSize(new Dimension(200, 200));
}
protected void initFilters(JTable table) {
TableRowSorter sorter = new TableRowSorter(table.getModel());
table.setRowSorter(sorter);
if (visualsFilter == null) {
visualsFilter = new RowFilter<UIDefaultsTableModel,Integer>() {
public boolean include(Entry<? extends UIDefaultsTableModel, ? extends Integer> entry) {
UIDefaultsTableModel model = entry.getModel();
Object defaultsValue = model.getValueAt(entry.getIdentifier().intValue(),
UIDefaultsTableModel.VALUE_COLUMN);
return defaultsValue instanceof Color ||
defaultsValue instanceof Font ||
defaultsValue instanceof Icon;
}
};
}
if (onlyVisualsCheckBox.isSelected()) {
sorter.setRowFilter(visualsFilter);
}
}
private void updateDataTable() {
dataTable = new JTable();
dataTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
if(data != null) {
dataModel = new UmbelConceptTableModel(data);
dataTable.setModel(dataModel);
dataTable.setRowSorter(new TableRowSorter(dataModel));
dataTable.setColumnSelectionAllowed(false);
dataTable.setRowSelectionAllowed(true);
dataTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
TableColumn column = null;
for (int i=0; i < dataTable.getColumnCount(); i++) {
column = dataTable.getColumnModel().getColumn(i);
column.setPreferredWidth(dataModel.getColumnWidth(i));
}
tableScrollPane.setViewportView(dataTable);
}
}
public static <T extends TableModel> JTable createSortableTable(T tableModel, int defaultSort)
{
//CREATE TABLE
JTable table = new JTable(tableModel);
//CREATE SORTER
TableRowSorter<T> rowSorter = new TableRowSorter<T>(tableModel);
//drowSorter.setSortsOnUpdates(true);
//DEFAULT SORT DESCENDING
rowSorter.toggleSortOrder(defaultSort);
rowSorter.toggleSortOrder(defaultSort);
//ADD TO TABLE
table.setRowSorter(rowSorter);
//RETURN
return table;
}
public static <T extends TableModel> JTable createSortableTable(T tableModel, int defaultSort, RowFilter<T, Object> rowFilter)
{
//CREATE TABLE
JTable table = new JTable(tableModel);
//CREATE SORTER
TableRowSorter<T> rowSorter = new TableRowSorter<T>(tableModel);
//rowSorter.setSortsOnUpdates(true);
rowSorter.setRowFilter(rowFilter);
//DEFAULT SORT DESCENDING
rowSorter.toggleSortOrder(defaultSort);
rowSorter.toggleSortOrder(defaultSort);
//ADD TO TABLE
table.setRowSorter(rowSorter);
//RETURN
return table;
}
/**
* Constructor
*
* @param parent
* Parent frame to center on
*
* @param data
* Map data to display
*/
public StatisticsDialog(JFrame parent, MapData data) {
super(parent);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setTitle(EditorLabels.getLabel("statistics.header"));
StatisticsTableModel model = new StatisticsTableModel(data);
JTabbedPane tabs = new JTabbedPane();
JTable table = new JTable(model);
TableRowSorter<TableModel> sorter = new TableRowSorter<>(model);
table.setRowSorter(sorter);
tabs.add(EditorLabels.getLabel("statistics.overview"), new JScrollPane(table));
for (int i = 0; i < data.getPlayerCount(); i++) {
tabs.add("player " + i, new PlayerDiagram(data, i));
}
setLayout(new BorderLayout());
add(tabs, BorderLayout.CENTER);
pack();
setModal(true);
setLocationRelativeTo(parent);
}
public ProductPlacemarkView(VectorDataNode vectorDataNode) {
this.vectorDataNode = vectorDataNode;
this.vectorDataNode.getProduct().addProductNodeListener(new PNL());
tableModel = new PlacemarkTableModel();
JTable placemarkTable = new JTable();
placemarkTable.setRowSorter(new TableRowSorter<>(tableModel));
placemarkTable.addMouseListener(new PopupMenuHandler(this));
placemarkTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
placemarkTable.setModel(tableModel);
final TableCellRenderer renderer = placemarkTable.getTableHeader().getDefaultRenderer();
final int margin = placemarkTable.getTableHeader().getColumnModel().getColumnMargin();
Enumeration<TableColumn> columns = placemarkTable.getColumnModel().getColumns();
while (columns.hasMoreElements()) {
TableColumn tableColumn = columns.nextElement();
final int width = getColumnMinWith(tableColumn, renderer, margin);
tableColumn.setMinWidth(width);
}
final JScrollPane scrollPane = new JScrollPane(placemarkTable);
setLayout(new BorderLayout());
add(scrollPane, BorderLayout.CENTER);
}
public void setTopicMapsList() {
if(getApiKey() != null) {
try {
JSONObject list = MaianaUtils.listAvailableTopicMaps(getApiEndPoint(), getApiKey());
if(list.has("msg")) {
WandoraOptionPane.showMessageDialog(window, list.getString("msg"), "API says", WandoraOptionPane.WARNING_MESSAGE);
//System.out.println("REPLY:"+list.toString());
}
if(list.has("data")) {
mapTable = new JTable();
mapTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
if(list != null) {
JSONArray datas = list.getJSONArray("data");
TopicMapsTableModel myModel = new TopicMapsTableModel(datas);
mapTable.setModel(myModel);
mapTable.setRowSorter(new TableRowSorter(myModel));
mapTable.setColumnSelectionAllowed(false);
mapTable.setRowSelectionAllowed(true);
mapTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
TableColumn column = null;
for (int i=0; i < mapTable.getColumnCount(); i++) {
column = mapTable.getColumnModel().getColumn(i);
column.setPreferredWidth(myModel.getColumnWidth(i));
}
tableScrollPane.setViewportView(mapTable);
}
}
}
catch(Exception e) {
Wandora.getWandora().displayException("Exception '"+e.getMessage()+"' occurred while getting the list of topic maps.", e);
}
}
}
public static void main(String[] args) {
Object[][] data = { { "A", 5 }, { "B", 2 }, { "C", 4 }, { "D", 8 } };
String columnNames[] = { "Item", "Value" };
TableModel model = new DefaultTableModel(data, columnNames) {
public Class<?> getColumnClass(int column) {
return getValueAt(0, column).getClass();
}
};
JTable table = new JTable(model);
RowFilter<Object, Object> filter = new RowFilter<Object, Object>() {
public boolean include(Entry entry) {
Integer population = (Integer) entry.getValue(1);
return population.intValue() > 3;
}
};
TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
sorter.setRowFilter(filter);
table.setRowSorter(sorter);
JScrollPane scrollPane = new JScrollPane(table);
JFrame frame = new JFrame("Filtering Table");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(scrollPane);
frame.setSize(300, 200);
frame.setVisible(true);
}
/**
* Initalize component after properties set. Normally called by context vía init-method
*/
public void init() {
okIcon = FormUtils.getIcon(okIcon, "/images/16x16/dialog-ok.png");
cancelIcon = FormUtils.getIcon(cancelIcon, "/images/16x16/dialog-cancel.png");
visibilityMenuIcon = FormUtils.getIcon(visibilityMenuIcon, "/images/16x16/view-choose.png");
userMenuIcon = FormUtils.getIcon(userMenuIcon, "/images/table/16x16/users.png");
if (tableModel == null) {
tableModel = new ListTableModel();
}
setLayout(layout);
// Server side sorter
sorter = new ModelRowSorter<ListTableModel>(tableModel);
sorter.addRowSorterListener(this);
// configure paginator
if (showPaginator) {
if (paginatorView == null) {
paginatorView = new PaginatorView();
paginatorView.init();
}
paginatorView.setPaginator(page);
page.addPaginatorListener(this);
add(paginatorView.getPanel(), BorderLayout.SOUTH);
}
else {
page.setPageSize(Integer.MAX_VALUE);
}
createColumnDescriptos();
table = new JTable(tableModel, tableModel.getTableColumnModel());
table.setAutoCreateRowSorter(false);
table.setRowSorter(sorter);
table.setRowHeight(22);
table.addMouseListener(new TableListener());
tableScrollPane = new JScrollPane(table);
this.setBackground(Color.WHITE);
add(tableScrollPane, BorderLayout.CENTER);
if (showMenu)
createMenu();
page.setPageableDataSource(dataSource);
// goto first page
page.firstPage();
// restore table state
restoreState();
}
/**
* Construct the GUI.
*/
private void initGUI() {
technologiesModel = new GenericTableModel<XElement>() {
/** */
private static final long serialVersionUID = 2557373261832556243L;
@Override
public Object getValueFor(XElement item, int rowIndex,
int columnIndex) {
switch (columnIndex) {
case 0: return rowIndex;
case 1: return item.get("id", "");
case 2: return context.dataManager().label(item.get("name", null));
case 3: return context.get(item.get("category", null));
case 4: return item.getIntObject("level");
case 5: return item.get("race", null);
case 6: return item.getIntObject("production-cost");
case 7: return item.getIntObject("research-cost");
case 8: return context.getIcon(validateItem(item));
default:
return null;
}
}
};
technologiesModel.setColumnNames(
get("tech.#"),
get("tech.id"),
get("tech.name"),
get("tech.category"),
get("tech.level"),
get("tech.race"),
get("tech.research_cost"),
get("tech.production_cost"),
"");
technologiesModel.setColumnTypes(
Integer.class,
String.class,
String.class,
String.class,
Integer.class,
String.class,
Integer.class,
Integer.class,
ImageIcon.class
);
technologies = new JTable(technologiesModel);
technologiesSorter = new TableRowSorter<>(technologiesModel);
technologies.setRowSorter(technologiesSorter);
technologies.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
int idx = technologies.getSelectedRow();
if (idx >= 0) {
idx = technologies.convertRowIndexToModel(idx);
doDetails(technologiesModel.get(idx), idx);
} else {
doDetails(null, -1);
}
}
}
});
JPanel top = createTopPanel();
verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
verticalSplit.setTopComponent(top);
JPanel bottom = createBottomPanel();
verticalSplit.setBottomComponent(bottom);
verticalSplit.setResizeWeight(0.75);
setLayout(new BorderLayout());
add(verticalSplit, BorderLayout.CENTER);
doUpdateCount();
doDetails(null, -1);
}
public ResultWindow(String title, PeakListRow peakListRow, double searchedMass, int charge,
Task searchTask) {
super(title);
this.title = title;
this.peakListRow = peakListRow;
this.searchTask = searchTask;
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setBackground(Color.white);
JPanel pnlLabelsAndList = new JPanel(new BorderLayout());
pnlLabelsAndList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
pnlLabelsAndList.add(new JLabel("List of possible formulas"), BorderLayout.NORTH);
resultsTableModel = new ResultTableModel(searchedMass);
resultsTable = new JTable();
// int rowHeight = resultsTable.getRowHeight();
resultsTable.setRowHeight(22);
resultsTable.setModel(resultsTableModel);
resultsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
resultsTable.getTableHeader().setReorderingAllowed(false);
resultsTableSorter = new TableRowSorter<ResultTableModel>(resultsTableModel);
// set descending order by isotope score
resultsTableSorter.toggleSortOrder(3);
resultsTableSorter.toggleSortOrder(3);
resultsTable.setRowSorter(resultsTableSorter);
TableColumnModel columnModel = resultsTable.getColumnModel();
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setHorizontalAlignment(SwingConstants.LEFT);
resultsTable.setDefaultRenderer(Double.class, renderer);
columnModel.getColumn(4).setCellRenderer(new PercentageCellRenderer(1));
columnModel.getColumn(5).setCellRenderer(new PercentageCellRenderer(1));
JScrollPane listScroller = new JScrollPane(resultsTable);
listScroller.setPreferredSize(new Dimension(350, 100));
listScroller.setAlignmentX(LEFT_ALIGNMENT);
JPanel listPanel = new JPanel();
listPanel.setLayout(new BoxLayout(listPanel, BoxLayout.PAGE_AXIS));
listPanel.add(listScroller);
listPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
pnlLabelsAndList.add(listPanel, BorderLayout.CENTER);
JPanel pnlButtons = new JPanel();
pnlButtons.setLayout(new BoxLayout(pnlButtons, BoxLayout.X_AXIS));
pnlButtons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
GUIUtils.addButton(pnlButtons, "Add identity", null, this, "ADD");
GUIUtils.addButton(pnlButtons, "Copy to clipboard", null, this, "COPY");
GUIUtils.addButton(pnlButtons, "Export all", null, this, "EXPORT");
GUIUtils.addButton(pnlButtons, "View isotope pattern", null, this, "SHOW_ISOTOPES");
GUIUtils.addButton(pnlButtons, "Show MS/MS", null, this, "SHOW_MSMS");
setLayout(new BorderLayout());
setSize(500, 200);
add(pnlLabelsAndList, BorderLayout.CENTER);
add(pnlButtons, BorderLayout.SOUTH);
pack();
}
public ResultWindow(PeakListRow peakListRow, double searchedMass, Task searchTask) {
super("");
this.peakListRow = peakListRow;
this.searchTask = searchTask;
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setBackground(Color.white);
JPanel pnlLabelsAndList = new JPanel(new BorderLayout());
pnlLabelsAndList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
pnlLabelsAndList.add(new JLabel("List of possible identities"), BorderLayout.NORTH);
listElementModel = new ResultTableModel(searchedMass);
IDList = new JTable();
IDList.setModel(listElementModel);
IDList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
IDList.getTableHeader().setReorderingAllowed(false);
TableRowSorter<ResultTableModel> sorter =
new TableRowSorter<ResultTableModel>(listElementModel);
IDList.setRowSorter(sorter);
JScrollPane listScroller = new JScrollPane(IDList);
listScroller.setPreferredSize(new Dimension(350, 100));
listScroller.setAlignmentX(LEFT_ALIGNMENT);
JPanel listPanel = new JPanel();
listPanel.setLayout(new BoxLayout(listPanel, BoxLayout.PAGE_AXIS));
listPanel.add(listScroller);
listPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
pnlLabelsAndList.add(listPanel, BorderLayout.CENTER);
JPanel pnlButtons = new JPanel();
pnlButtons.setLayout(new BoxLayout(pnlButtons, BoxLayout.X_AXIS));
pnlButtons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
GUIUtils.addButton(pnlButtons, "Add identity", null, this, "ADD");
GUIUtils.addButton(pnlButtons, "View structure", null, this, "VIEWER");
GUIUtils.addButton(pnlButtons, "View isotope pattern", null, this, "ISOTOPE_VIEWER");
GUIUtils.addButton(pnlButtons, "Open browser", null, this, "BROWSER");
setLayout(new BorderLayout());
setSize(500, 200);
add(pnlLabelsAndList, BorderLayout.CENTER);
add(pnlButtons, BorderLayout.SOUTH);
pack();
}
public DebugTabPane()
{
super();
//ADD TABS
this.addTab("Console", new ConsolePanel());
this.peersTableModel = new PeersTableModel();
this.addTab("Peers", new JScrollPane(Gui.createSortableTable(this.peersTableModel, 0)));
//TRANSACTIONS TABLE MODEL
this.transactionsTableModel = new TransactionsTableModel();
this.transactionsTable = new JTable(this.transactionsTableModel);
//TRANSACTIONS SORTER
Map<Integer, Integer> indexes = new TreeMap<Integer, Integer>();
indexes.put(TransactionsTableModel.COLUMN_TIMESTAMP, TransactionMap.TIMESTAMP_INDEX);
QoraRowSorter sorter = new QoraRowSorter(transactionsTableModel, indexes);
transactionsTable.setRowSorter(sorter);
//TRANSACTION DETAILS
this.transactionsTable.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if(e.getClickCount() == 2)
{
//GET ROW
int row = transactionsTable.getSelectedRow();
row = transactionsTable.convertRowIndexToModel(row);
//GET TRANSACTION
Transaction transaction = transactionsTableModel.getTransaction(row);
//SHOW DETAIL SCREEN OF TRANSACTION
TransactionDetailsFactory.getInstance().createTransactionDetail(transaction);
}
}
});
//ADD TRANSACTIONS TABLE
this.addTab("Transactions", new JScrollPane(this.transactionsTable));
//BLOCKS TABLE MODEL
this.blocksTableModel = new BlocksTableModel();
JTable blocksTable = new JTable(this.blocksTableModel);
//BLOCKS SORTER
indexes = new TreeMap<Integer, Integer>();
indexes.put(BlocksTableModel.COLUMN_HEIGHT, BlockMap.HEIGHT_INDEX);
sorter = new QoraRowSorter(blocksTableModel, indexes);
blocksTable.setRowSorter(sorter);
//ADD BLOCK TABLE
this.addTab("Blocks", new JScrollPane(blocksTable));
this.loggerTextArea = new LoggerTextArea(Logger.getGlobal());
JScrollPane scrollPane = new JScrollPane(this.loggerTextArea);
JScrollBar vertical = scrollPane.getVerticalScrollBar();
vertical.setValue(vertical.getMaximum());
this.addTab("Logger", scrollPane);
}
public GeneralTabPane()
{
super();
//ACCOUNTS
this.addTab("Accounts", new AccountsPanel());
//SEND
this.addTab("Send money", new SendMoneyPanel());
//TRANSACTIONS
this.transactionsModel = new WalletTransactionsTableModel();
this.transactionsTable = new JTable(this.transactionsModel);
//TRANSACTIONS SORTER
Map<Integer, Integer> indexes = new TreeMap<Integer, Integer>();
indexes.put(WalletTransactionsTableModel.COLUMN_CONFIRMATIONS, TransactionMap.TIMESTAMP_INDEX);
indexes.put(WalletTransactionsTableModel.COLUMN_TIMESTAMP, TransactionMap.TIMESTAMP_INDEX);
indexes.put(WalletTransactionsTableModel.COLUMN_ADDRESS, TransactionMap.ADDRESS_INDEX);
indexes.put(WalletTransactionsTableModel.COLUMN_AMOUNT, TransactionMap.AMOUNT_INDEX);
QoraRowSorter sorter = new QoraRowSorter(transactionsModel, indexes);
transactionsTable.setRowSorter(sorter);
//TRANSACTION DETAILS
this.transactionsTable.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if(e.getClickCount() == 2)
{
//GET ROW
int row = transactionsTable.getSelectedRow();
row = transactionsTable.convertRowIndexToModel(row);
//GET TRANSACTION
Transaction transaction = transactionsModel.getTransaction(row);
//SHOW DETAIL SCREEN OF TRANSACTION
TransactionDetailsFactory.getInstance().createTransactionDetail(transaction);
}
}
});
this.addTab("Transactions", new JScrollPane(this.transactionsTable));
//TRANSACTIONS
WalletBlocksTableModel blocksModel = new WalletBlocksTableModel();
JTable blocksTable = new JTable(blocksModel);
//TRANSACTIONS SORTER
indexes = new TreeMap<Integer, Integer>();
indexes.put(WalletBlocksTableModel.COLUMN_HEIGHT, BlockMap.TIMESTAMP_INDEX);
indexes.put(WalletBlocksTableModel.COLUMN_TIMESTAMP, BlockMap.TIMESTAMP_INDEX);
indexes.put(WalletBlocksTableModel.COLUMN_GENERATOR, BlockMap.GENERATOR_INDEX);
indexes.put(WalletBlocksTableModel.COLUMN_BASETARGET, BlockMap.BALANCE_INDEX);
indexes.put(WalletBlocksTableModel.COLUMN_TRANSACTIONS, BlockMap.TRANSACTIONS_INDEX);
indexes.put(WalletBlocksTableModel.COLUMN_FEE, BlockMap.FEE_INDEX);
sorter = new QoraRowSorter(blocksModel, indexes);
blocksTable.setRowSorter(sorter);
this.addTab("Generated Blocks", new JScrollPane(blocksTable));
//NAMING
this.addTab("Naming service", new NamingServicePanel());
//VOTING
this.addTab("Voting", new VotingPanel());
//ASSETS
this.addTab("Assets", new AssetsPanel());
}