Monthly Archives: July 2013

Recent FAQ for Java Spreadsheet

JDataGrid is a pure Java Spreadsheet component, it has many features, it looks like Excel, the following is the questions that the developers often ask, it will help you understand and use the JDataGrid quickly.

Q:How to enable multiple in cell?
A:Sets the cell to String.class:
dataGridModel.setCellClass(String.class, 3, 5); then enable multiple line:
((StringCellEditor)dataGrid.getCellManager().getCellEditor(String.class)).setMultiLine(true);
((StringCellRenderer)dataGrid.getCellManager().getCellRenderer(String.class)).setMultiLine(true);

Q:How to click once, then enter edit mode?
A:dataGrid.putClientProperty(“JDataGrid.clickCountToStartsEdit”, 1);

Q:How to set the JDataGrid window size?
A:

bean.getFrame(true).setPreferredSize(new Dimension(480,320));

bean.setExtendedState(Frame.NORMAL);

Q:How to disable the save/cancel dialog after close the JDataGrid window?
A:Override the JDataGridBean.doClose method,add your logic, then getFrame().dispose() method.

Q:How to set the freeze window on code?
A:JDataGrid.setFreezeCell

Q:How to get the menu on the top?
A:

JMenu menuwindow =(JMenu) menubar.getMenu(6);

dataGridBean.getUIFactory().loadMenu(menuwindow);

Q:How to add license data?
A: LicenseManager.getInstance().addLicenseData(registercode);

Q:How to get selected cells of JDataGrid?
A:Cell[]  cells = getDataGrid().getSelectedCells();
Cell   c =  getDataGrid().getSelectedCell();

Q:How to hide the default menu bar of JDataGrid?
A:JMenuBar menubar = dataGrid.getMenuBar(JDataGridBean.MAIN_MENUBAR);
menubar.setVisible(false);

Q:Have the JDataGrid auto increment the row or column count when click the scrollbar?

A:Set the following property to enable this feature:
JDataGridBean.setAutoAdjustRowColumCount(true);

Q:Is the maximum row and column count of JDataGrid?
A:In theory, the JDataGrid support maximum 2^32 row or column count, on the bank or securities project, they always use the LargeDataGridModel, it have better performance for large data.