List of usage examples for javax.swing JTable setAutoResizeMode
@BeanProperty(enumerationValues = { "JTable.AUTO_RESIZE_OFF", "JTable.AUTO_RESIZE_NEXT_COLUMN", "JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS", "JTable.AUTO_RESIZE_LAST_COLUMN", "JTable.AUTO_RESIZE_ALL_COLUMNS" }, description = "Whether the columns should adjust themselves automatically.") public void setAutoResizeMode(int mode)
From source file:org.openmicroscopy.shoola.agents.metadata.editor.ChannelAcquisitionComponent.java
/** * Sets the plane info for the specified channel. * //w w w . j ava 2 s .c o m * @param index The index of the channel. */ void setPlaneInfo(int index) { if (channel.getIndex() != index) return; Collection result = model.getChannelPlaneInfo(index); String[][] values = new String[2][result.size() + 1]; String[] names = new String[result.size() + 1]; int i = 0; Iterator j = result.iterator(); PlaneInfo info; Map<String, Object> details; List<String> notSet; names[0] = "t"; values[0][i] = "Delta T"; values[1][i] = "Exposure"; i++; while (j.hasNext()) { info = (PlaneInfo) j.next(); details = EditorUtil.transformPlaneInfo(info); notSet = (List<String>) details.get(EditorUtil.NOT_SET); if (!notSet.contains(EditorUtil.DELTA_T)) { if (details.get(EditorUtil.DELTA_T) instanceof BigResult) { MetadataViewerAgent.logBigResultExeption(this, details.get(EditorUtil.DELTA_T), EditorUtil.DELTA_T); values[0][i] = "N/A"; } else { double tInS = ((Double) details.get(EditorUtil.DELTA_T)); values[0][i] = getReadableTime(tInS); } } else values[0][i] = "--"; if (!notSet.contains(EditorUtil.EXPOSURE_TIME)) { if (details.get(EditorUtil.EXPOSURE_TIME) instanceof BigResult) { MetadataViewerAgent.logBigResultExeption(this, details.get(EditorUtil.EXPOSURE_TIME), EditorUtil.EXPOSURE_TIME); values[1][i] = "N/A"; } else { double tInS = ((Double) details.get(EditorUtil.EXPOSURE_TIME)); values[1][i] = getReadableTime(tInS); } } else values[1][i] = "--"; names[i] = "t=" + i; i++; } if (i > 1) { JTable table = new JTable(values, names); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setShowGrid(true); table.setGridColor(Color.LIGHT_GRAY); JScrollPane pane = new JScrollPane(table); Dimension d = table.getPreferredSize(); Dimension de = exposureTask.getPreferredSize(); pane.setPreferredSize(new Dimension(de.width - 10, 4 * d.height)); exposureTask.add(pane); exposureTask.setVisible(true); } else { exposureTask.setVisible(false); } }