本文整理汇总了Java中javax.swing.JSpinner.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java JSpinner.setVisible方法的具体用法?Java JSpinner.setVisible怎么用?Java JSpinner.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JSpinner
的用法示例。
在下文中一共展示了JSpinner.setVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WidthHeightPanel
import javax.swing.JSpinner; //导入方法依赖的package包/类
WidthHeightPanel(boolean showWidth, boolean showHeight) {
ResourceBundle bundle = NbBundle.getBundle(BoxFillerInitializer.class);
JLabel widthLabel = new JLabel(bundle.getString("BoxFillerInitializer.width")); // NOI18N
JLabel heightLabel = new JLabel(bundle.getString("BoxFillerInitializer.height")); // NOI18N
widthField = new JSpinner(new SpinnerNumberModel());
heightField = new JSpinner(new SpinnerNumberModel());
GroupLayout layout = new GroupLayout(this);
setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(widthLabel)
.addComponent(heightLabel))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(widthField)
.addComponent(heightField))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(widthLabel)
.addComponent(widthField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(heightLabel)
.addComponent(heightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
widthLabel.setVisible(showWidth);
heightLabel.setVisible(showHeight);
widthField.setVisible(showWidth);
heightField.setVisible(showHeight);
}
示例2: createComponents
import javax.swing.JSpinner; //导入方法依赖的package包/类
private void createComponents() {
vp = new VisualisationPanel(this);
JPanel wp = new JPanel(new BorderLayout());
wp.add(vp, BorderLayout.CENTER);
container.setLayout(new BorderLayout());
wp.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createEmptyBorder(5, 10, 10, 10),
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)));
container.add(wp, BorderLayout.CENTER);
infoPanel = new JPanel();
infoPanel.setLayout(new FlowLayout());
infoLabel = new JLabel("No problem to display.");
samplingSpinner = new JSpinner(new SpinnerNumberModel(
SAMPLING_PERIOD_INIT, 1, null, 1));
samplingSpinner.addChangeListener(samplingListener);
samplingSpinner.setPreferredSize(new Dimension(50, 20));
samplingSpinner.setVisible(false);
vp.setSamplingPeriod(SAMPLING_PERIOD_INIT);
infoPanel.add(infoLabel);
infoPanel.add(samplingSpinner);
container.add(infoPanel, BorderLayout.NORTH);
createMenus();
createAnimationControls();
}