Java Code Examples for javax.swing.JCheckBox

The following are top voted examples for showing how to use javax.swing.JCheckBox. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: myster   File: MessageManager.java   Source Code and License 7 votes vote down vote up
public MessagePreferencesPanel() {
    setLayout(null);

    refuseMessages = new JCheckBox("Refuse Messages");
    refuseMessages.setSize(150, 25);
    refuseMessages.setLocation(10, 25);
    refuseMessages.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            updateEnabled();
        }
    });
    add(refuseMessages);

    denyMessageLabel = new JLabel("Refusal Message:");
    denyMessageLabel.setSize(150, 25);
    denyMessageLabel.setLocation(20, 50);
    add(denyMessageLabel);

    denyMessageText = new JTextField(REFUSAL_MESSAGE_DEFAULT);
    denyMessageText.setSize(400, 25);
    denyMessageText.setLocation(25, 75);
    add(denyMessageText);

    setSize(STD_XSIZE, STD_YSIZE);
}
 
Example 2
Project: LivroJavaComoProgramar10Edicao   File: CheckBoxFrame.java   Source Code and License 7 votes vote down vote up
public CheckBoxFrame()
{
   super("JCheckBox Test");
   setLayout(new FlowLayout());

   // set up JTextField and set its font
   textField = new JTextField("Watch the font style change", 20);
   textField.setFont(new Font("Serif", Font.PLAIN, 14));
   add(textField); // add textField to JFrame

   boldJCheckBox = new JCheckBox("Bold"); 
   italicJCheckBox = new JCheckBox("Italic"); 
   add(boldJCheckBox); // add bold checkbox to JFrame
   add(italicJCheckBox); // add italic checkbox to JFrame

   // register listeners for JCheckBoxes
   CheckBoxHandler handler = new CheckBoxHandler();
   boldJCheckBox.addItemListener(handler);
   italicJCheckBox.addItemListener(handler);
}
 
Example 3
Project: incubator-netbeans   File: CodeTemplatesOperator.java   Source Code and License 7 votes vote down vote up
public CodeTemplatesOperator setContext(Set<String> set) {
    JTabbedPaneOperator tabbedPane = getTabbedPane();
    tabbedPane.selectPage("Contexts");
    ContainerOperator<JEditorPane> selectedComponent = new ContainerOperator<>((Container)tabbedPane.getSelectedComponent());
    JListOperator list = new JListOperator(selectedComponent);
    for (int i = 0; i < list.getModel().getSize(); i++) {
        JCheckBox checkBox = (JCheckBox) list.getRenderedComponent(i);
        String contextName = checkBox.getText();
        list.scrollToItem(i);
        if(!checkBox.isSelected() && set.contains(contextName)) {
            list.selectItem(i);
        } else if(checkBox.isSelected() && !set.contains(contextName)) {
            list.selectItem(i);
        }            
    }   
    return this;
    
}
 
Example 4
Project: Equella   File: FilteringTab.java   Source Code and License 6 votes vote down vote up
@Override
public void setup(ChangeDetector changeDetector)
{
	showResults = new JCheckBox(getString("filteringtab.display"), true); //$NON-NLS-1$
	filter = new SearchSetFilter(cache, clientService);

	final int[] rows = {TableLayout.PREFERRED, TableLayout.FILL,};
	final int[] cols = {TableLayout.FILL,};

	setLayout(new TableLayout(rows, cols));

	add(showResults, new Rectangle(0, 0, 1, 1));
	add(filter, new Rectangle(0, 1, 1, 1));

	changeDetector.watch(showResults);
	changeDetector.watch(filter);
}
 
Example 5
Project: TwitchBot   File: MainView.java   Source Code and License 6 votes vote down vote up
private void manageButtons() {
	this.joinChannel = new JButton("Join Channel");
	this.joinChannel.setPreferredSize(
			new Dimension(this.chatAreaDescription.getPreferredSize().width, this.joinChannel.getPreferredSize().height));
	this.joinChannel.setBorder(BorderFactory.createBevelBorder(1));

	this.leaveChannel = new JButton("Leave Channel");
	this.leaveChannel.setPreferredSize(
			new Dimension(this.chatAreaDescription.getPreferredSize().width, this.joinChannel.getPreferredSize().height));
	this.leaveChannel.setBorder(BorderFactory.createBevelBorder(1));

	this.actAsBot = new JCheckBox("React to !");
	this.actAsBot.setSelected(true);

	this.trollPaul = new JCheckBox("Copy Swaul");
	this.trollPaul.setSelected(false);

	this.trollMatti = new JCheckBox("Copy GeniusMatti");
	this.trollMatti.setSelected(false);

	this.logToFile = new JCheckBox("Log To File");
	this.logToFile.setSelected(true);

}
 
Example 6
Project: incubator-netbeans   File: ScopeOptionsController.java   Source Code and License 6 votes vote down vote up
private void init() {
    btnTestFileNamePattern = new JButton();
    chkFileNameRegex = new JCheckBox();
    chkFileNameRegex.setToolTipText(UiUtils.getText(
            "BasicSearchForm.chkFileNameRegex.tooltip"));           //NOI18N

    if (!replacing) {
        chkArchives = new JCheckBox();
        chkGenerated = new JCheckBox();
    }
    chkUseIgnoreList = new JCheckBox();
    btnEditIgnoreList = new JButton();
    checkBoxListener = new CheckBoxListener();

    component.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
    setMnemonics();
    initIgnoreListControlComponents();
    initScopeOptionsRow(replacing);
    initInteraction();
}
 
Example 7
Project: VisualGraphviz   File: MainFrame.java   Source Code and License 6 votes vote down vote up
private void addCheckBox() {
    /* isDirected */

    directed = new JCheckBox("isDirected");
    directed.setBounds(635, 17, 125, 20);
    directed.setFont(checkBoxFont);
    directed.setMargin(DEFAULT_INSETS);

    /* hasWight */

    weight = new JCheckBox("hasWeight");
    weight.setBounds(530, 17, 100, 20);
    weight.setFont(checkBoxFont);
    weight.setMargin(DEFAULT_INSETS);
}
 
Example 8
Project: GIFKR   File: PreviewStatusPanel.java   Source Code and License 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 9
Project: incubator-netbeans   File: EditorPanelOperator.java   Source Code and License 6 votes vote down vote up
protected JPanel getOpenedPanel(EditorOperator editorOperator) {
    for (int i = 0; i < 10; i++) {
        this.panel =  findPanel((Container) editorOperator.getSource());
        if(panel!=null) break;
        new EventTool().waitNoEvent(200);
    }
    if(panel==null) return null;
    for (Component c : panel.getComponents()) {
        if (c instanceof JCheckBox) {
            checkBoxesInPanel.add((JCheckBox)c);
        } else if(c instanceof JButton) {
            buttons.add((JButton)c);
        }
    }      
    return panel;
}
 
Example 10
Project: marathonv5   File: RToggleButtonTest.java   Source Code and License 6 votes vote down vote up
public void selectCheckBoxNotSelected() throws InterruptedException {
    final LoggingRecorder lr = new LoggingRecorder();
    siw(new Runnable() {
        @Override public void run() {
            List<Component> comps = ComponentUtils.findComponents(JCheckBox.class, frame);
            JCheckBox checkBox = (JCheckBox) comps.get(3);
            RToggleButton rButton = new RToggleButton(checkBox, null, null, lr);
            checkBox.setSelected(false);
            rButton.mouseEntered(null);
            checkBox.setSelected(true);
            rButton.mouseClicked(null);
        }
    });
    Call call = lr.getCall();
    AssertJUnit.assertEquals("select", call.getFunction());
    AssertJUnit.assertEquals("true", call.getState());
}
 
Example 11
Project: KernelHive   File: ResourceMonitorPanel.java   Source Code and License 6 votes vote down vote up
/**
 *
 */
public ResourceMonitorPanel() {
	setLayout(new BorderLayout(0, 0));

	picturePanel = new JPanel();
	picturePanel.setLayout(new BoxLayout(picturePanel, BoxLayout.PAGE_AXIS));

	JScrollPane scroll = new JScrollPane(picturePanel);
	add(scroll);

	final JPanel buttonPanel = new JPanel();
	add(buttonPanel, BorderLayout.SOUTH);

	btnRefresh = new JButton("Refresh");
	buttonPanel.add(btnRefresh);

	autoRefreshCheckbox = new JCheckBox("Auto-refresh", true);
	buttonPanel.add(autoRefreshCheckbox);
}
 
Example 12
Project: xdman   File: XDMMainWindow.java   Source Code and License 6 votes vote down vote up
int getDupAction(String url) {
	JTextField txt = new JTextField(url, 30);
	String lbl = StringResource.getString("DUP_TXT");
	JComboBox choice = new JComboBox(new String[] { StringResource.getString("DUP_OP1"),
			StringResource.getString("DUP_OP2"), StringResource.getString("DUP_OP3") });
	JCheckBox chk = new JCheckBox(StringResource.getString("DUP_CHK"));
	int ret = JOptionPane.showOptionDialog(null, new Object[] { txt, lbl, choice, chk },
			StringResource.getString("DUP_TITLE"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null,
			null, null);
	if (ret == JOptionPane.OK_OPTION) {
		int index = choice.getSelectedIndex();
		if (chk.isSelected()) {
			config.duplicateLinkAction = index;
		}
		return index;
	}
	return -1;
}
 
Example 13
Project: PTEAssistant   File: UserTableHeaderCellRenderer.java   Source Code and License 6 votes vote down vote up
public UserTableHeaderCellRenderer(JTable table) {
    this.tableModel = (UserTableModel) table.getModel();
    this.tableHeader = table.getTableHeader();
    selectBox = new JCheckBox(tableModel.getColumnName(0));
    selectBox.setSelected(false);
    tableHeader.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() > 0) {
                int selectColumn = tableHeader.columnAtPoint(e.getPoint());
                if (selectColumn == 0) {
                    boolean value = !selectBox.isSelected();
                    selectBox.setSelected(value);
                    tableModel.selectAll(value);
                    tableHeader.repaint();
                }
            }
        }
    });
}
 
Example 14
Project: projetomcdonalds   File: ControlerAlteracaoLanche.java   Source Code and License 6 votes vote down vote up
public ControlerAlteracaoLanche(AlteracaoLanche alteracaoLanche, Lanche lanche, Vendas tela) {
    this.alteracaoLanche = alteracaoLanche;
    this.lanche = lanche;
    this.telaVenda = tela;

    this.alteracaoLanche.getBtn_Cancelar().addActionListener(this);
    this.alteracaoLanche.getBtn_Finalizar().addActionListener(this);
    for (JCheckBox botao : this.alteracaoLanche.getBotoes()) {
        botao.addActionListener(this);
    }

    getDados();
    iniciaCheckBox();
    marcarCheck();

    this.alteracaoLanche.setVisible(true);
    this.alteracaoLanche.toFront();
    this.alteracaoLanche.setLocationRelativeTo(this.telaVenda);
    this.alteracaoLanche.setVisible(true);
}
 
Example 15
Project: JDigitalSimulator   File: Application.java   Source Code and License 6 votes vote down vote up
private JPanel createTitlePanel() {
	JPanel title = new JPanel(new BorderLayout());
	title.add(Guitilities.createGradientTitle(getTranslation("components.title")), BorderLayout.NORTH);

	JPanel interact = new JPanel();
	interact.setBackground(UIManager.getColor(Guitilities.SUB_PANEL_BACKGROUND));
	interact.setLayout(new BoxLayout(interact, BoxLayout.X_AXIS));
	interact.setBorder(new CompoundBorder(Guitilities.CHISEL_BORDER, new EmptyBorder(12, 8, 12, 8)));
	final JCheckBox checkImages = new JCheckBox(getTranslation("group.images"), true);
	checkImages.setBackground(UIManager.getColor(Guitilities.SUB_PANEL_BACKGROUND));
	checkImages.addActionListener(new ActionListener() {
		@Override public void actionPerformed(ActionEvent event) {
			for(ComponentButton button:componentButtons)
				button.setIconVisible(checkImages.isSelected());
			for(CollapsiblePanel panel:collapsiblePanels)
				panel.setExpanded(false);
		}
	});
	interact.add(checkImages);
	title.add(interact, BorderLayout.CENTER);
	return title;
}
 
Example 16
Project: Tarski   File: SimpleGUI.java   Source Code and License 6 votes vote down vote up
/** This method performs Edit->Find. */
private Runner doFind() {
    if (wrap) return wrapMe();
    JTextField x = OurUtil.textfield(lastFind,30);
    x.selectAll();
    JCheckBox c = new JCheckBox("Case Sensitive?",lastFindCaseSensitive);
    c.setMnemonic('c');
    JCheckBox b = new JCheckBox("Search Backward?",!lastFindForward);
    b.setMnemonic('b');
    if (!OurDialog.getInput("Find", "Text:", x, " ", c, b)) return null;
    if (x.getText().length() == 0) return null;
    lastFind = x.getText();
    lastFindCaseSensitive = c.getModel().isSelected();
    lastFindForward = !b.getModel().isSelected();
    doFindNext();
    return null;
}
 
Example 17
Project: jdk8u-jdk   File: Test7024235.java   Source Code and License 6 votes vote down vote up
public void run() {
    if (this.pane == null) {
        this.pane = new JTabbedPane();
        this.pane.addTab("1", new Container());
        this.pane.addTab("2", new JButton());
        this.pane.addTab("3", new JCheckBox());

        JFrame frame = new JFrame();
        frame.add(BorderLayout.WEST, this.pane);
        frame.pack();
        frame.setVisible(true);

        test("first");
    }
    else {
        test("second");
        if (this.passed || AUTO) { // do not close a frame for manual review
            SwingUtilities.getWindowAncestor(this.pane).dispose();
        }
        this.pane = null;
    }
}
 
Example 18
Project: VASSAL-src   File: ReportState.java   Source Code and License 6 votes vote down vote up
public Ed(ReportState piece) {

      box = new JPanel();
      box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));
      descInput = new StringConfigurer(null, "Description:  ", piece.description);
      box.add(descInput.getControls());
      keys = new NamedKeyStrokeArrayConfigurer(null, "Report on these keystrokes:  ", piece.keys);
      box.add(keys.getControls());
      cycle = new JCheckBox("Cycle through different messages?");
      box.add(cycle);
      format = new PlayerIdFormattedStringConfigurer(null, "Report format:  ", new String[]{COMMAND_NAME,
                                                                                         OLD_UNIT_NAME,
                                                                                         NEW_UNIT_NAME,
                                                                                         MAP_NAME,
                                                                                         OLD_MAP_NAME,
                                                                                         LOCATION_NAME,
                                                                                         OLD_LOCATION_NAME});
      format.setValue(piece.reportFormat);
      box.add(format.getControls());
      cycleFormat = new StringArrayConfigurer(null, "Message formats", piece.cycleReportFormat);
      box.add(cycleFormat.getControls());
      cycleDownKeys = new NamedKeyStrokeArrayConfigurer(null, "Report previous message on these keystrokes:  ", piece.cycleDownKeys);
      box.add(cycleDownKeys.getControls());
      ItemListener l = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
          format.getControls().setVisible(!cycle.isSelected());
          cycleFormat.getControls().setVisible(cycle.isSelected());
          cycleDownKeys.getControls().setVisible(cycle.isSelected());
          Window w = SwingUtilities.getWindowAncestor(box);
          if (w != null) {
            w.pack();
          }
        }
      };
      l.itemStateChanged(null);
      cycle.addItemListener(l);
      cycle.setSelected(piece.cycleReportFormat.length > 0);
    }
 
Example 19
Project: A-Pathfinding-Visualization   File: ControlHandler.java   Source Code and License 5 votes vote down vote up
public JCheckBox getC(String t) {
	for(int i = 0; i < checks.size(); i++) {
		if(checks.get(i).getName().equals(t)) {
			return checks.get(i);
		}
	}
	return null;
}
 
Example 20
Project: openjdk-jdk10   File: Test4520754.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) {
    // ensure that 4168475 does not regress
    test4168475(Component.class);
    // AWT classes (com.sun.beans.infos.ComponentBeanInfo)
    test(null, Button.class, Component.class, List.class, Menu.class, Panel.class);
    // Swing classes (dt.jar)
    test(null, JApplet.class, JButton.class, JCheckBox.class);
    // user defined classes
    test(Boolean.TRUE, Wombat.class, Foo.class, FooBar.class);
}
 
Example 21
Project: gchisto   File: GUIUtilities.java   Source Code and License 5 votes vote down vote up
/**
 * It creates a new check box for inclusion in a table and sets 
 * its "is selected" attribute to the given value.
 * 
 * @param selected It determines whether the newly-created check box
 * will be selected or not.
 * @return A new check box for inclusion in a table.
 */
static public JCheckBox createJCheckBoxForTable(boolean selected) {
    JCheckBox checkBox = new JCheckBox();
    checkBox.setOpaque(true);
    checkBox.setHorizontalAlignment(SwingConstants.CENTER);
    checkBox.setForeground(TABLE_COMPONENT_FG_COLOR);
    checkBox.setBackground(TABLE_COMPONENT_BG_COLOR);
    checkBox.setSelected(selected);
    return checkBox;
}
 
Example 22
Project: Equella   File: AttachmentsSectionConfig.java   Source Code and License 5 votes vote down vote up
@Override
public void setup()
{
	showFull = new JCheckBox(s("showfullscreen"));
	showFullNewWindow = new JCheckBox(s("showfullscreen.newwindow"));
	modeStructured = new JRadioButton(s("displaymode.structured.title"));
	modeThumbnail = new JRadioButton(s("displaymode.thumbnail.title"));
	metadataTarget = new MultiTargetChooser(schemaModel, "");

	ButtonGroup bg = new ButtonGroup();
	bg.add(modeStructured);
	bg.add(modeThumbnail);

	changeDetector = new ChangeDetector();
	changeDetector.watch(showFull);
	changeDetector.watch(showFullNewWindow);
	changeDetector.watch(modeStructured);
	changeDetector.watch(modeThumbnail);
	changeDetector.watch(metadataTarget);

	setLayout(new MigLayout("wrap", "[]"));

	super.setup();

	add(new JLabel(s("fullscreen")), "gaptop 2u");
	add(showFull, "gap 2i");
	add(showFullNewWindow, "gap 2i");

	add(new JLabel(s("displaymode")), "gaptop 2u");

	add(modeStructured, "gap i*2");
	add(new JLabel("<html>" + s("displaymode.structured.description")), "gap i*4");

	add(modeThumbnail, "gap i*2");
	add(new JLabel("<html>" + s("displaymode.thumbnail.description")), "gap i*4");

	add(new JLabel(s("restrict")), "gaptop 2u, grow");
	add(new JLabel("<html>" + s("restrict.help")), "gap 2i");
	add(metadataTarget, "grow, gap 2i");
}
 
Example 23
Project: Equella   File: SearchSetInheritance.java   Source Code and License 5 votes vote down vote up
public SearchSetInheritance(final EntityCache cache, final ClientService clientService)
{
	final JLabel schemasLabel = new JLabel(
		getString("searchset.searchsetinheritance.inheritschemas")); //$NON-NLS-1$
	final JLabel itemDefsLabel = new JLabel(
		getString("searchset.searchsetinheritance.inheritcollections")); //$NON-NLS-1$

	inheritFreetext = new JCheckBox(
		getString("searchset.searchsetinheritance.inheritfreetext")); //$NON-NLS-1$
	schemasModel = new InheritedTableModel<Schema, SchemaScript>(cache.getSchemaMap(), SchemaScript.class,
		getString("searchset.searchsetinheritance.schema")); //$NON-NLS-1$
	itemDefsModel = new InheritedTableModel<ItemDefinition, ItemDefinitionScript>(cache.getItemDefinitionMap(),
		ItemDefinitionScript.class,
		getString("searchset.searchsetinheritance.collection")); //$NON-NLS-1$

	final JTable schemasTable = generateTable(schemasModel, clientService);
	final JTable itemDefTable = generateTable(itemDefsModel, clientService);

	final int height1 = inheritFreetext.getPreferredSize().height;
	final int height2 = schemasLabel.getPreferredSize().height;

	final int[] rows = {height1, height2, TableLayout.FILL, height2, TableLayout.FILL,};
	final int[] cols = {TableLayout.FILL,};

	setLayout(new TableLayout(rows, cols));

	add(inheritFreetext, new Rectangle(0, 0, 1, 1));

	add(schemasLabel, new Rectangle(0, 1, 1, 1));
	add(new JScrollPane(schemasTable), new Rectangle(0, 2, 1, 1));

	add(itemDefsLabel, new Rectangle(0, 3, 1, 1));
	add(new JScrollPane(itemDefTable), new Rectangle(0, 4, 1, 1));

	changeDetector = new ChangeDetector();
	changeDetector.watch(inheritFreetext);
	changeDetector.watch(schemasModel);
	changeDetector.watch(itemDefsModel);
}
 
Example 24
Project: sumo   File: ActionDialog.java   Source Code and License 5 votes vote down vote up
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    this.setVisible(false);
    try {
        //String[] args = new String[components.size() ];
        this.actionArgs=new HashMap<>();
        int i = 0;
        for (JComponent c : components.values()) {
            if (c instanceof JTextField) {
                //args[i++]= ((JTextField) c).getText();
                actionArgs.put(((JTextField) c).getName(), ((JTextField) c).getText());
            } else if (c instanceof JComboBox) {
                //args[i++] = ((JComboBox) c).getSelectedItem() + "";
                actionArgs.put(((JComboBox) c).getName(),  ((JComboBox) c).getSelectedItem() + "");
            }
            else if (c instanceof JCheckBox) {
               // args[i++] = ((JCheckBox) c).isSelected() + "";
                actionArgs.put(((JCheckBox) c).getName(), ((JCheckBox) c).isSelected() + "");
            }
            /* else if (c instanceof DateControl) {
                args[i++] = new Timestamp(((DateControl) c).getDate().getTime()).toString();
            }*/
        }
        ok=true;
    } catch (Exception ex) {
    	logger.error(ex.getMessage(),ex);
    	ok=false;
    }
}
 
Example 25
Project: BaseClient   File: EffectUtil.java   Source Code and License 5 votes vote down vote up
/**
 * Prompts the user for boolean value
 * 
 * @param name The name of the dialog to show
 * @param currentValue The current value to be displayed
 * @param description The help text to provide
 * @return The value selected by the user
 */
static public Value booleanValue (String name, final boolean currentValue, final String description) {
	return new DefaultValue(name, String.valueOf(currentValue)) {
		public void showDialog () {
			JCheckBox checkBox = new JCheckBox();
			checkBox.setSelected(currentValue);
			if (showValueDialog(checkBox, description)) value = String.valueOf(checkBox.isSelected());
		}

		public Object getObject () {
			return Boolean.valueOf(value);
		}
	};
}
 
Example 26
Project: Equella   File: InternalDataSourceChoice.java   Source Code and License 5 votes vote down vote up
public InternalDataSourceChoice()
{
	super(new MigLayout("wrap 1"));

	allowNewTerms = new JCheckBox(getString("internal.allownewterms"));

	add(new JLabel("<html>" + getString("internal.choicedescription")));
	add(allowNewTerms);

	changeDetector.watch(allowNewTerms);
}
 
Example 27
Project: gate-core   File: CheckBoxTableCellRenderer.java   Source Code and License 5 votes vote down vote up
public CheckBoxTableCellRenderer() {
  super();

  // centre the checkbox within the cell
  setHorizontalAlignment(JCheckBox.CENTER);

  // make sure we always paint the cell border
  setBorderPainted(true);

  // make sure we always paint the background
  setOpaque(true);
}
 
Example 28
Project: incubator-netbeans   File: DataViewUI.java   Source Code and License 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    JCheckBox source = (JCheckBox) e.getSource();
    int index = Integer.parseInt(e.getActionCommand());
    Set<Integer> currentVisibleColumns = dataPanel.getVisibleColumns();
    if (source.isSelected()) {
        currentVisibleColumns.add(index);
    } else {
        currentVisibleColumns.remove(index);
    }
    dataPanel.setVisibleColumns(currentVisibleColumns);
}
 
Example 29
Project: jaer   File: ControlPanel.java   Source Code and License 5 votes vote down vote up
void addTip(Controllable f, JCheckBox label) {
    String s = f.getPropertyTooltip(label.getText());
    if (s == null) {
        return;
    }
    label.setToolTipText(s);
    label.setForeground(Color.BLUE);
}
 
Example 30
Project: AgentWorkbench   File: TableCellRenderer4CheckBox.java   Source Code and License 5 votes vote down vote up
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
	
	JCheckBox checkBox = new JCheckBox();
	checkBox.setSelected((Boolean) value);
	checkBox.setHorizontalAlignment(SwingConstants.CENTER);
	checkBox.setOpaque(true);
	GraphGlobals.Colors.setTableCellRendererColors(checkBox, row, isSelected);
	return checkBox;
}
 
Example 31
Project: incubator-netbeans   File: DefaultFoldingOptions.java   Source Code and License 5 votes vote down vote up
private void updateChecker(String prefKey, JCheckBox cb, FoldType ft) {
    if (lastChangedCB == cb) {
        // ignore
        lastChangedCB = null;
        return;
    }
    boolean val = isCollapseEnabled(ft);
    ignoreStateChange = true;
    LOG.log(Level.FINE, "Updating checker: " + prefKey + ", setSelected " + val); // NOI18N
    cb.setSelected(val);
    ignoreStateChange = false;
}
 
Example 32
Project: Progetto-C   File: EmitterList.java   Source Code and License 5 votes vote down vote up
/**
 * @see javax.swing.DefaultListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
 */
public Component getListCellRendererComponent(JList list, final Object value, int index, boolean isSelected, boolean cellHasFocus) {
	JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
			cellHasFocus);
	
	final JCheckBox box = new JCheckBox(label.getText());
	box.setBackground(label.getBackground());
	
	box.setSelected(((ConfigurableEmitter) value).isEnabled());
	checks.put(value, box);
	
	return box;
}
 
Example 33
Project: Hollow-Knight-SaveManager   File: CharmPanel.java   Source Code and License 5 votes vote down vote up
public static List<CharmPanel> createCharmPanels(JsonObject playerData, Notches notches, JCheckBox autoCalc, JCheckBox overcharmed){
	List<CharmPanel> out = new ArrayList<CharmPanel>(); 
	for( int i = 0; i < 40; i++){
		CharmPanel charm = new CharmPanel(i, charmNames[i], playerData, notches, autoCalc, overcharmed);
		out.add(charm);
	}
	Collections.sort(out);
	return out;
}
 
Example 34
Project: Equella   File: MultiEditor.java   Source Code and License 5 votes vote down vote up
private JComponent createDetails()
{
	JLabel titleLabel = new JLabel(CurrentLocale.get("wizard.controls.title")); //$NON-NLS-1$
	JLabel descriptionLabel = new JLabel(CurrentLocale.get("wizard.controls.description")); //$NON-NLS-1$

	title = new I18nTextField(BundleCache.getLanguages());
	description = new I18nTextField(BundleCache.getLanguages());
	mandatory = new JCheckBox(CurrentLocale.get("wizard.controls.mandatory")); //$NON-NLS-1$

	final int height1 = title.getPreferredSize().height;
	final int width1 = descriptionLabel.getPreferredSize().width;

	final int[] rows = {height1, height1, height1,};
	final int[] cols = {width1, TableLayout.FILL, TableLayout.DOUBLE_FILL,};

	JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));

	all.add(titleLabel, new Rectangle(0, 0, 1, 1));
	all.add(title, new Rectangle(1, 0, 2, 1));

	all.add(descriptionLabel, new Rectangle(0, 1, 1, 1));
	all.add(description, new Rectangle(1, 1, 2, 1));

	all.add(mandatory, new Rectangle(0, 2, 2, 1));

	return all;
}
 
Example 35
Project: incubator-netbeans   File: DefaultOutlineCellRenderer.java   Source Code and License 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 36
Project: jmeter-prometheus-plugin   File: PrometheusListenerGui.java   Source Code and License 5 votes vote down vote up
protected JPanel createLabelsPanel() {
	HorizontalPanel panel = new HorizontalPanel();
	panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Labels"));
	
	this.codeCheckBox = new JCheckBox("Code");
	panel.add(this.codeCheckBox);
	
	this.labelsCheckBox = new JCheckBox("Jmeter Labels");
	panel.add(this.labelsCheckBox);
	
	this.successCheckBox = new JCheckBox("Success");
	panel.add(this.successCheckBox);
	
	return panel;
}
 
Example 37
Project: appinventor-extensions   File: AIMerger.java   Source Code and License 5 votes vote down vote up
private static JCheckBox[] getScreenCheckBoxes(AIProject project, boolean isMainProject) {
  List<AIScreen> tempScreensList = project.getScreensList();
  JCheckBox[] screenCheckBoxLabels = new JCheckBox[1 + tempScreensList.size()];
  screenCheckBoxLabels[0] = new JCheckBox("Check All");
  for (int i = 1; i <= tempScreensList.size(); i++) {
    String tempScreenName = tempScreensList.get(i - 1).getName();
    if (tempScreenName.equals("Screen1") && isMainProject) {
      screenCheckBoxLabels[i] = new JCheckBox(tempScreenName, true);
    } else {
      screenCheckBoxLabels[i] = new JCheckBox(tempScreenName);
    }
  }
  return screenCheckBoxLabels;
}
 
Example 38
Project: geomapapp   File: CustomDB.java   Source Code and License 5 votes vote down vote up
protected Component createThumbsCheckbox() {
	thumbsB = new JCheckBox("<html>Image Viewer</html>",true);
	thumbsB.setSize(45, 45);
	thumbsB.addActionListener(this);
	thumbsB.setActionCommand("thumb");
	thumbsB.setEnabled(false);
	return thumbsB;
}
 
Example 39
Project: incubator-netbeans   File: NodeTableModel.java   Source Code and License 5 votes vote down vote up
void makeAccessibleCheckBox(JCheckBox box, Property p) {
    box.getAccessibleContext().setAccessibleName(p.getDisplayName());
    box.getAccessibleContext().setAccessibleDescription(p.getShortDescription());

    Object mnemonicChar = p.getValue(ATTR_MNEMONIC_CHAR);

    if ((null != mnemonicChar) && (mnemonicChar.toString().length() > 0)) {
        box.setMnemonic(mnemonicChar.toString().charAt(0));
    }
}
 
Example 40
Project: jdk8u-jdk   File: bug8032667.java   Source Code and License 5 votes vote down vote up
static JCheckBox getCheckBox(String text, boolean selected) {
    JCheckBox checkBox = new JCheckBox(text);
    checkBox.setSelected(selected);
    checkBox.setSize(new Dimension(width, height));
    return checkBox;
}