Tag Archives: java excel

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.

 

 

How to disable JDataGridBean splash screen?

Before initialize the JDataGridBean component, set the following system property at first:

System.setProperty(“application.hideSplash”, “true”);

JDataGrid is a Java Excel swing component in JComponentPack product suite, it’s a flexible Java spreadsheet, it’s widely used in banking, securities, taxation, e-government system.

JDataGridBean is a component based on JDataGrid and provide menu bar, tool bar, status bar, etc.

JDataGrid and JDataGridBean could both used in your swing application.

How to use DataGridModelAdapter?

DataGridModelAdapter is a adapter,could convert any TableModel to DataGridModel, and used in JDataGrid,JDataGrid could use the TableModel directly,but if use the DataGridModelAdapter wrap your TableModel,your TableModel could set cell style, merge and split cell, your TableModel need not any changes.

Code Sample:

JDataGrid is a Java Excel swing component in JComponentPack product suite, it’s a flexible Java spreadsheet, it’s widely used in banking, securities, taxation, e-government system.