private void scaleCellSize(double scale) { this.cellSize = (int) (this.cellSize * scale); this.fixCellSize(); }
/** * Sets the heat map font. * * @param font the heat map font */ public void setHeatmapFont(Font font) { this.font = ofNullable(font); this.colorKey.setFont(font); this.fixCellSize(); this.updateUI(); }
/** * Establishes the data matrix of the heatmap. * * @param data a {@code double[][]}. */ public void setData(double[][] data) { this.data = data; this.colorKey.setLowValue(min(data)); this.colorKey.setHighValue(max(data)); this.initializeColors(); invokeLater(() -> { this.heatmapTM.fireTableDataChanged(); this.fixCellSize(); }); }
private Component getHeatMap() { this.heatmapTM = new HeatMapTableModel(); this.heatmap = new JXTable(this.heatmapTM); this.heatmap.setDefaultRenderer( Object.class, new CustomTableCellRenderer()); this.heatmap.setTableHeader(null); this.heatmap.addMouseWheelListener(e -> { if(!mouseZoomEnabled) { return; } if (e.getWheelRotation() < 0) { zoomIn(); } else { zoomOut(); } }); this.heatmap.setFont(this.heatmap.getFont().deriveFont( (float) this.cellSize)); this.heatmap.setColumnControlVisible(false); this.heatmap.setShowHorizontalLines(false); this.heatmap.setShowVerticalLines(false); this.heatmap.setFillsViewportHeight(false); this.heatmap.setRowMargin(0); this.heatmap.setIntercellSpacing(new Dimension(0, 0)); this.heatmap.setCellSelectionEnabled(false); this.heatmap.setAutoCreateRowSorter(false); this.heatmap.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); this.fixCellSize(); return new JScrollPane(this.heatmap); }