Java Code Examples for javax.swing.JComponent.setMinimumSize()

The following are Jave code examples for showing how to use setMinimumSize() of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: rapidminer   File: OnboardingDialog.java   View Source Code Vote up 5 votes
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);
    }

}
 
Example 2
Project: incubator-netbeans   File: UI.java   View Source Code Vote up 4 votes
public static void setSize(JComponent component, Dimension dimension) {
    component.setMinimumSize(dimension);
    component.setPreferredSize(dimension);
}