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


Java LayoutStyle.getInstance方法代码示例

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


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

示例1: makeVerticalStrut

import javax.swing.LayoutStyle; //导入方法依赖的package包/类
private static Component makeVerticalStrut(JComponent compA,
                                           JComponent compB) {
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    return Box.createVerticalStrut(
            layoutStyle.getPreferredGap(compA,
                                        compB,
                                        UNRELATED,
                                        SOUTH,
                                        compA.getParent()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ExpandableMessage.java

示例2: addContainerBorder

import javax.swing.LayoutStyle; //导入方法依赖的package包/类
public static JComponent addContainerBorder(JComponent comp) {
    final LayoutStyle layoutStyle = LayoutStyle.getInstance();

    JPanel panel = new JPanel();
    panel.add(comp);
    panel.setBorder(BorderFactory.createEmptyBorder(
            layoutStyle.getContainerGap(comp, SwingConstants.NORTH, null),
            layoutStyle.getContainerGap(comp, SwingConstants.WEST,  null),
            layoutStyle.getContainerGap(comp, SwingConstants.SOUTH, null),
            layoutStyle.getContainerGap(comp, SwingConstants.EAST,  null)));
    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:HgUtils.java

示例3: addInsetsToPanel

import javax.swing.LayoutStyle; //导入方法依赖的package包/类
private static void addInsetsToPanel(JComponent comp) {
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    comp.setBorder(BorderFactory.createEmptyBorder(
            layoutStyle.getContainerGap(comp, NORTH, null),
            layoutStyle.getContainerGap(comp, WEST,  null),
            layoutStyle.getContainerGap(comp, SOUTH, null),
            layoutStyle.getContainerGap(comp, EAST,  null)));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:RepositorySelectorBuilder.java

示例4: layoutSelectResourcePanel

import javax.swing.LayoutStyle; //导入方法依赖的package包/类
/**
 * @author  Marian Petras
 */
static void layoutSelectResourcePanel(final Container thePanel,
                                      final String instructionsText,
                                      final String selectionLabelText,
                                      final Component selectionComp,
                                      final JButton button1,
                                      final JButton button2) {
    JTextArea instructions = new JTextArea();
    JLabel lblSelection = new JLabel();

    instructions.setColumns(20);
    instructions.setEditable(false);
    instructions.setLineWrap(true);
    instructions.setText(instructionsText);
    instructions.setWrapStyleWord(true);
    instructions.setDisabledTextColor(new JLabel().getForeground());
    instructions.setEnabled(false);
    instructions.setOpaque(false);

    lblSelection.setLabelFor(selectionComp);
    Mnemonics.setLocalizedText(lblSelection, selectionLabelText);

    JScrollPane scrollPane = new JScrollPane(selectionComp);

    Container filesSelection = new JPanel();
    GroupLayout layout = new GroupLayout(filesSelection);
    filesSelection.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(LEADING)
        .addComponent(lblSelection)
        .addGroup(layout.createSequentialGroup()
            .addComponent(scrollPane, 0, DEFAULT_SIZE, Integer.MAX_VALUE)
            .addPreferredGap(RELATED)
            .addGroup(layout.createParallelGroup(LEADING)
                .addComponent(button1)
                .addComponent(button2)))
    );

    layout.linkSize(SwingConstants.HORIZONTAL, button1, button2);

    layout.setVerticalGroup(
        layout.createParallelGroup(LEADING)
        .addGroup(layout.createSequentialGroup()
            .addComponent(lblSelection)
            .addPreferredGap(RELATED)
            .addGroup(layout.createParallelGroup(LEADING)
                .addComponent(scrollPane, 0, DEFAULT_SIZE, Integer.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(button1)
                    .addPreferredGap(RELATED)
                    .addComponent(button2))))
    );

    LayoutStyle layoutStyle = layout.getLayoutStyle();
    if (layoutStyle == null) {
        layoutStyle = LayoutStyle.getInstance();
    }

    BorderLayout mainLayout = new BorderLayout();
    thePanel.setLayout(mainLayout);
    thePanel.add(instructions, BorderLayout.PAGE_START);
    thePanel.add(filesSelection, BorderLayout.CENTER);
    mainLayout.setVgap(layoutStyle.getPreferredGap(instructions,
                                                   lblSelection,
                                                   UNRELATED,
                                                   SwingConstants.NORTH,
                                                   thePanel));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:71,代码来源:Util.java

示例5: getLeftContainerGap

import javax.swing.LayoutStyle; //导入方法依赖的package包/类
private static int getLeftContainerGap(JComponent comp) {
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    return layoutStyle.getContainerGap(comp, WEST, null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:QueryTopComponent.java

示例6: selectIssue

import javax.swing.LayoutStyle; //导入方法依赖的package包/类
public static Issue selectIssue(String message, Repository repository, JPanel caller, HelpCtx helpCtx) {
    QuickSearchComboBar bar = new QuickSearchComboBar(caller);
    bar.setRepository(repository);
    bar.setAlignmentX(0f);
    bar.setMaximumSize(new Dimension(Short.MAX_VALUE, bar.getPreferredSize().height));
    JPanel panel = new JPanel();
    BoxLayout layout = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
    panel.setLayout(layout);
    JLabel label = new JLabel();
    Mnemonics.setLocalizedText(label, message);
    panel.add(label);
    label.setLabelFor(bar.getIssueComponent());
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    int gap = layoutStyle.getPreferredGap(label, bar, LayoutStyle.ComponentPlacement.RELATED, SwingConstants.SOUTH, panel);
    panel.add(Box.createVerticalStrut(gap));
    panel.add(bar);
    panel.add(Box.createVerticalStrut(gap));
    ResourceBundle bundle = NbBundle.getBundle(QuickSearchComboBar.class);
    JLabel hintLabel = new JLabel(bundle.getString("MSG_SelectIssueHint")); // NOI18N
    hintLabel.setEnabled(false);
    panel.add(hintLabel);
    panel.add(Box.createVerticalStrut(80));
    panel.setBorder(BorderFactory.createEmptyBorder(
            layoutStyle.getContainerGap(panel, SwingConstants.NORTH, null),
            layoutStyle.getContainerGap(panel, SwingConstants.WEST, null),
            0,
            layoutStyle.getContainerGap(panel, SwingConstants.EAST, null)));
    panel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_IssueSelector"));
    Issue issue = null;
    JButton ok = new JButton(bundle.getString("LBL_Select")); // NOI18N
    ok.getAccessibleContext().setAccessibleDescription(ok.getText());
    JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N
    cancel.getAccessibleContext().setAccessibleDescription(cancel.getText());
    DialogDescriptor descriptor = new DialogDescriptor(
            panel,
            bundle.getString("LBL_Issues"), // NOI18N
            true,
            NotifyDescriptor.OK_CANCEL_OPTION,
            ok,
            null);
    descriptor.setOptions(new Object [] {ok, cancel});
    descriptor.setHelpCtx(helpCtx);
    DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
    if (descriptor.getValue() == ok) {
        issue = bar.getIssue();
    }
    return issue;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:QuickSearchComboBar.java


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