Java Code Examples for javax.swing.JCheckBox#setVisible()

The following examples show how to use javax.swing.JCheckBox#setVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FieldPanel.java    From sldeditor with GNU General Public License v3.0 7 votes vote down vote up
/**
 * Internal create optional checkbox.
 *
 * @param xPos the x pos
 */
private void internalCreateOptionalCheckbox(int xPos) {
    optionalCheckbox = new JCheckBox();
    optionalCheckbox.setBounds(
            xPos + 5 + BasePanel.LABEL_WIDTH,
            0,
            BasePanel.CHECKBOX_WIDTH,
            BasePanel.WIDGET_HEIGHT);
    optionalCheckbox.setVisible(false);
    optionalCheckbox.addActionListener(
            new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    handleOptionalValue();
                }
            });
    add(optionalCheckbox);
}
 
Example 2
Source File: Welcome.java    From btdex with GNU General Public License v3.0 4 votes vote down vote up
public Welcome(JFrame owner, boolean resetPin) {
	super(owner, ModalityType.APPLICATION_MODAL);
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	
	this.resetPin = resetPin;

	setTitle(tr(resetPin ? "welc_reset_pin" : "welc_welcome"));
	setResizable(false);

	JPanel topPanel = new JPanel(new BorderLayout());

	JPanel panel = new JPanel(new GridLayout(0, 2, 4, 4));

	if(!resetPin) {
		JPanel introPanel = new JPanel(new BorderLayout());
		String title = "<html><h2>" + tr("welc_intro_header") + "</h2>";
		introPanel.add(new JLabel(title), BorderLayout.PAGE_START);
		String intro = "<html>" + tr("welc_intro_text") + "<br><br>" + tr("welc_intro_pin");
		introText = new JLabel(intro);
		introText.setPreferredSize(new Dimension(60, 120));
		introPanel.add(introText, BorderLayout.PAGE_END);
		
		useLedgerButton = new JButton(tr("welc_use_ledger"));
		useLedgerButton.addActionListener(this);
		introPanel.add(useLedgerButton, BorderLayout.CENTER);
		topPanel.add(introPanel, BorderLayout.CENTER);
	}

	passphrase = new JTextArea(2, 40);
	passphrase.setWrapStyleWord(true);
	passphrase.setLineWrap(true);
	passphrase.setEditable(false);

	pin = new JPasswordField(12);
	pinCheck = new JPasswordField(12);

	acceptBox = new JCheckBox(tr("welc_wrote"));
	recoverBox = new JCheckBox(tr("welc_reuse"));

	recoverBox.addActionListener(this);

	JPanel recoveryPanel = new JPanel(new BorderLayout());
	recoveryPanel.setBorder(BorderFactory.createTitledBorder(tr(resetPin ?
			"welc_prhase_to_redefine" :
			"welc_recovery_phrase")));
	recoveryPanel.add(recoverBox, BorderLayout.PAGE_START);
	recoveryPanel.add(passphrase, BorderLayout.CENTER);
	recoveryPanel.add(acceptBox, BorderLayout.PAGE_END);

	topPanel.add(recoveryPanel, BorderLayout.PAGE_END);

	// Create a button
	JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));

	calcelButton = new JButton(tr("dlg_cancel"));
	okButton = new JButton(tr("dlg_ok"));
	getRootPane().setDefaultButton(okButton);

	calcelButton.addActionListener(this);
	okButton.addActionListener(this);

	panel.add(new Desc(tr("dlg_pin"), pin));
	panel.add(new Desc(tr("welc_reenter_pin"), pinCheck));

	//		buttonPane.add(acceptBox);
	buttonPane.add(calcelButton);
	buttonPane.add(okButton);

	// set action listener on the button

	JPanel content = (JPanel)getContentPane();
	content.setBorder(new EmptyBorder(4, 4, 4, 4));

	content.add(topPanel, BorderLayout.PAGE_START);
	content.add(panel, BorderLayout.CENTER);
	content.add(buttonPane, BorderLayout.PAGE_END);

	if(resetPin) {
		passphrase.setText("");
		passphrase.setEditable(true);
		passphrase.requestFocus();
		
		recoverBox.setVisible(false);
		acceptBox.setSelected(true);
		acceptBox.setVisible(false);
	}
	else
		newPass();
	pack();

	addWindowListener(new WindowAdapter() {
		@Override
		public void windowActivated(WindowEvent event) {
			SwingUtilities.invokeLater(new Runnable() {
				public void run() {
					acceptBox.requestFocusInWindow();
				}
			});
		}
	});
}
 
Example 3
Source File: SourceTab.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
private void buildRightPanel(JPanel parent, String layout, JPanel rightPanel) {
		parent.add(rightPanel, layout);
			
		opts = new JPanel();
		rightPanel.add(opts);
		opts.setLayout(new BorderLayout());

		
		//buildTrackedSpacecraftList();

		
		optionsPanel = new JPanel();
		optionsPanel.setBorder(new TitledBorder(null, "Audio Options", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		opts.add(optionsPanel, BorderLayout.CENTER);
		optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
		
		filterPanel = new FilterPanel();
		opts.add(filterPanel, BorderLayout.SOUTH);
		
		rdbtnViewFilteredAudio = new JCheckBox("View Filtered Audio");
		optionsPanel.add(rdbtnViewFilteredAudio);
		rdbtnViewFilteredAudio.addItemListener(this);
		rdbtnViewFilteredAudio.setSelected(Config.viewFilteredAudio);
		
		rdbtnMonitorFilteredAudio = new JCheckBox("Monitor Filtered Audio");
		optionsPanel.add(rdbtnMonitorFilteredAudio);
		rdbtnMonitorFilteredAudio.addItemListener(this);
		rdbtnMonitorFilteredAudio.setSelected(Config.monitorFilteredAudio);

		rdbtnSquelchAudio = new JCheckBox("Squelch when no telemetry");
		optionsPanel.add(rdbtnSquelchAudio);
		rdbtnSquelchAudio.addItemListener(this);
		rdbtnSquelchAudio.setSelected(Config.squelchAudio);

		rdbtnFilterOutputAudio = new JCheckBox("LPF Monitored Audio");
		optionsPanel.add(rdbtnFilterOutputAudio);
		rdbtnFilterOutputAudio.addItemListener(this);
		rdbtnFilterOutputAudio.setSelected(Config.filterOutputAudio);
		rdbtnFilterOutputAudio.setVisible(false);
		
//		rdbtnShowFFT = new JCheckBox("Show FFT");
//		rdbtnShowFFT.addItemListener(this);
//		rdbtnShowFFT.setSelected(true);
//		optionsPanel.add(rdbtnShowFFT);
//		rdbtnShowFFT.setVisible(false);
		play = new JButton(">");
		play.addActionListener(this);
		optionsPanel.add(play);
		unpause = new JButton("||");
		unpause.addActionListener(this);
		optionsPanel.add(unpause);
		if (Config.debugValues) {
			play.setVisible(true);
			unpause.setVisible(true);
		}
//		audioOptionsFiller = new Box.Filler(new Dimension(10,10), new Dimension(100,80), new Dimension(100,500));
//		optionsPanel.add(audioOptionsFiller);
		
	//	rdbtnUseLimiter = new JCheckBox("Use FM Limiter");
	//	optionsPanel.add(rdbtnUseLimiter);
	//	rdbtnUseLimiter.addItemListener(this);
	//	rdbtnUseLimiter.setSelected(Config.useLimiter);
	//	rdbtnUseLimiter.setVisible(true);


	//	rdbtnWriteDebugData = new JCheckBox("Debug Values");
	//	optionsPanel.add(rdbtnWriteDebugData);
	//	rdbtnWriteDebugData.addItemListener(this);
	//	rdbtnWriteDebugData.setSelected(Config.debugValues);
	//	rdbtnWriteDebugData.setVisible(true);

//		optionsPanel.setVisible(true);

	}