本文整理汇总了Java中javax.swing.JComponent.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.setMinimumSize方法的具体用法?Java JComponent.setMinimumSize怎么用?Java JComponent.setMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.setMinimumSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorateJComponent
import javax.swing.JComponent; //导入方法依赖的package包/类
private void decorateJComponent(JComponent component) {
String prop = (String)component.getClientProperty("com.rapidminer.ui.label.type");
if("header".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_28);
component.setForeground(SwingTools.RAPIDMINER_ORANGE);
} else if("bold".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_14);
component.setForeground(Color.DARK_GRAY);
} else if("normal".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_14);
component.setForeground(Color.DARK_GRAY);
} else if("large".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_16);
component.setForeground(Color.DARK_GRAY);
}
prop = (String)component.getClientProperty("com.rapidminer.ui.button.type");
if("cfa".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_14);
component.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15));
} else if("normal".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_14);
component.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
component.setMinimumSize(new Dimension(175, component.getPreferredSize().height));
component.setPreferredSize(new Dimension(175, component.getPreferredSize().height));
}
prop = (String)component.getClientProperty("com.rapidmniner.ui.link_button.id");
if(prop != null && component instanceof LinkButton) {
((LinkButton)component).setText(this.generateHTML(prop));
}
Color foregroundColor = (Color)component.getClientProperty("com.rapidminer.ui.label.foreground");
if(foregroundColor != null) {
component.setForeground(foregroundColor);
}
}
示例2: setSize
import javax.swing.JComponent; //导入方法依赖的package包/类
public static void setSize(JComponent component, Dimension dimension) {
component.setMinimumSize(dimension);
component.setPreferredSize(dimension);
}