我有一个可以调和的支架。 当单元由用户撰写时,如果输入文本更适合电池大小,那么表格中的行顶必须增加,以适应用户输入的新案文。 各位能否告诉我,如何根据所签案文的行文提高行的高度。
Can anyone help me in this? I have tried to add JTextArea into a row, but this is not working.
我有一个可以调和的支架。 当单元由用户撰写时,如果输入文本更适合电池大小,那么表格中的行顶必须增加,以适应用户输入的新案文。 各位能否告诉我,如何根据所签案文的行文提高行的高度。
Can anyone help me in this? I have tried to add JTextArea into a row, but this is not working.
您将需要计算新文本所需的高度。 视您在囚室使用的病因而定,您可使用例如JTextArea.getLineCount(
,以找出案文中有多少条线。
Then you need to retrieve the height of the font used by the renderer and calculate the needed height out of that.
Once you have that number, use JTable.setRowHeight(int, int)
to change the height for the specific row.
与此类似:
Component c = renderer.getTableCellRendererComponent(theTable, theTable.getValueAt(row, col), false, false, row, col);
Font f = c.getFont();
FontMetrics fm = c.getFontMetrics(f);
// this cast depends on the way your renderer is implemented !!!!
int lineCount = ((JTextArea)c).getLineCount();
int fheight = fm.getHeight();
int rowHeight = lineCount * fheight;
theTable.setRowHeight(row, rowHeight); //NOTE: rows and columns are zero-indexed
单价部分的加权依据的是配量,而不是该行所用电离器的优厚度:
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...