List of usage examples for java.awt.event MouseEvent getClickCount
public int getClickCount()
From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java
private void selectionFolder(DBBrowserNode selectedNode, MouseEvent e) { if (e.getClickCount() == 2) { return;//from w ww.j a v a 2 s . co m } JPopupMenu popupMenu = new JPopupMenu(); boolean testSql = false; if (selectedNode.getDBObject().getType() == DBObject.FOLDER_QUERY) { testSql = true; JMenuItem menuItem = new JMenuItem(new ImportQueryAction(selectedNode.getDBObject().getAbsolutePath())); popupMenu.add(menuItem); } else if (selectedNode.getDBObject().getType() == DBObject.FOLDER_REPORT) { testSql = true; JMenuItem menuItem = new JMenuItem( new ImportReportAction(selectedNode.getDBObject().getAbsolutePath())); popupMenu.add(menuItem); JMenuItem menuItem2 = new JMenuItem( new DownloadBulkReportAction(selectedNode.getDBObject().getAbsolutePath())); popupMenu.add(menuItem2); } else if (selectedNode.getDBObject().getType() == DBObject.FOLDER_CHART) { testSql = true; JMenuItem menuItem = new JMenuItem(new ImportChartAction(selectedNode.getDBObject().getAbsolutePath())); popupMenu.add(menuItem); JMenuItem menuItem2 = new JMenuItem( new DownloadBulkChartAction(selectedNode.getDBObject().getAbsolutePath())); popupMenu.add(menuItem2); } JMenuItem menuItem = new JMenuItem( new AddFolderAction(this, selectedNode, selectedNode.getDBObject().getType())); popupMenu.add(menuItem); JMenuItem menuItem2 = new JMenuItem(new RenameFolderAction(this, selectedNode)); popupMenu.add(menuItem2); JMenuItem menuItem3 = new JMenuItem(new DeleteFolderAction(this, selectedNode)); popupMenu.add(menuItem3); if (testSql) { JMenuItem menuItem4 = new JMenuItem(new ValidateSqlsAction(selectedNode.getDBObject())); popupMenu.add(menuItem4); } popupMenu.show((Component) e.getSource(), e.getX(), e.getY()); }
From source file:com.SE.myPlayer.MusicPlayerGUI.java
private void songData_TableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_songData_TableMouseClicked try {//from w w w . j a va2 s. c o m if (evt.getClickCount() == 2 | next == 1 | previous == 1 && SwingUtilities.isLeftMouseButton(evt)) { currentSongRow = songData_Table.getSelectedRow(); songLocation = songData[currentSongRow]; sd.addToRecent(songLocation); for (ObjectBean list1 : list) { list1.getMpg().addJmenuItemsToRecentSongs(); } songPlay(); } else if (SwingUtilities.isRightMouseButton(evt)) { Point point = evt.getPoint(); int alreadySelectedRow = songData_Table.getSelectedRow(); int currentRow = songData_Table.rowAtPoint(point); songData_Table.setRowSelectionInterval(alreadySelectedRow, currentRow); if (songData_Table.isRowSelected(currentRow)) { songTable_PopUp.show(songData_Table, evt.getX(), evt.getY()); } else { songTable_PopUp.show(songTable_PopUp, evt.getX(), evt.getY()); } } } catch (Exception e) { currentSongRow = songData_Table.getSelectedRow(); songLocation = songData[currentSongRow]; sd.addToRecent(songLocation); for (ObjectBean list1 : list) { list1.getMpg().addJmenuItemsToRecentSongs(); } songPlay(); } ; }
From source file:com.itemanalysis.jmetrik.gui.Jmetrik.java
public Jmetrik() { super("jMetrik"); setPreferredSize(new Dimension(1024, 650)); setDefaultCloseOperation(EXIT_ON_CLOSE); //properly close database if user closes window this.addWindowListener(new WindowAdapter() { @Override/*from w w w . j a v a 2 s .c o m*/ public void windowClosing(WindowEvent we) { if (workspace != null) { workspace.closeDatabase(); } System.exit(0); } }); //add statusbar statusBar = new StatusBar(1024, 30); statusBar.setBorder(new EmptyBorder(2, 2, 2, 2)); getContentPane().add(statusBar, BorderLayout.SOUTH); //start logging startLog(); //left-right splitpane JSplitPane splitPane1 = new JSplitPane(); splitPane1.setDividerLocation(200); //setup workspace list workspaceList = new JList(); workspaceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); workspaceList.setModel(new SortedListModel<DataTableName>()); workspaceList.addKeyListener(new DeleteKeyListener()); // workspaceList.getInsets().set(5, 5, 5, 5); //add icon to list cell renderer String urlString = "/images/spreadsheet.png"; URL url = this.getClass().getResource(urlString); final ImageIcon tableIcon = new ImageIcon(url, "Table"); workspaceList.setCellRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); label.setIcon(tableIcon); return label; } }); JScrollPane scrollPane1 = new JScrollPane(workspaceList); scrollPane1.setPreferredSize(new Dimension(200, 698)); splitPane1.setLeftComponent(scrollPane1); //tabbed pane for top pane tabbedPane = new JTabbedPane(); tabbedPane.setTabPlacement(JTabbedPane.BOTTOM); //setup data table dataTable = new DataTable(); dataTable.setRowHeight(18); //change size of table header and center text JTableHeader header = dataTable.getTableHeader(); header.setDefaultRenderer(new TableHeaderCellRenderer()); JScrollPane dataScrollPane = new JScrollPane(dataTable); tabbedPane.addTab("Data", dataScrollPane); //setup variable table variableTable = new DataTable(); variableTable.setRowHeight(18); variableTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); if (e.getClickCount() == 2) { JTable target = (JTable) e.getSource(); int row = target.getSelectedRow(); int col = target.getSelectedColumn(); if (col == 0) { if (target.getModel() instanceof VariableModel) { VariableModel vModel = (VariableModel) target.getModel(); String s = (String) vModel.getValueAt(row, col); DatabaseName db = workspace.getDatabaseName(); DataTableName table = workspace.getCurrentDataTable(); RenameVariableDialog renameVariableDialog = new RenameVariableDialog(Jmetrik.this, db, table, s); renameVariableDialog.setVisible(true); if (renameVariableDialog.canRun()) { RenameVariableCommand command = renameVariableDialog.getCommand(); workspace.runProcess(command); } } //end instanceof } //end if col==0 } //end if click count==2 }//end mouse clicked }); //change size of table header and center text JTableHeader variableHeader = variableTable.getTableHeader(); variableHeader.setDefaultRenderer(new TableHeaderCellRenderer()); variableHeader.setPreferredSize(new Dimension(30, 21)); JScrollPane variableScrollPane = new JScrollPane(variableTable); tabbedPane.addTab("Variables", variableScrollPane); splitPane1.setRightComponent(tabbedPane); getContentPane().add(splitPane1, BorderLayout.CENTER); //add status bar listener - needed to display status message that are generated within this class this.addPropertyChangeListener(statusBar.getStatusListener()); //add listener for displaying error messages - needed to display errors and exceptions this.addPropertyChangeListener(new ErrorOccurredPropertyChangeListener()); //instantiate file utilities fileUtils = new JmetrikFileUtils(); fileUtils.addPropertyChangeListener(statusBar.getStatusListener()); //set import and export path to user's documents folder JFileChooser chooser = new JFileChooser(); FileSystemView fw = chooser.getFileSystemView(); importExportPath = fw.getDefaultDirectory().toString().replaceAll("\\\\", "/"); //create and start a workspace startWorkspace(); //create menu bar and tool bar this.setJMenuBar(createMenuBar()); JToolBar toolBar = createToolBar(); toolBar.setFloatable(false); toolBar.setRollover(true); getContentPane().add(toolBar, BorderLayout.PAGE_START); pack(); }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
@SuppressWarnings("unused") public void mouseDragged(MouseEvent e) { if (threeButton) { if (threeBstate != s) { if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null;// ww w. ja v a2 s .c o m threeBstate = s; } else if (threeBstate == spp) { e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } else if (threeBstate == sppr) { return; } } } int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); // button 1 -> 16 // button 2 -> 8 // button 3 -> 4 // shift -> 1 // control -> 2 // alt -> 12 ?? int state = 0; int detail = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); detail = 1; } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); detail = 2; } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); detail = 3; } if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = state; px = x; py = y; event.mkMotionNotify(1, window.screen.rootId, /*window.id,*/ XWindow.sprite.win.id, 0, px, py, e.getX(), e.getY(), state, 1); try { if (!XWindow.checkMotion(event, window)) { return; } event.mkMotionNotify(1, window.screen.rootId, /*window.id,*/ XWindow.sprite.win.id, 0, px, py, px - XWindow.sprite.win.x, py - XWindow.sprite.win.y, //e.getX(), //e.getY(), state, 1); if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(XWindow.sprite.win, event, XWindow.grab, null, 1); } catch (Exception ee) { } }
From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java
private void selectionDatabase(TreePath selPath, DBBrowserNode selectedNode, MouseEvent e) { if (e.getClickCount() == 2) { return;/*www . j av a2s . c o m*/ } boolean connected = false; String name = selectedNode.getDBObject().getName(); DataSourceManager manager = DefaultDataSourceManager.getInstance(); DataSource ds = manager.getDataSource(name); if (ds.getStatus() == DataSourceType.CONNECTED) { connected = true; } else { connected = false; } // try to create source directory (may not exists if we copy datasource.xml) (new File(FileReportPersistence.CONNECTIONS_DIR + File.separator + name + File.separator + FileReportPersistence.QUERIES_FOLDER)).mkdirs(); (new File(FileReportPersistence.CONNECTIONS_DIR + File.separator + name + File.separator + FileReportPersistence.REPORTS_FOLDER)).mkdirs(); (new File(FileReportPersistence.CONNECTIONS_DIR + File.separator + name + File.separator + FileReportPersistence.CHARTS_FOLDER)).mkdirs(); JPopupMenu popupMenu = new JPopupMenu(); JMenuItem menuItem = new JMenuItem(new DataSourceConnectAction(instance, selPath)); popupMenu.add(menuItem); if (connected) { menuItem.setEnabled(false); } else { menuItem.setEnabled(true); } JMenuItem menuItem2 = new JMenuItem(new DataSourceDisconnectAction(instance, selectedNode)); popupMenu.add(menuItem2); if (connected) { menuItem2.setEnabled(true); } else { menuItem2.setEnabled(false); } JMenuItem menuItem5 = new JMenuItem(new DataSourceViewInfoAction(selectedNode)); popupMenu.add(menuItem5); JMenuItem menuItem3 = new JMenuItem(new DataSourceEditAction(instance, selectedNode)); popupMenu.add(menuItem3); if (connected) { menuItem3.setEnabled(false); } else { menuItem3.setEnabled(true); } JMenuItem menuItem4 = new JMenuItem(new DataSourceDeleteAction(instance, selectedNode)); popupMenu.add(menuItem4); if (connected) { menuItem4.setEnabled(false); } else { menuItem4.setEnabled(true); } if (!DefaultDataSourceManager.memoryDataSources()) { JMenuItem menuItem6 = new JMenuItem(new DataSourceSchemaSelectionAction(instance, selectedNode)); popupMenu.add(menuItem6); } popupMenu.show((Component) e.getSource(), e.getX(), e.getY()); }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mousePressed(MouseEvent e) { if (threeButton) { if (threeBstate == s) { threeBPressed = e;/*from w w w. j a va 2 s . com*/ threeBstate = sp; return; } if (threeBstate == sp // || threeBstate==sppr ) { threeBPressed = null; threeBstate = spp; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } procPressed(e); }
From source file:com.farouk.projectapp.FirstGUI.java
private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked jTable2.clearSelection();// www .ja va 2s .c o m jTextField1.setText(jList1.getSelectedValue().toString()); jScrollPane5.setVisible(true); String companyName = jTextField1.getText(); jLabel15.setText( "Selected company : '" + companyName + "'. " + SQLConnect.checkIfAutomated(userID, companyName)); StringThirdParty = companyName; if (evt.getClickCount() == 2 && jTabbedPane1.getSelectedIndex() == 0 || jTabbedPane1.getSelectedIndex() == 1) { jTabbedPane1.setSelectedIndex(1); jLabel15.setText("Selected company : '" + companyName + "'."); try { SQLConnect.refreshOneCompanyOnlyAtSearch(companyName); if (companyName.isEmpty()) { JOptionPane.showMessageDialog(rootPane, "Please provide a valid input.", "Bad input", WIDTH); } else { Company com = SQLConnect.lookForCompany(companyName, userID); UpdatejTable3(com); jButton6.setVisible(true); } } catch (Exception e) { System.err.println("Problem in button.\n" + e); } jLabel2.setVisible(false); } if (evt.getClickCount() == 1 && jTabbedPane1.getSelectedIndex() == 0) { jButton10.setVisible(false); jButton7.setVisible(false); jButton15.setVisible(false); jButton3.setVisible(false); jScrollPane2.setVisible(false); if (SQLConnect.ifAutomated(userID, StringThirdParty) == 2) { jButton19.setText("De-Alert"); } else { jButton19.setText("Alert"); } jTextField6.setText(jList1.getSelectedValue().toString()); } }
From source file:ucar.unidata.idv.control.chart.TimeSeriesChartWrapper.java
/** * Callback method for receiving notification of a mouse click on a chart. * * @param event information about the event. * * @return Did we handle this event// ww w .ja v a 2s . c om */ public boolean chartPanelMouseClicked(MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) { closestAnnotation = findClosestAnnotation(getAllAnnotations(), event.getX(), event.getY(), false, false); return EVENT_PASSON; } if (event.getClickCount() <= 1) { ChartAnnotation annotation = findClosestAnnotation(getAllAnnotations(), event.getX(), event.getY(), true, event.isShiftDown()); if (annotation == null) { return false; } signalChartChanged(); return EVENT_DONTPASSON; } try { if (isOnBottomDomainAxis(event)) { WayPoint waypoint = new WayPoint(getDomainValue(event.getX()), this); waypoint.addPropertyChangeListener(this); if (!waypoint.showProperties(chartPanel, event.getX(), event.getY())) { return EVENT_DONTPASSON; } wayPoints.add(waypoint); setSelectedAnnotation(waypoint, wayPoints, event.isShiftDown()); setLocationPositions(); plot.addAnnotation(waypoint); } else if (isOnLeftRangeAxis(event)) { // System.err.println("new x/y:" + event.getX() +"/" +event.getY()); RangeFilter rangeFilter = new RangeFilter(getRangeValue(event.getY()), this); if (!rangeFilter.showProperties(chartPanel, event.getX(), event.getY())) { return EVENT_DONTPASSON; } rangeFilters.add(rangeFilter); setSelectedAnnotation(rangeFilter, rangeFilters, event.isShiftDown()); plot.addAnnotation(rangeFilter); if (true || event.isShiftDown()) { RangeFilter attached = rangeFilter.doMakeAttached(event); rangeFilters.add(attached); plot.addAnnotation(attached); } rangeFiltersChanged(); } else { return EVENT_PASSON; } } catch (Exception exc) { LogUtil.logException("Error creating wayPoints", exc); } return EVENT_DONTPASSON; }
From source file:com.SE.myPlayer.MusicPlayerGUI.java
private void folder_Playlist_TreeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_folder_Playlist_TreeMouseClicked DefaultMutableTreeNode selectedNode; if (evt.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(evt)) { selectedNode = (DefaultMutableTreeNode) folder_Playlist_Tree.getSelectionPath().getLastPathComponent(); getSongTable(selectedNode.toString()); lastOpen = selectedNode.toString(); for (ObjectBean list1 : list) { if (list1.getTitle().equals("library")) { list1.setLastOpen(lastOpen); }//from w w w .ja v a 2 s .co m } } else if (SwingUtilities.isRightMouseButton(evt)) { DefaultTreeModel myModel = (DefaultTreeModel) folder_Playlist_Tree.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) myModel.getRoot(); TreeNode[] nodes = myModel.getPathToRoot(root); TreePath treepath = new TreePath(nodes); folder_Playlist_Tree.setSelectionPath(treepath); folder_Playlist_Tree.scrollPathToVisible(treepath); TreePath path = folder_Playlist_Tree.getPathForLocation(evt.getX(), evt.getY()); folder_Playlist_Tree.setSelectionPath(path); folder_Playlist_Tree.scrollPathToVisible(path); if (!folder_Playlist_Tree.isSelectionEmpty()) { selectedNode = (DefaultMutableTreeNode) folder_Playlist_Tree.getSelectionPath() .getLastPathComponent(); if (!"playlist".equals(selectedNode.toString()) && !"library".equals(selectedNode.toString())) { folderTree_PopUp.show(folder_Playlist_Tree, evt.getX(), evt.getY()); } } } }
From source file:VASSAL.launch.ModuleManagerWindow.java
protected void buildTree() { recentModuleConfig = new StringArrayConfigurer("RecentModules", null); Prefs.getGlobalPrefs().addOption(null, recentModuleConfig); final List<String> missingModules = new ArrayList<String>(); final List<ModuleInfo> moduleList = new ArrayList<ModuleInfo>(); for (String s : recentModuleConfig.getStringArray()) { final ModuleInfo module = new ModuleInfo(s); if (module.getFile().exists() && module.isValid()) { moduleList.add(module);//from www. jav a 2 s. com } else { missingModules.add(s); } } for (String s : missingModules) { logger.info(Resources.getString("ModuleManager.removing_module", s)); moduleList.remove(s); recentModuleConfig.removeValue(s); } Collections.sort(moduleList, new Comparator<ModuleInfo>() { public int compare(ModuleInfo f1, ModuleInfo f2) { return f1.compareTo(f2); } }); rootNode = new MyTreeNode(new RootInfo()); for (ModuleInfo moduleInfo : moduleList) { final MyTreeNode moduleNode = new MyTreeNode(moduleInfo); for (ExtensionInfo ext : moduleInfo.getExtensions()) { final MyTreeNode extensionNode = new MyTreeNode(ext); moduleNode.add(extensionNode); } final ArrayList<File> missingFolders = new ArrayList<File>(); for (File f : moduleInfo.getFolders()) { if (f.exists() && f.isDirectory()) { final GameFolderInfo folderInfo = new GameFolderInfo(f, moduleInfo); final MyTreeNode folderNode = new MyTreeNode(folderInfo); moduleNode.add(folderNode); final ArrayList<File> l = new ArrayList<File>(); final File[] files = f.listFiles(); if (files == null) continue; for (File f1 : files) { if (f1.isFile()) { l.add(f1); } } Collections.sort(l); for (File f2 : l) { final SaveFileInfo fileInfo = new SaveFileInfo(f2, folderInfo); if (fileInfo.isValid() && fileInfo.belongsToModule()) { final MyTreeNode fileNode = new MyTreeNode(fileInfo); folderNode.add(fileNode); } } } else { missingFolders.add(f); } } for (File mf : missingFolders) { logger.info(Resources.getString("ModuleManager.removing_folder", mf.getPath())); moduleInfo.removeFolder(mf); } rootNode.add(moduleNode); } updateModuleList(); treeModel = new MyTreeTableModel(rootNode); tree = new MyTree(treeModel); tree.setRootVisible(false); tree.setEditable(false); tree.setTreeCellRenderer(new MyTreeCellRenderer()); tree.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { final TreePath path = tree.getPathForLocation(e.getPoint().x, e.getPoint().y); // do nothing if not on a node, or if this node was expanded // or collapsed during the past doubleClickInterval milliseconds if (path == null || (lastExpansionPath == path && e.getWhen() - lastExpansionTime <= doubleClickInterval)) return; selectedNode = (MyTreeNode) path.getLastPathComponent(); final int row = tree.getRowForPath(path); if (row < 0) return; final AbstractInfo target = (AbstractInfo) selectedNode.getUserObject(); // launch module or load save, otherwise expand or collapse node if (target instanceof ModuleInfo) { final ModuleInfo modInfo = (ModuleInfo) target; if (modInfo.isModuleTooNew()) { ErrorDialog.show("Error.module_too_new", modInfo.getFile().getPath(), modInfo.getVassalVersion(), Info.getVersion()); return; } else { ((ModuleInfo) target).play(); } } else if (target instanceof SaveFileInfo) { ((SaveFileInfo) target).play(); } else if (tree.isExpanded(row)) { tree.collapseRow(row); } else { tree.expandRow(row); } } } @Override public void mouseReleased(MouseEvent e) { final TreePath path = tree.getPathForLocation(e.getPoint().x, e.getPoint().y); if (path == null) return; selectedNode = (MyTreeNode) path.getLastPathComponent(); if (e.isMetaDown()) { final int row = tree.getRowForPath(path); if (row >= 0) { tree.clearSelection(); tree.addRowSelectionInterval(row, row); final AbstractInfo target = (AbstractInfo) selectedNode.getUserObject(); target.buildPopup(row).show(tree, e.getX(), e.getY()); } } } }); // We capture the time and location of clicks which would cause // expansion in order to distinguish these from clicks which // might launch a module or game. tree.addTreeWillExpandListener(new TreeWillExpandListener() { public void treeWillCollapse(TreeExpansionEvent e) { lastExpansionTime = System.currentTimeMillis(); lastExpansionPath = e.getPath(); } public void treeWillExpand(TreeExpansionEvent e) { lastExpansionTime = System.currentTimeMillis(); lastExpansionPath = e.getPath(); } }); // This ensures that double-clicks always start the module but // doesn't prevent single-clicks on the handles from working. tree.setToggleClickCount(3); tree.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { final MyTreeNode node = (MyTreeNode) e.getPath().getLastPathComponent(); final AbstractInfo target = node.getNodeInfo(); if (target instanceof ModuleInfo) { setSelectedModule(target.getFile()); } else { if (node.getParent() != null) { setSelectedModule(node.getParentModuleFile()); } } } }); // FIXME: Width handling needs improvement. Also save in prefs tree.getColumnModel().getColumn(KEY_COLUMN).setMinWidth(250); tree.getColumnModel().getColumn(VERSION_COLUMN).setCellRenderer(new VersionCellRenderer()); tree.getColumnModel().getColumn(VERSION_COLUMN).setMinWidth(100); tree.getColumnModel().getColumn(VASSAL_COLUMN).setCellRenderer(new VersionCellRenderer()); tree.getColumnModel().getColumn(VASSAL_COLUMN).setMinWidth(100); tree.getColumnModel().getColumn(SPARE_COLUMN).setMinWidth(10); tree.getColumnModel().getColumn(SPARE_COLUMN).setPreferredWidth(600); // FIXME: How to set alignment of individual header components? tree.getTableHeader().setAlignmentX(JComponent.CENTER_ALIGNMENT); }