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

The following examples show how to use javax.swing.JCheckBox#setOpaque() . 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: CollapsiblePanel.java    From littleluck with Apache License 2.0 6 votes vote down vote up
protected Component createCollapseControl(String title, String tooltip) {
    // Add upper panel to hold collapse control
    Box box = Box.createHorizontalBox();
    expandCheckBox = new JCheckBox(title);
    expandCheckBox.setOpaque(false);
    expandCheckBox.setBorder(new EmptyBorder(0,4,0,0));
    expandCheckBox.setToolTipText(tooltip);
    expandCheckBox.setHorizontalTextPosition(JCheckBox.RIGHT);
    expandCheckBox.setSelectedIcon(new ArrowIcon(ArrowIcon.SOUTH));
    expandCheckBox.setIcon(new ArrowIcon(ArrowIcon.EAST));
    expandCheckBox.setSelected(isExpanded());
    
    expandCheckBox.addChangeListener(new CollapseListener());
    box.add(expandCheckBox);
    
    return box;                       
}
 
Example 2
Source File: KwikiDateModesSelectorPanel.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
private void SetupSliderLockCheckBox () {

        ChangeListener sliderLockChangeListener = new ChangeListener() {

            public void stateChanged ( ChangeEvent changeEvent ) {
                propertySupport.firePropertyChange(//
                        SLIDER_LOCK_PROPERTY,
                        "",
                        String.valueOf( ((JCheckBox) changeEvent.getSource()).isSelected() ) );
            }
        };

        sliderLockCheckBox = new JCheckBox( "Lock Uncertainties" );
        sliderLockCheckBox.setOpaque( false );
        sliderLockCheckBox.setForeground( new java.awt.Color( 204, 0, 0 ) );
        sliderLockCheckBox.setFont( new Font( "SansSerif", Font.BOLD, 9 ) );
        sliderLockCheckBox.setBounds( 1, 60, 120, 15 );
        sliderLockCheckBox.addChangeListener( sliderLockChangeListener );
        add( sliderLockCheckBox, javax.swing.JLayeredPane.DEFAULT_LAYER );

    }
 
Example 3
Source File: PreviewStatusPanel.java    From GIFKR with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void initializeComponents() {
	qualitySlider = new JSlider(10, 100, 50) {
		private static final long serialVersionUID = -3633632766184431178L;

		@Override
		public Dimension getPreferredSize() {
			return new Dimension(super.getPreferredSize().width/2, new JLabel(" ").getPreferredSize().height);
		}
	};
	qualitySlider.addChangeListener(ce -> r.refresh());
	
	qualitySlider.setOpaque(false);
	statusLabel = new JLabel();
	skipFrames = new JCheckBox("Skip frames", false);
	skipFrames.setOpaque(false);
}
 
Example 4
Source File: ListDemo.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
/**
    * Adds the suffix.
    *
    * @param suffix the suffix
    * @param selected the selected
    */
   public void addSuffix(String suffix, boolean selected) {
if(suffixAction == null) {
    suffixAction = new UpdateSuffixListAction(listModel);
}
final JCheckBox cb = (JCheckBox) suffixList.add(new JCheckBox(suffix));
cb.setOpaque(false);//* add by jb2011
checkboxes.addElement(cb);
cb.setSelected(selected);
cb.addActionListener(suffixAction);
if(selected) {
    listModel.addSuffix(suffix);
}
       cb.addFocusListener(listFocusListener);
   }
 
Example 5
Source File: ListDemo.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
/**
    * Adds the prefix.
    *
    * @param prefix the prefix
    * @param selected the selected
    */
   public void addPrefix(String prefix, boolean selected) {
if(prefixAction == null) {
    prefixAction = new UpdatePrefixListAction(listModel);
}
final JCheckBox cb = (JCheckBox) prefixList.add(new JCheckBox(prefix));
cb.setOpaque(false);//* add by jb2011
checkboxes.addElement(cb);
cb.setSelected(selected);
cb.addActionListener(prefixAction);
if(selected) {
    listModel.addPrefix(prefix);
}
       cb.addFocusListener(listFocusListener);
   }
 
Example 6
Source File: ShowNextTime.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of RecentProjects */
public ShowNextTime() {
    super( new BorderLayout() );

    setOpaque( false );
    
    button = new JCheckBox( BundleSupport.getLabel( "ShowOnStartup" ) ); // NOI18N
    button.setSelected( WelcomeOptions.getDefault().isShowOnStartup() );
    button.setOpaque( false );
    BundleSupport.setAccessibilityProperties( button, "ShowOnStartup" ); //NOI18N
    add( button, BorderLayout.CENTER );
    button.addActionListener( this );
}
 
Example 7
Source File: SimpleXYChartUtils.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public IconCheckBox(String text, Icon icon, boolean selected) {
    renderer = new JCheckBox(text, icon) {
        public boolean hasFocus() {
            return IconCheckBox.this.hasFocus();
        }
    };
    renderer.setOpaque(false);
    renderer.setBorderPainted(false);
    setSelected(selected);
    setBorderPainted(false);
}
 
Example 8
Source File: PreferencePanel.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Creates a {@link JCheckBox} suitable for use within the preference panel.
 *
 * @param title   The title to use.
 * @param tooltip The tooltip to use.
 * @param checked Whether the initial state should be checked.
 * @return The newly created {@link JCheckBox}.
 */
protected JCheckBox createCheckBox(String title, String tooltip, boolean checked) {
    JCheckBox checkbox = new JCheckBox(title, checked);
    checkbox.setOpaque(false);
    checkbox.setToolTipText(Text.wrapPlainTextForToolTip(tooltip));
    if (this instanceof ItemListener) {
        checkbox.addItemListener((ItemListener) this);
    }
    add(checkbox);
    return checkbox;
}
 
Example 9
Source File: SettingsEditor.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
private JCheckBox createCheckBox(JPanel panel, String title, String tooltip, boolean checked) {
    JCheckBox checkbox = new JCheckBox(title, checked);
    checkbox.setOpaque(false);
    checkbox.setToolTipText(Text.wrapPlainTextForToolTip(tooltip));
    checkbox.addItemListener(this);
    panel.add(checkbox, new PrecisionLayoutData().setHorizontalSpan(2));
    return checkbox;
}
 
Example 10
Source File: MultiChoiceComponent.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the pane with a checkbox for each choice.
 *
 * @param theChoices the available choices.
 */
private CheckBoxPanel(final Object[] theChoices) {

  setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
  setOpaque(false);

  final int choiceCount = theChoices.length;
  checkBoxes = new JCheckBox[choiceCount];

  for (int i = 0; i < choiceCount; i++) {

    // Create a check box (inherit tooltip text.
    final JCheckBox checkBox = new JCheckBox(theChoices[i].toString()) {

      /**
       * 
       */
      private static final long serialVersionUID = 1L;

      @Override
      public String getToolTipText() {

        return MultiChoiceComponent.this.getToolTipText();
      }
    };
    checkBox.addItemListener(e -> handleItemChanged());
    checkBox.setFont(CHECKBOX_FONT);
    checkBox.setOpaque(false);
    add(checkBox);
    ToolTipManager.sharedInstance().registerComponent(checkBox);
    checkBoxes[i] = checkBox;
  }
}
 
Example 11
Source File: ShowNextTime.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates a new instance of RecentProjects */
public ShowNextTime() {
    super( new BorderLayout() );
    setOpaque(false);

    button = new JCheckBox( BundleSupport.getLabel( "ShowOnStartup" ) ); // NOI18N
    button.setSelected( WelcomeOptions.getDefault().isShowOnStartup() );
    button.setOpaque( false );
    button.setForeground( Utils.getTopBarForeground() );
    button.setHorizontalTextPosition( SwingConstants.LEFT );
    BundleSupport.setAccessibilityProperties( button, "ShowOnStartup" ); //NOI18N
    add( button, BorderLayout.CENTER );
    button.addActionListener( this );
}
 
Example 12
Source File: LafPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JComponent createRestartNotificationDetails() {
    JPanel res = new JPanel( new BorderLayout( 10, 10) );
    res.setOpaque( false );
    JLabel lbl = new JLabel( NbBundle.getMessage( LafPanel.class, "Descr_Restart") ); //NOI18N
    lbl.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) );
    res.add( lbl, BorderLayout.CENTER );
    final JCheckBox checkEditorColors = new JCheckBox( NbBundle.getMessage( LafPanel.class, "Hint_ChangeEditorColors" ) ); //NOI18N
    if( isChangeEditorColorsPossible() ) {
        checkEditorColors.setSelected( true );
        checkEditorColors.setOpaque( false );
        res.add( checkEditorColors, BorderLayout.SOUTH );
    }
    lbl.addMouseListener( new MouseAdapter() {
        @Override
        public void mouseClicked( MouseEvent e ) {
            if( null != restartNotification ) {
                restartNotification.clear();
                restartNotification = null;
            }
            if( checkEditorColors.isSelected() ) {
                switchEditorColorsProfile();
            }
            LifecycleManager.getDefault().markForRestart();
            LifecycleManager.getDefault().exit();
        }
    });
    return res;
}
 
Example 13
Source File: DefaultOutlineCellRenderer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
final JCheckBox createCheckBox() {
    JCheckBox cb = new JCheckBox();
    cb.setSize(cb.getPreferredSize());
    cb.setBorderPainted(false);
    cb.setOpaque(false);
    return cb;
}
 
Example 14
Source File: ProjectSelectionPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JCheckBox createComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
    EclipseProject project = projects[row];
    JCheckBox chb = new JCheckBox();
    chb.setSelected(selectedProjects.contains(project) ||
            requiredProjects.contains(project));
    chb.setToolTipText(null);
    if (project.isImportSupported() && !requiredProjects.contains(project)) {
        chb.setEnabled(true);
    } else {
        // required and non-java project are disabled
        chb.setEnabled(false);
        if (!project.isImportSupported()) {
            chb.setToolTipText(ProjectImporterWizard.getMessage(
                    "MSG_NonJavaProject", project.getName())); // NOI18N
        }
    }
    if (isSelected) {
        chb.setOpaque(true);
        chb.setForeground(table.getSelectionForeground());
        chb.setBackground(table.getSelectionBackground());
    } else {
        chb.setOpaque(false);
        chb.setForeground(table.getForeground());
        chb.setBackground(table.getBackground());
    }
    return chb;
}
 
Example 15
Source File: Query.java    From opt4j with MIT License 5 votes vote down vote up
/**
 * Create an on-off check box.
 * 
 * @param name
 *            The name used to identify the entry (when calling get).
 * @param label
 *            The label to attach to the entry.
 * @param defaultValue
 *            The default value (true for on).
 */
public void addCheckBox(String name, String label, boolean defaultValue) {
	JLabel lbl = new JLabel(label + ": ");
	lbl.setBackground(_background);

	JCheckBox checkbox = new JCheckBox();
	checkbox.setBackground(_background);
	checkbox.setOpaque(false);
	checkbox.setSelected(defaultValue);
	_addPair(name, lbl, checkbox, checkbox);

	// Add the listener last so that there is no notification
	// of the first value.
	checkbox.addItemListener(new QueryItemListener(name));
}
 
Example 16
Source File: SettingsPage.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JCheckBox createCheckBox(String name, Font font) {
	JCheckBox chk = new JCheckBox(StringResource.get(name));
	chk.setName(name);
	chk.setIcon(ImageResource.getIcon("unchecked.png", 16, 16));
	chk.setSelectedIcon(ImageResource.getIcon("checked.png", 16, 16));
	chk.setOpaque(false);
	chk.setFocusPainted(false);
	chk.setForeground(Color.WHITE);
	chk.setFont(font);
	return chk;
}
 
Example 17
Source File: AbstractDataMonitorView.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
/**
 *
 * @param inLiveMode the value of inLiveMode
 */
public void prepareConcordia(boolean inLiveMode) {

    if (concordiaGraphPanel != null) {
        this.remove(concordiaGraphPanel);
    }
    if (kwikiConcordiaToolBar != null) {
        this.remove(kwikiConcordiaToolBar);
    }

    if (savedCountOfFractions == 0) {
        concordiaGraphPanel = new ConcordiaGraphPanel(project.getSuperSample(), getuPbReduxFrame());

        ((ConcordiaGraphPanel) concordiaGraphPanel).setCurrentGraphAxesSetup(new GraphAxesSetup("C", 2));

        ((ConcordiaGraphPanel) concordiaGraphPanel).setShowTitleBox(false);

        ((ConcordiaGraphPanel) concordiaGraphPanel).//
                setYorkFitLine(null);
        ((ConcordiaGraphPanel) concordiaGraphPanel).//
                setFadedDeselectedFractions(true);

        project.getSuperSample().getSampleDateInterpretationGUISettings().//
                setConcordiaOptions(((ConcordiaPlotDisplayInterface) concordiaGraphPanel).getConcordiaOptions());
        probabilityChartOptions = project.getSuperSample().getSampleDateInterpretationGUISettings().getProbabilityChartOptions();

        ((ConcordiaGraphPanel) concordiaGraphPanel).//
                setFadedDeselectedFractions(false);

        ((ConcordiaGraphPanel) concordiaGraphPanel).setShowTightToEdges(true);

    }

    setConcordiaBounds(showSessions ? 725 : leftMargin + 135, showSessions ? 620 : 900, 625);

    kwikiConcordiaToolBar = new KwikiConcordiaToolBar(//
            940, topMargin + concordiaGraphPanel.getHeight() + topMargin + 50, concordiaGraphPanel, null);

    ((ConcordiaGraphPanel) concordiaGraphPanel).setSample(project.getSuperSample());
    ((ConcordiaGraphPanel) concordiaGraphPanel).setViewOptions();
    ((ConcordiaGraphPanel) concordiaGraphPanel).setShowBestDateDivider206_238(true);

    add(concordiaGraphPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);

    try {
        Vector<ETFractionInterface> selectedFractions
                = project.getSuperSample().getFractions();

        ((AliquotDetailsDisplayInterface) concordiaGraphPanel).//
                setSelectedFractions(selectedFractions);
        ((PlottingDetailsDisplayInterface) concordiaGraphPanel).resetPanel(true, inLiveMode);
    } catch (Exception e) {
    }

    add(kwikiConcordiaToolBar, javax.swing.JLayeredPane.DEFAULT_LAYER);

    JCheckBox showFilteredFractions_checkbox = new JCheckBox();
    showFilteredFractions_checkbox.setFont(new java.awt.Font("SansSerif", 1, 10));
    showFilteredFractions_checkbox.setText("<html>Filtering ON<br> </html>");
    showFilteredFractions_checkbox.setBounds(leftMargin + 1075, topMargin + 660, 120, 25);
    showFilteredFractions_checkbox.setOpaque(true);
    showFilteredFractions_checkbox.setBackground(Color.white);
    showFilteredFractions_checkbox.addActionListener((java.awt.event.ActionEvent evt) -> {
        boolean state = ((AliquotDetailsDisplayInterface) concordiaGraphPanel).isShowFilteredEllipses();
        ((AliquotDetailsDisplayInterface) concordiaGraphPanel).setShowFilteredEllipses(!state);
        showFilteredFractions_checkbox.setSelected(!state);
        probabilityChartOptions.put("showFilteredEllipses", Boolean.toString(!state));
        concordiaGraphPanel.repaint();
    });

    if (probabilityChartOptions.containsKey("showFilteredEllipses")) {
        showFilteredFractions_checkbox.setSelected(Boolean.valueOf(probabilityChartOptions.get("showFilteredEllipses")));
        ((AliquotDetailsDisplayInterface) concordiaGraphPanel).setShowFilteredEllipses(showFilteredFractions_checkbox.isSelected());
    }

    this.add(showFilteredFractions_checkbox, LAYER_FIVE);

}
 
Example 18
Source File: BooleanTableCellEditor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public BooleanTableCellEditor(JCheckBox cb) {
    super(cb);
    cb.setOpaque(true);
    cb.setHorizontalAlignment(0);
}
 
Example 19
Source File: ResultSetCellRenderer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public BooleanCellRenderer() {
    super();
    cb = new JCheckBox();
    cb.setOpaque(true);
    cb.setHorizontalAlignment(0);
}
 
Example 20
Source File: ToolBarComponentFactory.java    From chipster with MIT License 4 votes vote down vote up
public static JCheckBox createCheckBox(String text){
	JCheckBox cbox = new JCheckBox(text);
	cbox.setOpaque(false);
	return cbox;
}