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


Java GroupLayout.setHonorsVisibility方法代码示例

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


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

示例1: createProgressComponent

import javax.swing.GroupLayout; //导入方法依赖的package包/类
private JComponent createProgressComponent() {
    progressLabel = new JLabel(getDisplayName());

    progressBar = super.getProgressComponent();

    stopButton = new JButton(NbBundle.getMessage(WizardStepProgressSupport.class, "BK2022")); // NOI18N
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cancel();
        }
    });

    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);

    progressLine = new JPanel();
    progressLine.add(progressBar);
    progressLine.add(Box.createHorizontalStrut(
                            LayoutStyle.getInstance()
                            .getPreferredGap(progressBar,
                                             stopButton,
                                             RELATED,
                                             SwingConstants.EAST,
                                             progressLine)));
    progressLine.add(stopButton);

    progressLine.setLayout(new BoxLayout(progressLine, BoxLayout.X_AXIS));
    progressBar.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    stopButton.setAlignmentX(JComponent.CENTER_ALIGNMENT);

    layout.setHorizontalGroup(
            layout.createParallelGroup(LEADING)
            .addComponent(progressLabel)
            .addComponent(progressLine));
    layout.setVerticalGroup(
            layout.createSequentialGroup()
            .addComponent(progressLabel)
            .addPreferredGap(RELATED)
            .addComponent(progressLine));
    panel.setLayout(layout);

    layout.setHonorsVisibility(false);   //hiding should not affect prefsize

    progressLabel.setVisible(false);
    progressLine.setVisible(false);

    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:WizardStepProgressSupport.java

示例2: initComponents

import javax.swing.GroupLayout; //导入方法依赖的package包/类
private void initComponents() {
    cardsPanel = new JPanel(new CardLayout());

    errorLabel = new JLabel();
    errorLabel.setForeground(ERROR_COLOR);
    errorLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(
            "org/netbeans/modules/bugtracking/ui/resources/error.gif")));   //NOI18N
    errorText = new JTextArea();
    errorText.setForeground(ERROR_COLOR);
    errorText.setBackground(errorLabel.getBackground());
    errorText.setEditable(false);
    
    errorScrollPane = new javax.swing.JScrollPane();
    errorScrollPane.setBorder(null);
    errorScrollPane.setViewportView(errorText);
    
    updateErrorMessage(" ");                                        //NOI18N
    
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    
    int height = errorText.getFont().getSize() * 3;
    
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(cardsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(errorLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(errorScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE)))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(cardsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGap(6, 14, 14)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(errorScrollPane, height, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(errorLabel))
            )
    );
    layout.setHonorsVisibility(false);  //keep space for errorLabel
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:RepositoryFormPanel.java


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