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