本文整理汇总了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
}