当前位置: 首页>>代码示例>>Java>>正文


Java JComponent.getUIClassID方法代码示例

本文整理汇总了Java中javax.swing.JComponent.getUIClassID方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.getUIClassID方法的具体用法?Java JComponent.getUIClassID怎么用?Java JComponent.getUIClassID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JComponent的用法示例。


在下文中一共展示了JComponent.getUIClassID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUIName

import javax.swing.JComponent; //导入方法依赖的package包/类
public static void setUIName(JComponent c) {
    String key = c.getUIClassID();
    String uiClassName = (String) UIManager.get(key);

    if (uiClassName == null) {
        String componentName = c.getClass().getName();
        int index = componentName.lastIndexOf(".") + 1;
        StringBuffer sb = new StringBuffer();
        sb.append(componentName.substring(0, index));
        String lookAndFeelName = UIManager.getLookAndFeel().getName();
        if (lookAndFeelName.startsWith("CDE/")) {
            lookAndFeelName = lookAndFeelName.substring(4, lookAndFeelName.length());
        }
        sb.append(lookAndFeelName);
        sb.append(key);
        UIManager.put(key, sb.toString());
    }
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:19,代码来源:MultiThumbSlider.java

示例2: getButtonAdjustment

import javax.swing.JComponent; //导入方法依赖的package包/类
private int getButtonAdjustment(JComponent source, int edge) {
    String uid = source.getUIClassID();
    if (uid == "ButtonUI" || uid == "ToggleButtonUI") {
        if (!isOcean && (edge == SwingConstants.EAST ||
                         edge == SwingConstants.SOUTH)) {
            return 1;
        }
    }
    else if (edge == SwingConstants.SOUTH) {
        if (uid == "RadioButtonUI" || (!isOcean && uid == "CheckBoxUI")) {
            return 1;
        }
    }
    return 0;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:16,代码来源:MetalLayoutStyle.java

示例3: getCBRBPadding

import javax.swing.JComponent; //导入方法依赖的package包/类
private int getCBRBPadding(JComponent c, int position) {
    if (c.getUIClassID() == "CheckBoxUI" ||
          c.getUIClassID() == "RadioButtonUI") {
        Border border = c.getBorder();
        if (border instanceof UIResource) {
            return getInset(c, position);
        }
    }
    return 0;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:11,代码来源:LayoutStyle.java

示例4: getPreferredGap

import javax.swing.JComponent; //导入方法依赖的package包/类
public int getPreferredGap(JComponent source, JComponent target,
                      int type, int position, Container parent) {
    // Invoke super to check arguments.
    super.getPreferredGap(source, target, type, position, parent);

    if (type == INDENT) {
        if (position == SwingConstants.EAST || position == SwingConstants.WEST) {
            int gap = getButtonChildIndent(source, position);
            if (gap != 0) {
                return gap;
            }
            return 12;
        }
        // Treat vertical INDENT as RELATED
        type = RELATED;
    }
    
    String sourceCID = source.getUIClassID();
    String targetCID = target.getUIClassID();
    int offset;

    if (type == RELATED) {
        if (sourceCID == "ToggleButtonUI" &&
                  targetCID == "ToggleButtonUI") {
            ButtonModel sourceModel = ((JToggleButton)source).getModel();
            ButtonModel targetModel = ((JToggleButton)target).getModel();
            if ((sourceModel instanceof DefaultButtonModel) &&
                (targetModel instanceof DefaultButtonModel) &&
                (((DefaultButtonModel)sourceModel).getGroup() ==
                 ((DefaultButtonModel)targetModel).getGroup()) &&
                    ((DefaultButtonModel)sourceModel).getGroup() != null) {
                // When toggle buttons are exclusive (that is, they form a
                // radio button set), separate them with 2 pixels. This
                // rule applies whether the toggle buttons appear in a
                // toolbar or elsewhere in the interface.
                // Note: this number does not appear to include any borders
                // and so is not adjusted by the border of the toggle
                // button
                return 2;
            }
            // When toggle buttons are independent (like checkboxes)
            // and used outside a toolbar, separate them with 5
            // pixels.
            if (isOcean) {
                return 6;
            }
            return 5;
        }
        offset = 6;
    }
    else {
        offset = 12;
    }
    if ((position == SwingConstants.EAST ||
         position == SwingConstants.WEST) &&
        ((sourceCID == "LabelUI" && targetCID != "LabelUI") ||
         (sourceCID != "LabelUI" && targetCID == "LabelUI"))) {
        // Insert 12 pixels between the trailing edge of a
        // label and any associated components. Insert 12
        // pixels between the trailing edge of a label and the
        // component it describes when labels are
        // right-aligned. When labels are left-aligned, insert
        // 12 pixels between the trailing edge of the longest
        // label and its associated component
        return getCBRBPadding(source, target, position, offset + 6);
    }
    return getCBRBPadding(source, target, position, offset);
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:69,代码来源:MetalLayoutStyle.java

示例5: getPreferredGap

import javax.swing.JComponent; //导入方法依赖的package包/类
public int getPreferredGap(JComponent source, JComponent target,
                      int type, int position, Container parent) {
    // Invoke super to check arguments.
    super.getPreferredGap(source, target, type, position, parent);

    if (type == INDENT) {
        if (position == SwingConstants.EAST || position == SwingConstants.WEST) {
            int gap = getButtonChildIndent(source, position);
            if (gap != 0) {
                return gap;
            }
            // Indent group members 12 pixels to denote hierarchy and
            // association.
            return 12;
        }
        // Treat vertical INDENT as RELATED
        type = RELATED;
    }
    // Between labels and associated components, leave 12 horizontal
    // pixels.
    if (position == SwingConstants.EAST ||
                    position == SwingConstants.WEST) {
        boolean sourceLabel = (source.getUIClassID() == "LabelUI");
        boolean targetLabel = (target.getUIClassID() == "LabelUI");
        if ((sourceLabel && !targetLabel) || 
                (!sourceLabel && targetLabel)) {
            return 12;
        }
    }
    // As a basic rule of thumb, leave space between user
    // interface components in increments of 6 pixels, going up as
    // the relationship between related elements becomes more
    // distant. For example, between icon labels and associated
    // graphics within an icon, 6 pixels are adequate. Between
    // labels and associated components, leave 12 horizontal
    // pixels. For vertical spacing between groups of components,
    // 18 pixels is adequate.
    //
    // The first part of this is handled automatically by Icon (which
    // won't give you 6 pixels).
    if (type == RELATED) {
        return 6;
    }
    return 12;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:46,代码来源:GnomeLayoutStyle.java

示例6: getPreferredGap

import javax.swing.JComponent; //导入方法依赖的package包/类
public int getPreferredGap(JComponent source, JComponent target,
                      int type, int position, Container parent) {
    // Invoke super to check arguments.
    super.getPreferredGap(source, target, type, position, parent);

    if (type == INDENT) {
        if (position == SwingConstants.EAST || position == SwingConstants.WEST) {
            int gap = getButtonChildIndent(source, position);
            if (gap != 0) {
                return gap;
            }
            return 10;
        }
        // Treat vertical INDENT as RELATED
        type = RELATED;
    }
    if (type == UNRELATED) {
        // Between unrelated controls: 7
        return getCBRBPadding(source, target, position,
                              dluToPixels(7, position));
    }
    else { //type == RELATED
        boolean sourceLabel = (source.getUIClassID() == "LabelUI");
        boolean targetLabel = (target.getUIClassID() == "LabelUI");

        if (((sourceLabel && !targetLabel) ||
             (targetLabel && !sourceLabel)) &&
            (position == SwingConstants.EAST ||
             position == SwingConstants.WEST)) {
            // Between text labels and their associated controls (for
            // example, text boxes and list boxes): 3
            // NOTE: We're not honoring:
            // 'Text label beside a button 3 down from the top of
            // the button,' but I suspect that is an attempt to
            // enforce a baseline layout which will be handled
            // separately.  In order to enforce this we would need
            // this API to return a more complicated type (Insets,
            // or something else).
            return getCBRBPadding(source, target, position,
                                  dluToPixels(3, position));
        }
        // Between related controls: 4
        return getCBRBPadding(source, target, position,
                              dluToPixels(4, position));
    }
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:47,代码来源:WindowsLayoutStyle.java


注:本文中的javax.swing.JComponent.getUIClassID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。