F****n 发帖数: 3271 | 1 Java Tip 77: Enable copy and paste functionality between
Swing's JTables and Excel
This adapter makes it easy to transfer data from one type of
spreadsheet to the other
Summary
JTables and Excel charts are commonly used to display data
in a grid or table. Often, the data that the user wishes to
enter into a JTable already exists in Excel spreadsheets.
The Excel format is used for export-import functionality by
software other than Excel. Because of this, it is important
that Java software also pr |
|
b****l 发帖数: 132 | 2 我的JTable的column 不变,row and data change dynamically, 那么我该如何update
JTable content automatically?有例子吗?万分感谢! |
|
s***y 发帖数: 4 | 3 Hi! I am using Comparator to do column sorting for a JTable. It works
good with appletviewer. When I am using IE, it complains :
java.lang.IncompatibleClassChangeError
below is my code for Comparator interface:
I guess it is some thing wrong with Collection.sort()
//*****************************************************************
class ColComparator implements Comparator {
protected int m_sortCol;
protected boolean m_sortAsc;
public ColC |
|
e**n 发帖数: 10 | 4 When I have few rows in a JTable, the background color of those rows is white,
but the rest area is gray. How can I change gray area to be white?
setBackground does not work.
Thanks |
|
l********0 发帖数: 283 | 5 JTable的功能确实很多没有现成的方法
但是也是为了性能问题
你可以创建自己的renderer,或者覆盖某些方法来实现 |
|
c*k 发帖数: 108 | 6 怎么用jtable来显示很大的数据库?比如说有几个million的records.
是不是用paging 或 Cachedrowset?
那位有用paging的例子? |
|
c*y 发帖数: 137 | 7 I am tring JTable, but can I dynamically change the number of rows in JTable?
I am reading its documentation but seems there is no function to add a row to
an existing table...Because everytime you retrieve a message, it needs to be
added to the table.
Do you know how? Thanks. |
|
|
n*****k 发帖数: 123 | 9
Better create a TableModel extends AbstractTableModel, then you can deal with
the data in the way you want it to be. |
|
z****g 发帖数: 2497 | 10 Simply use DefaultTableModel in your case. |
|
h*k 发帖数: 127 | 11 firetablemodelupdate evt or something |
|
F****n 发帖数: 3271 | 12 You should setOpaque(true)
white, |
|
|
g*s 发帖数: 2277 | 14 sure you can. a couple of years ago I worked on a small project to monitor
threads by using JTable. now totally forget swing le.
I guess you need to change TableModel, then updateUI. |
|
l***r 发帖数: 459 | 15 I have a button and a JTable. I want to set button to enable if user type or
change content one row in table. Which listenser should I use? I implement
KeyTyped in table but it doesn't work.
Thanks! |
|
|
f****y 发帖数: 70 | 17 继承default render和default editor,已经解决 |
|
|
w*r 发帖数: 2421 | 19 说起这个我上次写一个graphic package的时候有一个问题,我把一个barchart和一个
jtable放到一个jpanel里面,大小都试好了,然后直接print出去到JPG,发现总是不行
,出来的jpeg总是一个 blank picture,大小也不对,后来急急忙忙看了看书,说
Jpanel要在jframe.pack()之后才会真正得paint,于是就调jframe.pack(),这一pack就
出问题了,由于写的这个package要被servlet调,JVM存在的server是以windows
service方式运行的,而server的deffault resolution设的是800*600,图像是1024*768
的,一pack就把所有的东西都给挤乱了,折腾了N天也没有想到好的解决方式,也没时
间搞清楚有没有不用pack的方式,最后把server的显卡disable,换了一可以上高分辨率
的显示卡了事,到今日也没想明白哪里出问题了,哪位给说说? |
|
w*r 发帖数: 2421 | 20 说起这个我上次写一个graphic package的时候有一个问题,我把一个barchart和一个
jtable放到一个jpanel里面,大小都试好了,然后直接print出去到JPG,发现总是不行
,出来的jpeg总是一个 blank picture,大小也不对,后来急急忙忙看了看书,说
Jpanel要在jframe.pack()之后才会真正得paint,于是就调jframe.pack(),这一pack就
出问题了,由于写的这个package要被servlet调,JVM存在的server是以windows
service方式运行的,而server的deffault resolution设的是800*600,图像是1024*768
的,一pack就把所有的东西都给挤乱了,折腾了N天也没有想到好的解决方式,也没时
间搞清楚有没有不用pack的方式,最后把server的显卡disable,换了一可以上高分辨率
的显示卡了事,到今日也没想明白哪里出问题了,哪位给说说? |
|
|
j****a 发帖数: 5 | 22 Our company has a Forte(4GL) application. It's a huge application. A
consulting company said they could convert the application to Java/J2EE/
Spring. We give them a small piece of code for proof of concept. They did
convert it to Java. It runs fine. I checked the conversion source code. We
have a lot of grid in our application. It thought they will convert the
grids into Java JTables. However, instead they converted every single cell
into a JTextField objects. The code was super long and as my u |
|
m******t 发帖数: 2416 | 23 I would use a JTable with in-place editing instead of JTextFields. |
|
j******o 发帖数: 82 | 24 This is so damn true. Probably most java apps are web
j2ee based. Desktop client is still dominated by native
code. Even fewer people write Java2D, which to me is
the single best thing that I've not seen in other GUI
framework/toolkit.
There are a lot of good things in Swing, but things like
JTable are not well designed. Simplicity is simply not there. |
|
c*****t 发帖数: 1879 | 25 What do you mean by simplicity? JTable is pretty well designed
and is quite powerful and easy to use. |
|
d*****l 发帖数: 8441 | 26 谁有更好的table类?最好能有setCellColor(int row, int column, Color color);
的方法,可以直接拿来用。 |
|
d*****l 发帖数: 8441 | 27 创建自己的renderer或覆盖TabelCellRenderer也有缺点,只能实现
有限种类的背景色,一旦决定背景色的内部逻辑复杂了,该覆盖的函数就
会变得极其复杂。而且往往希望由别的类对象来决定或实现背景色决定逻辑
比较好。 |
|
c*****t 发帖数: 1879 | 28 楼主需要的没那么复杂。其实就是给 cell renderer implementation 里 pass
一个 shared cell color map 。然后 render 前查一下是否某个 cell 需要被
highlight 就是了。 |
|
F****n 发帖数: 3271 | 29 If you want to build complex visualization, you should not use Swing
components. You should directly paint a JComponent based on your customized
logic. And it is not easy. Go search for a package called "prefuse" |
|
c*****t 发帖数: 1879 | 30 Prefuse is not for table rendering... It's for graph visualization.
customized |
|
F****n 发帖数: 3271 | 31 It's a dataflow-based visualization package that can be used to visualize
anything. |
|
d*****l 发帖数: 8441 | 32 菜问:
两者都可以放更改表格内容的代码,似乎没有啥严格规定,
到底应当在那个当中插代码比较好一点呢?有啥子说法没有? |
|
h*********o 发帖数: 62 | 33 In Swing, everything is bean, spring can be a perfect fit for you to
organize and write loosely coupled code...
Swing itself is a UI framework. you do not need any other frameworks on top
of it. But you do need some third party libraies for layout, Jtable, Jtree..
. if you work on a nontivial project and do not want to write everything by
yourslf. |
|
h*****0 发帖数: 4889 | 34 这个不好实现。事实上不同系统或不同字体下|的长度就是不一样的。
你真有制表的需求,为啥不用JTable? |
|
e*n 发帖数: 1511 | 35 请问有人遇见这种问题没有?
试验了Java网站上给的模板,没问题,但是我自己的tabledatamodel就不成。需要什么
特殊的方法么? |
|
|
c*k 发帖数: 108 | 37 That is a nice one. thanks. |
|
l***y 发帖数: 4671 | 38 是啊。从来没用过 java,这次需要在 3 天内作出一个比较完整的数据库前台的
prototype 来,再加一周出 alpha version。现在正在跟 JTable 的 model 较劲中。
。。
对了,这个问题已经解决了。我对 JList 的 size 理解错了,把 JList 的 maximum
size 设成了在界面上的 size。现在设成 default 的最大值,若干万的那个,就没问
题了。 |
|
|
c****e 发帖数: 1453 | 40 What you ask is an essential feature of monitoring: counter. So you can put
sample values, see the percentile curve and even build alert from there. It
seems your system is pretty primitive without such infrastructure. I won't
recommend you to write from scratch to build a monitoring system, efficient
logging and leveled aggregation are not trivial.
To have a quick fix, you can create a in-memory datatable and write some
simple code to hardcode your aggregation(min/max/average) and dump them to
... 阅读全帖 |
|