當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。