我们有一个包含多个联合小组的JPanel,其中包括JLabels和JText Boxes。
在每个内部的JPanels,我们使用JGoodies Layout,以确保所有Labels的适当协调。
但我们当然希望所有实验室独立地协调它们所处的次位。
我们如何能够这样做,而没有确定包含“JLabels”一栏的宽度?
由于我们必须在各组成部分之间架设边界线,我们可以放松联合通道。
我们有一个包含多个联合小组的JPanel,其中包括JLabels和JText Boxes。
在每个内部的JPanels,我们使用JGoodies Layout,以确保所有Labels的适当协调。
但我们当然希望所有实验室独立地协调它们所处的次位。
我们如何能够这样做,而没有确定包含“JLabels”一栏的宽度?
由于我们必须在各组成部分之间架设边界线,我们可以放松联合通道。
仅仅因为
我建议支持平整的布局。 单一配置是容易的。 避免标题Borders,代之以“分离者、分离者或仅仅是白色空间”。 这为绝大多数编辑和表格提供了帮助。
但是,如果你想要使多位编辑或表格相互配合,上述技术就失败了。 JGoodies FormLayout为解决这一问题提供了两个层次,更一般而言是提高布局的一致性: (1) 大小限值降低,2) 排外变量。
如果有的话,你可以描述能够确保以各种形式获得最低宽度的布局。 例如,如果你想说所有标签栏至少有100px的宽度,你可以就标签栏说“[100px, pref]”。
2)超越办法1。 动机是从多种形式中提取100皮克。 在表格中,你可以确定布局变量,例如,你认为“[100px, pref]”或“权利:[75dlu, pref]”等。 如果你在各位编辑中使用布局变量,这些变量是前后一致的,而且你有一个可以为所有编辑配置所有标签栏的单一地点。
我知道,这样做没有简单的方法。 你的选择:
我宣读了关于使用共同财产而不是多条边界的联产企业的建议,如果把植被同起来是你的优先事项。
JSeparator gives the visual effect of grouping widgets, but themselves are just another simple widget fitting into the same JPanel. Read the tutorial for important tips such as setting the preferred size. http://download.oracle.com/javase/tutorial/uiswing/components/separator.html
而且, Apple果目前的准则只是把空洞空间作为群体之间的隔.,作为边界和分离者的替代。
这一样本守则有助于解决你的统一问题:
//c is instance of the content pane
c.setLayout(gl=new GridLayout(3,0));
//jp is a jpanel. I took this panel because there is no alignment
//setting for a specifiq cell of grid Layout.
jp.setAlignmentX(CENTER_ALIGNMENT);
//jl is the jLabel
jp.add(jl);
//finally I add that with the frame
c.add(jp);
希望将有助于你解决你的问题。
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 ...