当前位置: 首页>>代码示例>>Java>>正文


Java JSpinner.setVisible方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:BoxFillerInitializer.java

示例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();
}
 
开发者ID:moment-of-peace,项目名称:AI-RRT-Motion-Planning,代码行数:29,代码来源:Visualiser.java


注:本文中的javax.swing.JSpinner.setVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。