當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。