Table Of Contents
- How to I implement a cellupdate event when I and using the
DefaultGridModel?
- You can use the following code to listen the cell update event:
model.addDataGridModelListener(new DataGridModelListener() {
public void cellChanged(DataGridModelEvent e) {
if(e.getType() == DataGridModelEvent.CELL_VALUE) {
// do something
}
}
});
- I would like to make use of the below date picker in a cell,
but am receiving an error when I run the celleditordemo.
- The JCalendar component is part of JComponentPack product,
you can put the componentpack-all.jar on your classpath instead
of the datagrid-all.jar.
- I am looking to use the spreadsheet as a means of submitting data
through my website, can i do this with jdatagrid?
- The JDataGrid component can display and save the cell data directly,
you need not do anything else, just invoke the following methods after
the "Submit" action fired, the ModelIO class have the following methods:
// Read or write a TableModel
ModelIO.readTableModel(URL url, String formatName, Map map)
ModelIO.readTableModel(InputStream input, String formatName, Map map)
ModelIO.writeTableModel(TableModel model, String formatName, Map map, OutputStream output)
ModelIO.writeTableModel(TableModel model, String formatName, Map map, URL url)
// Read or write a WorkBook
ModelIO.readWorkBook(InputStream input, String formatName, Map map);
ModelIO.readWorkBook(URL url, String formatName, Map map)
ModelIO.writeWorkBook(WorkBook book, String formatName, Map map, OutputStream output)
ModelIO.riteWorkBook(WorkBook book, String formatName, Map map, URL url)
The cool thing is you can use the ModelIO for a plain Java Swing
JTable, it help you move the old code based JTable to the JDataGrid
smoothly and save your investment.
You can read the ModelIO API to learn more information:
http://www.zfqjava.com/docs/api/com/zfqjava/swing/ModelIO.html
- User copies several values (at once) from a local excel spreadsheet and pastes
them into the jdatagrid, is this feature supported?
- The JDataGrid component support the feature
copy and paste, you can copy and paste the data from Microsoft Excel,
drag cell data from Microsoft Excel, as you know, the copy and paste
feature in Java Applet Environment need AWT permission, so you need sign
the Jar archive when you deploy your application to your website.
- The splash screen keeps coming up when I use foxtrot to open a new process
to load the data into the bean... If I do not use foxtrot then the splash
screen does not come up. I have set the lisc as well. Please see
below....
- Well, the splash screen problem need some tricks,
we have provided an article for developer to handle
this problem:
http://www.zfqjava.com/article/how-to-disable-splash-screen.html
- how do I change the format of the cells that I am
specifying a date value in? Right now it shows long date, but I am
looking to show short date (ie. 11/04/08)
- There are several ways to setup the short date format:
1.Sets the short date format for all cells:
DateCellRenderer renderer =
(DateCellRenderer)dataGrid.getCellManager().getCellRenderer(Date.class);
renderer.setFormat(DateFormat.getDateInstance());
2.Sets the short date format for one column:
SimpleAttributeSet attr = new SimpleAttributeSet();
attr.setFormat(DateFormat.getDateInstance());
model.setColumnAttributes(attr, column);
3.Sets the short date format for one cell:
SimpleAttributeSet attr = new SimpleAttributeSet();
attr.setFormat(DateFormat.getDateInstance());
model.setCellAttributes(attr, row, column);
- How do I get the cell to just show the value "as is" as text?
- You should set the column class to String.class at first, then fill the data.
You can also disable the auto cell class convert property:
dataGrid.putClientProperty("JDataGrid.autoSetsCellValue", Boolean.FALSE);
dataGrid.putClientProperty("JDataGrid.autoSetsCellClass", Boolean.FALSE);
Or:
AbstractDataGridModel.setAutoSetsCellClass(false);
AbstractDataGridModel.setAutoSetsCellValue(false);
- Do you have any pdf or other detail documentation or information on
the jdatagrid enterprise edition ? anything outside of downloading the
product itself.
- The up to date JavaDoc and developer guide can download
from our website after place the order, at present, you
can read the following documation, though them are
not up to date version, the API is 100% compatible:
Learn product and read programmer guide:
JavaDoc: http://www.zfqjava.com/docs/api/overview-summary.html
Developer Article: http://www.zfqjava.com/article/index.html
Programmer Guide: http://www.zfqjava.com/docs/datagrid/index.html
Testimonial: http://www.zfqjava.com/testimonial.html
- how do we localize the menu labels ("File", "Edit", etc.)? We are about to release a French edition of our product.
- You can set the default locale to French, the
JDataGrid provide the French bundle, you need
not do it yourself.
- I need to put a large amount of data in workbook sheet (for example, 6 columns, 10000 rows), is there any function which can put all data at once
- The "DefaultDataGridModel" class provide the method "fillValue(Cell c, java.util.List[] l)", you can
fill the cell data by using a row List, it's fast than fill value to every cell in a loop.
See the JavaDoc: http://www.zfqjava.com/docs/api/com/zfqjava/swing/DefaultDataGridModel.html
- I use J.R.E (Java Runtime Environment) 1.5.0.7 but I want to know is there any J.R.E that Your JDataGrid don't supports?
- The JDataGrid product support the JRE 1.5 or later.
- I enjoy the software but there's one issue. Is there a way to open it with
50,000 or so rows and 250 or so columns? 99x99 isn't enough, nor is adding
columns one by one.
- You can override the method "createModel()" in
JDataGridBean, then create the rows and colums
by yourself, for example:
protected DataGridModel createModel() {
DataGridModel model = new DefaultDataGridModel(50000, 250);
// LargeDataGridModel model = new LargeDataGridModel(50000, 250);
return model;
}
You can view the souce code of JDataGridBean for details.
You can also use the "LargeDataGridModel", this model
can provide the smallest memory footprint for large
rows and columns.
If you use the DefaultDataGridModel, don't forget add
some JVM args, such as -Xmx128m etc.
- I did not see this method in the API documentation on the web
site. Do I get full API documentation with a purchase?
- You will get the full JavaDoc API documentation
and the programmer guide with a purchase, the
source code version include all source code of
the product.
- We would like to be able to create our own formula types completely
dependant on the logical objects we have in a database, eg.
- You can add customized function to the FormulaFactory by using the following method:
FormulaFactory.getDefault().addFunction(Function function);
- Is it possible to cancel the undo of last action done, I mean to make the last action "undoable" (or un-die())?
Is it possible to know the last action undone, I mean when I undo an action it's possible to know what action are going to be undone?
- You can use the UndoManager to manage the undo edit, the JDataGridBean provide a UndoManager.
- I cannot create a full spreadsheet with toolbar etc. How do I do this? All I get is a simple
grid like in JTable?
- You can add the JDataGridBean into your panel, the JDataGrid component is a component like JTable, the JDataGridBean component is a full spreadsheet with toolbar and menubar.
- how can I add a comment to a cell through the code without any interaction of the user.
- You can add a comment as a CellStyle attribute, you can see JavaDoc com.zfqjava.swing.cell.CellStyle in details.
- How to use the license code?
-
You can input it on the "About" dialog.
You can also use the following code to register the license code in
your programming code:
// the code means the above license data
LicenseManager.getInstance().addLicenseData(code);
- How to switch off cell selection border?
-
Use the following method in JDataGrid:
dataGrid.setSelectionBorderPainted(false);
- How to enable the column sorting in JDataGrid?
-
You should enable the following client property in JDataGrid:
dataGrid.setModel(new DefaultColumnSorter(createModel()));
dataGrid.putClientProperty("JDataGrid.columnSortingEnabled", Boolean.TRUE);
dataGrid.putClientProperty("JDataGrid.switchUnsortedOrderEnabled", Boolean.TRUE);
And you should use the default JTableHeader build-in JDataGrid.
- Whey the there is nothing (button or icon) which is displayed in the JTableHeader
to allow sorting action?
-
You should use the default JTableHeader build-in JDataGrid,
Because the default JTableHeader cannot provide the support for column sorting,
it have not this feature, such as show a arrow icon, or act as a button pushing.
- How to enable the color effect for print preview?
-
JPrintPreview provides the following methods to enable color print preview:
JPrintPreview.setColorType(JPrintPreview.COLOR);
- Why encounter an error when add "TableColumn" in JDataGrid?
-
Please use DefaultDataGridModel.addColumn(null) to add new column in JDataGrid.
- How to set a Renderer for AComboBox that aligns the text on the left?
-
You can use the "ObjectCellRenderer" in com.zfqjava.swing.cell directly, it has method
"setDefaultHorizontalAlignment" and "setDefaultVerticalAlignment".
- How do I set the format of the renderer to format the date in short form:
MM/DD/YYYY?
-
You can create "DateCellRenderer" instance, it's ObjectCellRenderer subclass,
and pass a new SimpleDateFormat("MM/dd/yyyy");
- How to set a columnHeader for each column and to allow column resizing automatically?
-
A: The method "JDataGrid.sizeColumnWidthToFit" can size the column to fit it's contents.
- The formula cannot work with OpenOffice, how to modified the code?
-
We have add new API in FormulaFactory, you can switch from Excel formula syntax to OpenOffice formula syntax easily, you can try the following API:
FormulaFactory.setArgumentSeparatorChar(';');
- How to write a grid that is sortable and has even rows one color and odd rows another color?
-
The JDataGrid has provide this feature since version 1.8,
you can invoke the following code:
dataGrid.setAlternatingRowBackground(Color.gray);
dataGrid.setAlternatingRowForeground(Color.white);
- Is there any way to add in a checkbox component/renderer for a table column header?
-
The following code enable the checkbox in JDataGrid table header:
JDataGrid dataGrid = getDataGrid();
BooleanCellRenderer renderer = new BooleanCellRenderer();
renderer.setComponentType(BooleanCellRenderer.CHECK_BOX);
// gloablly enable the check box renderer
// dataGrid.getTableHeader().setDefaultRenderer(renderer);
dataGrid.getColumnModel().getColumn(0).setHeaderRenderer(renderer);
- Is it possible to prevent a single column from being moved? I have a list of columns that the user can move, but I want the first column to stay the first column (not freezing a column or window)?
-
This function can be implemented by write a customize TableColumnModel,
override the method:
TableColumn firstColumn = new TableColumn(0);
// override the method in TableColumnModel
public TableColumn getColumn(int columnIndex) {
if(columnIndex == 0) {
return firstColumn;
} else {
return super.getColumn(columnIndex);
}
}
- How to enable the JDataGrid convert the number cell to normal cell when the
value is illegal number?
-
Use the following code:
dataGrid.setEditingStopBehavior(JDataGrid.COMMIT_OR_EDITING);
- How to set a row height when export to xls file from DataGridModel?
-
Use the following code to set a row height to worksheet:
WorkSheet[] sheets = new WorkSheet[1];
sheets[0] = new WorkSheet("sheet0", tableModel);
// add the following code:
SizeModel rowSizeModel = new DefaultSizeModel("row model",
tableModel.getRowCount(), 16);
rowSizeModel.setSize(0, 30);
sheets[0].setRowSizeModel(rowSizeModel);
WorkBook book = new WorkBook(sheets);
ModelIO.writeWorkBook(book, "xls", null, f);
- We have a problem with PrintPreview: you can see my source code (I used
some function you put in the demo) and the exception in the files I have
attached.
- I think this is
not a bug, if you use the JPrintPreview in your project alone,
please ensure the following class included in your classpath:
JPrintPreview
PrintPreviewUI
BasicPrintPreviewUI
XBasicLookAndFeel
ModelFactory
ShadowBorder
icon and resources directory in the com/zfqjava/swing/plaf/basic directory
You also can put the datagrid.jar in the classpath, this is the
easy way to use all component in the datagrid.jar package.
- merge of row/column
- As you know, the JDataGrid support merge and split cell, includes row and column.
- Change the column name (A,B..) (I tried
"datagridmodel.setColumnName("MyString", column-index); ") but the column
name doesn't change
- I believe this is a bug, JDataGrid 1.1 have fixed this problem.
- Is it possible to hide the row-counter-column (I mean the column:
1,2,3.........) and how?
- Yes, you are right, you can hide the row header, this is code:
Component header = scrollPane.getRowHeader();
if(header != null) {
header.setVisible(false);
}
And JDataGrid 1.1 will support this feature directly.
- Can I (how??) change the font / alignement for a string/cell?
- You can change the single line string cell, but the multiple line string cell
based the JTextArea component, you can change the font for multiple
line string cell, but cannot change it's alignment.
- Can you tell me how can I set the default size for a column?
- You can set the column size use the following code:
int viewIndex = 1; // column index
int value = 100; // column width
TableColumnModel m = table.getColumnModel();
m.getColumn(viewIndex).setPreferredWidth(value);
Please see the TableColumn API: setPreferredWidth for details.
- In your web-site I have read: "1 Source Code License" at $1797. What does it
mean? You send us the source code of the library?
Can we use the library for all application we will develop? (with 1 license?).
- The 1 Source Code License includes
all component source code and binary library, you can use it,
modify it for the application that developed in your company,
but cannot resell to other company.
- Row insert before index :
The content of the cell clicked gets copied into the newly created row.
- This is a selection bug, I have rewrite the selection code in JDataGrid 1.1.
- Delete Row/Column :
A user has to keep select the cell to delete continuously
- After rewrite and review the selection code,
this problem have been solved in JDataGrid 1.1.
- After insert/delete column, the cell sizes of the table gets reset.
It should have kept the same size.
- Yes, you are right, this behavior is correct in JDK 1.3, but after JDK 1.4,
not only the JTable clear all line height, but also clear all selection
after insert and delete column.This problem have solved in JDataGrid 1.1.
- Cell Editing behavior change
- Single Click on the cell: just focus the cell
- Double Click on the cell: editing mode
- JTable.putClientProperty("JTable.autoStartsEdit", Boolean.FALSE);
- putClientProperty API does not work in JDataGrid model. It somehow
reset this property setting. I tried with standard Swing sample program
and it works fine there.
- This problem have solved in JDataGrid 1.1.
- Color/Font Style changes:
It only change the Style of the first cell selected not all selected cells.
- You can disable the action "change the attributes" when select multiple cells.
- Implementing CRTL-Mouse CLICK to select the multiple cells
I would like to have it same behavior as Excel. It does not somehow
select individual cells one by one. The standard Swing application have
the same problem
- JDataGrid 1.2 have correct behavior.
- Disable Row Header resizing.
- This problem has been solved JDataGrid 1.1. Please see
JLineBar#setResizingAllowed(boolean) for details.
- Make Row/Column header clickable for insert/delete operation.
- The JDataGrid 1.1 have implements the row and column selection when perform insert and delete,
but the header clickable need different border, and the different Look And Feel
have different Border, and I have implements some border, and find it is too
hard to implemnts the border in the different Look And Feel, because no
common API for this border, and I plan to implements a unique border and
use it in the different Look And Feel.
- This is the ability to have a certain number of rows and columns locked
when scrolling (exactly like a
spreadsheet), if possible on all sides (i. e. top column headers anr buttom
totals, left headers and
right totals), but if ot possible at least on top and left (headers).
- It seems that the features should be implemented through
column group and row group, and current the JDataGrid component
have not provide this feature, add I have use the cell merge
to try, but It's not very suitable for you requirements. And may be
add this feature in the future.
- How do we change individual cell's Background/Foreground Color and Font styles?
We were not able to find APIs in your JavaDoc for this functionality.
- As you know, change cell attributes includes font,
color, etc. is not very visible. All attributes
center on the setCellAttributes method on the
DataGridModel.
That's mean create a SimpleAttributeSet, then add
some attribute on it, then put it into DataGridModel
use the setCellAttributes methods.
We will add some code to demonstrate the method at
JDataGrid 1.1.
- Is it possible to have an option to enable/disable resizing the "Row
Header"? (enable/disable mouse drag to resize the row header)
- Please see
JLineBar#setResizingAllowed(boolean) for details.
- We would like to create our own DataModel to use our Data Structure to
store cell information. (eg. ArrayList[] myCells )
You have DefaultDataGridModel that extends AbstractDataGridModel that
you have defined the internal data structure for the Cells.
Is it possible to create our own MyDataGridModel that extends
AbstractDataGridModel?
- You can create own DataGridModel by extending the
AbstractDataGridModelor extending the DefaultDataGridModel.
But if you subclass the AbstractDataGridModel, the
Undo and Redo and the cell merge and split should do
on subclass by yourself.
And I will add the bulk operations such as fill, clear,
move and sort at JDataGrid 1.1, the bulk operations will
avoid the unuseful firing events and can also support undo
and redo.
- Just a single click on the cell gets into Cell Editing mode now.
Is it possbile to make it behave like Excel? :
a. Single Click on the cell: just focus the cell
b. Double Click on the cell: editing mode
- You can do that use the following code:
dataGrid.putClientProperty("JDataGrid.clickCountToStartsEdit", new Integer(2));
- We have to keep select(click) the cells to deleting the row/colum continously.
Is this can be fixed?
- This have been fixed in JDataGrid 1.1.
- Is it possible to add(or override) more functionality in your CellRenderer/
CellEditor?
If so, where and how can we do this?
- The ObjectCellRenderer and ObjectCellEditor is ready to use and overide, and
support attributes when you creating subclass.
|
- How to I implement a cellupdate event when I and using the
DefaultGridModel?
- You can use the following code to listen the cell update event:
model.addDataGridModelListener(new DataGridModelListener() {
public void cellChanged(DataGridModelEvent e) {
if(e.getType() == DataGridModelEvent.CELL_VALUE) {
// do something
}
}
});
- I would like to make use of the below date picker in a cell,
but am receiving an error when I run the celleditordemo.
- The JCalendar component is part of JComponentPack product,
you can put the componentpack-all.jar on your classpath instead
of the datagrid-all.jar.
- I am looking to use the spreadsheet as a means of submitting data
through my website, can i do this with jdatagrid?
- The JDataGrid component can display and save the cell data directly,
you need not do anything else, just invoke the following methods after
the "Submit" action fired, the ModelIO class have the following methods:
// Read or write a TableModel
ModelIO.readTableModel(URL url, String formatName, Map map)
ModelIO.readTableModel(InputStream input, String formatName, Map map)
ModelIO.writeTableModel(TableModel model, String formatName, Map map, OutputStream output)
ModelIO.writeTableModel(TableModel model, String formatName, Map map, URL url)
// Read or write a WorkBook
ModelIO.readWorkBook(InputStream input, String formatName, Map map);
ModelIO.readWorkBook(URL url, String formatName, Map map)
ModelIO.writeWorkBook(WorkBook book, String formatName, Map map, OutputStream output)
ModelIO.riteWorkBook(WorkBook book, String formatName, Map map, URL url)
The cool thing is you can use the ModelIO for a plain Java Swing
JTable, it help you move the old code based JTable to the JDataGrid
smoothly and save your investment.
You can read the ModelIO API to learn more information:
http://www.zfqjava.com/docs/api/com/zfqjava/swing/ModelIO.html
- User copies several values (at once) from a local excel spreadsheet and pastes
them into the jdatagrid, is this feature supported?
- The JDataGrid component support the feature
copy and paste, you can copy and paste the data from Microsoft Excel,
drag cell data from Microsoft Excel, as you know, the copy and paste
feature in Java Applet Environment need AWT permission, so you need sign
the Jar archive when you deploy your application to your website.
- The splash screen keeps coming up when I use foxtrot to open a new process
to load the data into the bean... If I do not use foxtrot then the splash
screen does not come up. I have set the lisc as well. Please see
below....
- Well, the splash screen problem need some tricks,
we have provided an article for developer to handle
this problem:
http://www.zfqjava.com/article/how-to-disable-splash-screen.html
- how do I change the format of the cells that I am
specifying a date value in? Right now it shows long date, but I am
looking to show short date (ie. 11/04/08)
- There are several ways to setup the short date format:
1.Sets the short date format for all cells:
DateCellRenderer renderer =
(DateCellRenderer)dataGrid.getCellManager().getCellRenderer(Date.class);
renderer.setFormat(DateFormat.getDateInstance());
2.Sets the short date format for one column:
SimpleAttributeSet attr = new SimpleAttributeSet();
attr.setFormat(DateFormat.getDateInstance());
model.setColumnAttributes(attr, column);
3.Sets the short date format for one cell:
SimpleAttributeSet attr = new SimpleAttributeSet();
attr.setFormat(DateFormat.getDateInstance());
model.setCellAttributes(attr, row, column);
- How do I get the cell to just show the value "as is" as text?
- You should set the column class to String.class at first, then fill the data.
You can also disable the auto cell class convert property:
dataGrid.putClientProperty("JDataGrid.autoSetsCellValue", Boolean.FALSE);
dataGrid.putClientProperty("JDataGrid.autoSetsCellClass", Boolean.FALSE);
Or:
AbstractDataGridModel.setAutoSetsCellClass(false);
AbstractDataGridModel.setAutoSetsCellValue(false);
- Do you have any pdf or other detail documentation or information on
the jdatagrid enterprise edition ? anything outside of downloading the
product itself.
- The up to date JavaDoc and developer guide can download
from our website after place the order, at present, you
can read the following documation, though them are
not up to date version, the API is 100% compatible:
Learn product and read programmer guide:
JavaDoc: http://www.zfqjava.com/docs/api/overview-summary.html
Developer Article: http://www.zfqjava.com/article/index.html
Programmer Guide: http://www.zfqjava.com/docs/componentpack/index.html
Testimonial: http://www.zfqjava.com/testimonial.html
- how do we localize the menu labels ("File", "Edit", etc.)? We are about to release a French edition of our product.
- You can set the default locale to French, the
JDataGrid provide the French bundle, you need
not do it yourself.
- I need to put a large amount of data in workbook sheet (for example, 6 columns, 10000 rows), is there any function which can put all data at once
- The "DefaultDataGridModel" class provide the method "fillValue(Cell c, java.util.List[] l)", you can
fill the cell data by using a row List, it's fast than fill value to every cell in a loop.
See the JavaDoc: http://www.zfqjava.com/docs/api/com/zfqjava/swing/DefaultDataGridModel.html
- I use J.R.E (Java Runtime Environment) 1.5.0.7 but I want to know is there any J.R.E that Your JDataGrid don't supports?
- The JDataGrid product support the JRE 1.5 or later.
- I enjoy the software but there's one issue. Is there a way to open it with
50,000 or so rows and 250 or so columns? 99x99 isn't enough, nor is adding
columns one by one.
- You can override the method "createModel()" in
JDataGridBean, then create the rows and colums
by yourself, for example:
protected DataGridModel createModel() {
DataGridModel model = new DefaultDataGridModel(50000, 250);
// LargeDataGridModel model = new LargeDataGridModel(50000, 250);
return model;
}
You can view the souce code of JDataGridBean for details.
You can also use the "LargeDataGridModel", this model
can provide the smallest memory footprint for large
rows and columns.
If you use the DefaultDataGridModel, don't forget add
some JVM args, such as -Xmx128m etc.
- I did not see this method in the API documentation on the web
site. Do I get full API documentation with a purchase?
- You will get the full JavaDoc API documentation
and the programmer guide with a purchase, the
source code version include all source code of
the product.
- We would like to be able to create our own formula types completely
dependant on the logical objects we have in a database, eg.
- You can add customized function to the FormulaFactory by using the following method:
FormulaFactory.getDefault().addFunction(Function function);
- Is it possible to cancel the undo of last action done, I mean to make the last action "undoable" (or un-die())?
Is it possible to know the last action undone, I mean when I undo an action it's possible to know what action are going to be undone?
- You can use the UndoManager to manage the undo edit, the JDataGridBean provide a UndoManager.
- I cannot create a full spreadsheet with toolbar etc. How do I do this? All I get is a simple
grid like in JTable?
- You can add the JDataGridBean into your panel, the JDataGrid component is a component like JTable, the JDataGridBean component is a full spreadsheet with toolbar and menubar.
- how can I add a comment to a cell through the code without any interaction of the user.
- You can add a comment as a CellStyle attribute, you can see JavaDoc com.zfqjava.swing.cell.CellStyle in details.
- How to use the license code?
-
You can input it on the "About" dialog.
You can also use the following code to register the license code in
your programming code:
// the code means the above license data
LicenseManager.getInstance().addLicenseData(code);
- How to switch off cell selection border?
-
Use the following method in JDataGrid:
dataGrid.setSelectionBorderPainted(false);
- How to enable the column sorting in JDataGrid?
-
You should enable the following client property in JDataGrid:
dataGrid.setModel(new DefaultColumnSorter(createModel()));
dataGrid.putClientProperty("JDataGrid.columnSortingEnabled", Boolean.TRUE);
dataGrid.putClientProperty("JDataGrid.switchUnsortedOrderEnabled", Boolean.TRUE);
And you should use the default JTableHeader build-in JDataGrid.
- Whey the there is nothing (button or icon) which is displayed in the JTableHeader
to allow sorting action?
-
You should use the default JTableHeader build-in JDataGrid,
Because the default JTableHeader cannot provide the support for column sorting,
it have not this feature, such as show a arrow icon, or act as a button pushing.
- How to enable the color effect for print preview?
-
JPrintPreview provides the following methods to enable color print preview:
JPrintPreview.setColorType(JPrintPreview.COLOR);
- Why encounter an error when add "TableColumn" in JDataGrid?
-
Please use DefaultDataGridModel.addColumn(null) to add new column in JDataGrid.
- How to set a Renderer for AComboBox that aligns the text on the left?
-
You can use the "ObjectCellRenderer" in com.zfqjava.swing.cell directly, it has method
"setDefaultHorizontalAlignment" and "setDefaultVerticalAlignment".
- How do I set the format of the renderer to format the date in short form:
MM/DD/YYYY?
-
You can create "DateCellRenderer" instance, it's ObjectCellRenderer subclass,
and pass a new SimpleDateFormat("MM/dd/yyyy");
- How to set a columnHeader for each column and to allow column resizing automatically?
-
A: The method "JDataGrid.sizeColumnWidthToFit" can size the column to fit it's contents.
- The formula cannot work with OpenOffice, how to modified the code?
-
We have add new API in FormulaFactory, you can switch from Excel formula syntax to OpenOffice formula syntax easily, you can try the following API:
FormulaFactory.setArgumentSeparatorChar(';');
- How to write a grid that is sortable and has even rows one color and odd rows another color?
-
The JDataGrid has provide this feature since version 1.8,
you can invoke the following code:
dataGrid.setAlternatingRowBackground(Color.gray);
dataGrid.setAlternatingRowForeground(Color.white);
- Is there any way to add in a checkbox component/renderer for a table column header?
-
The following code enable the checkbox in JDataGrid table header:
JDataGrid dataGrid = getDataGrid();
BooleanCellRenderer renderer = new BooleanCellRenderer();
renderer.setComponentType(BooleanCellRenderer.CHECK_BOX);
// gloablly enable the check box renderer
// dataGrid.getTableHeader().setDefaultRenderer(renderer);
dataGrid.getColumnModel().getColumn(0).setHeaderRenderer(renderer);
- Is it possible to prevent a single column from being moved? I have a list of columns that the user can move, but I want the first column to stay the first column (not freezing a column or window)?
-
This function can be implemented by write a customize TableColumnModel,
override the method:
TableColumn firstColumn = new TableColumn(0);
// override the method in TableColumnModel
public TableColumn getColumn(int columnIndex) {
if(columnIndex == 0) {
return firstColumn;
} else {
return super.getColumn(columnIndex);
}
}
- How to enable the JDataGrid convert the number cell to normal cell when the
value is illegal number?
-
Use the following code:
dataGrid.setEditingStopBehavior(JDataGrid.COMMIT_OR_EDITING);
- How to set a row height when export to xls file from DataGridModel?
-
Use the following code to set a row height to worksheet:
WorkSheet[] sheets = new WorkSheet[1];
sheets[0] = new WorkSheet("sheet0", tableModel);
// add the following code:
SizeModel rowSizeModel = new DefaultSizeModel("row model",
tableModel.getRowCount(), 16);
rowSizeModel.setSize(0, 30);
sheets[0].setRowSizeModel(rowSizeModel);
WorkBook book = new WorkBook(sheets);
ModelIO.writeWorkBook(book, "xls", null, f);
- We have a problem with PrintPreview: you can see my source code (I used
some function you put in the demo) and the exception in the files I have
attached.
- I think this is
not a bug, if you use the JPrintPreview in your project alone,
please ensure the following class included in your classpath:
JPrintPreview
PrintPreviewUI
BasicPrintPreviewUI
XBasicLookAndFeel
ModelFactory
ShadowBorder
icon and resources directory in the com/zfqjava/swing/plaf/basic directory
You also can put the datagrid.jar in the classpath, this is the
easy way to use all component in the datagrid.jar package.
- merge of row/column
- As you know, the JDataGrid support merge and split cell, includes row and column.
- Change the column name (A,B..) (I tried
"datagridmodel.setColumnName("MyString", column-index); ") but the column
name doesn't change
- I believe this is a bug, JDataGrid 1.1 have fixed this problem.
- Is it possible to hide the row-counter-column (I mean the column:
1,2,3.........) and how?
- Yes, you are right, you can hide the row header, this is code:
Component header = scrollPane.getRowHeader();
if(header != null) {
header.setVisible(false);
}
And JDataGrid 1.1 will support this feature directly.
- Can I (how??) change the font / alignement for a string/cell?
- You can change the single line string cell, but the multiple line string cell
based the JTextArea component, you can change the font for multiple
line string cell, but cannot change it's alignment.
- Can you tell me how can I set the default size for a column?
- You can set the column size use the following code:
int viewIndex = 1; // column index
int value = 100; // column width
TableColumnModel m = table.getColumnModel();
m.getColumn(viewIndex).setPreferredWidth(value);
Please see the TableColumn API: setPreferredWidth for details.
- In your web-site I have read: "1 Source Code License" at $1797. What does it
mean? You send us the source code of the library?
Can we use the library for all application we will develop? (with 1 license?).
- The 1 Source Code License includes
all component source code and binary library, you can use it,
modify it for the application that developed in your company,
but cannot resell to other company.
- Row insert before index :
The content of the cell clicked gets copied into the newly created row.
- This is a selection bug, I have rewrite the selection code in JDataGrid 1.1.
- Delete Row/Column :
A user has to keep select the cell to delete continuously
- After rewrite and review the selection code,
this problem have been solved in JDataGrid 1.1.
- After insert/delete column, the cell sizes of the table gets reset.
It should have kept the same size.
- Yes, you are right, this behavior is correct in JDK 1.3, but after JDK 1.4,
not only the JTable clear all line height, but also clear all selection
after insert and delete column.This problem have solved in JDataGrid 1.1.
- Cell Editing behavior change
- Single Click on the cell: just focus the cell
- Double Click on the cell: editing mode
- JTable.putClientProperty("JTable.autoStartsEdit", Boolean.FALSE);
- putClientProperty API does not work in JDataGrid model. It somehow
reset this property setting. I tried with standard Swing sample program
and it works fine there.
- This problem have solved in JDataGrid 1.1.
- Color/Font Style changes:
It only change the Style of the first cell selected not all selected cells.
- You can disable the action "change the attributes" when select multiple cells.
- Implementing CRTL-Mouse CLICK to select the multiple cells
I would like to have it same behavior as Excel. It does not somehow
select individual cells one by one. The standard Swing application have
the same problem
- JDataGrid 1.2 have correct behavior.
- Disable Row Header resizing.
- This problem has been solved JDataGrid 1.1. Please see
JLineBar#setResizingAllowed(boolean) for details.
- Make Row/Column header clickable for insert/delete operation.
- The JDataGrid 1.1 have implements the row and column selection when perform insert and delete,
but the header clickable need different border, and the different Look And Feel
have different Border, and I have implements some border, and find it is too
hard to implemnts the border in the different Look And Feel, because no
common API for this border, and I plan to implements a unique border and
use it in the different Look And Feel.
- This is the ability to have a certain number of rows and columns locked
when scrolling (exactly like a
spreadsheet), if possible on all sides (i. e. top column headers anr buttom
totals, left headers and
right totals), but if ot possible at least on top and left (headers).
- It seems that the features should be implemented through
column group and row group, and current the JDataGrid component
have not provide this feature, add I have use the cell merge
to try, but It's not very suitable for you requirements. And may be
add this feature in the future.
- How do we change individual cell's Background/Foreground Color and Font styles?
We were not able to find APIs in your JavaDoc for this functionality.
- As you know, change cell attributes includes font,
color, etc. is not very visible. All attributes
center on the setCellAttributes method on the
DataGridModel.
That's mean create a SimpleAttributeSet, then add
some attribute on it, then put it into DataGridModel
use the setCellAttributes methods.
We will add some code to demonstrate the method at
JDataGrid 1.1.
- Is it possible to have an option to enable/disable resizing the "Row
Header"? (enable/disable mouse drag to resize the row header)
- Please see
JLineBar#setResizingAllowed(boolean) for details.
- We would like to create our own DataModel to use our Data Structure to
store cell information. (eg. ArrayList[] myCells )
You have DefaultDataGridModel that extends AbstractDataGridModel that
you have defined the internal data structure for the Cells.
Is it possible to create our own MyDataGridModel that extends
AbstractDataGridModel?
- You can create own DataGridModel by extending the
AbstractDataGridModelor extending the DefaultDataGridModel.
But if you subclass the AbstractDataGridModel, the
Undo and Redo and the cell merge and split should do
on subclass by yourself.
And I will add the bulk operations such as fill, clear,
move and sort at JDataGrid 1.1, the bulk operations will
avoid the unuseful firing events and can also support undo
and redo.
- Just a single click on the cell gets into Cell Editing mode now.
Is it possbile to make it behave like Excel? :
a. Single Click on the cell: just focus the cell
b. Double Click on the cell: editing mode
- You can do that use the following code:
dataGrid.putClientProperty("JDataGrid.clickCountToStartsEdit", new Integer(2));
- We have to keep select(click) the cells to deleting the row/colum continously.
Is this can be fixed?
- This have been fixed in JDataGrid 1.1.
- Is it possible to add(or override) more functionality in your CellRenderer/
CellEditor?
If so, where and how can we do this?
- The ObjectCellRenderer and ObjectCellEditor is ready to use and overide, and
support attributes when you creating subclass.
|