本文整理匯總了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;
}
示例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
}