private void resetFromFile(@NotNull VirtualFile file, @NotNull Project project) { final Module moduleForFile = ModuleUtilCore.findModuleForFile(file, project); if (moduleForFile == null) { return; } final VirtualFile parent = file.getParent(); if (parent == null) { return; } if (myModule == null) { final Object prev = myModuleCombo.getSelectedItem(); myModuleCombo.setSelectedItem(moduleForFile); if (!moduleForFile.equals(myModuleCombo.getSelectedItem())) { myModuleCombo.setSelectedItem(prev); return; } } else if (!myModule.equals(moduleForFile)) { return; } final JCheckBox checkBox = myCheckBoxes.get(parent.getName()); if (checkBox == null) { return; } for (JCheckBox checkBox1 : myCheckBoxes.values()) { checkBox1.setSelected(false); } checkBox.setSelected(true); myFileNameCombo.getEditor().setItem(file.getName()); }
/** Loads the default settings from Preferences to set up the dialog. */ public void legacyLoadDefaults() { String defaultsString = Preferences.getDialogDefaults(getDialogName()); if ((defaultsString != null) && (newImage != null)) { try { StringTokenizer st = new StringTokenizer(defaultsString, ","); textSearchWindowSide.setText("" + MipavUtil.getInt(st)); textSimilarityWindowSide.setText("" + MipavUtil.getInt(st)); textNoiseStandardDeviation.setText("" + MipavUtil.getFloat(st)); textDegree.setText("" + MipavUtil.getFloat(st)); doRician = MipavUtil.getBoolean(st); doRicianCheckBox.setSelected(doRician); textDegree.setEnabled(doRician); labelDegree.setEnabled(doRician); image25DCheckBox.setSelected(MipavUtil.getBoolean(st)); if (MipavUtil.getBoolean(st)) { newImage.setSelected(true); } else { replaceImage.setSelected(true); } } catch (Exception ex) { // since there was a problem parsing the defaults string, start over with the original // defaults Preferences.debug("Resetting defaults for dialog: " + getDialogName()); Preferences.removeProperty(getDialogName()); } } }
private void parseDirective(String directive) { if (directive == null) { System.err.println("Directive is null."); return; } String[] pair = directive.split("="); if (pair == null || pair.length != 2) { System.err.println("Unable to parse directive: \"" + directive + "\" Ignored."); return; } String key = pair[0].trim(), value = pair[1].trim(); // clean these, might have too much whitespace around commas if (validKeys.indexOf(key) == FONT || validKeys.indexOf(key) == PRELOAD) { value = value.replaceAll("[\\s]*,[\\s]*", ","); } if (validKeys.indexOf(key) == -1) { System.err.println("Directive key not recognized: \"" + key + "\" Ignored."); return; } if (value.equals("")) { System.err.println("Directive value empty. Ignored."); return; } value = value.replaceAll("^\"|\"$", "").replaceAll("^'|'$", ""); // System.out.println( key + " = " + value ); boolean v; switch (validKeys.indexOf(key)) { case CRISP: v = value.toLowerCase().equals("true"); crispBox.setSelected(v); break; case FONT: fontField.setText(value); break; case GLOBAL_KEY_EVENTS: v = value.toLowerCase().equals("true"); globalKeyEventsBox.setSelected(v); break; case PAUSE_ON_BLUR: v = value.toLowerCase().equals("true"); pauseOnBlurBox.setSelected(v); break; case PRELOAD: preloadField.setText(value); break; case TRANSPARENT: v = value.toLowerCase().equals("true"); // transparentBox.setSelected(v); break; } }
/** Update state dialog depending on the current state of the fields */ private void updateDialogState() { String branch = myBranchTextField.getText(); if (branch.length() != 0) { setOKButtonText(GitBundle.getString("unstash.button.branch")); myPopStashCheckBox.setEnabled(false); myPopStashCheckBox.setSelected(true); myReinstateIndexCheckBox.setEnabled(false); myReinstateIndexCheckBox.setSelected(true); if (!GitBranchNameValidator.INSTANCE.checkInput(branch)) { setErrorText(GitBundle.getString("unstash.error.invalid.branch.name")); setOKActionEnabled(false); return; } if (myBranches.contains(branch)) { setErrorText(GitBundle.getString("unstash.error.branch.exists")); setOKActionEnabled(false); return; } } else { if (!myPopStashCheckBox.isEnabled()) { myPopStashCheckBox.setSelected(false); } myPopStashCheckBox.setEnabled(true); setOKButtonText( myPopStashCheckBox.isSelected() ? GitBundle.getString("unstash.button.pop") : GitBundle.getString("unstash.button.apply")); if (!myReinstateIndexCheckBox.isEnabled()) { myReinstateIndexCheckBox.setSelected(false); } myReinstateIndexCheckBox.setEnabled(true); } if (myStashList.getModel().getSize() == 0) { myViewButton.setEnabled(false); myDropButton.setEnabled(false); myClearButton.setEnabled(false); setErrorText(null); setOKActionEnabled(false); return; } else { myClearButton.setEnabled(true); } if (myStashList.getSelectedIndex() == -1) { myViewButton.setEnabled(false); myDropButton.setEnabled(false); setErrorText(null); setOKActionEnabled(false); return; } else { myViewButton.setEnabled(true); myDropButton.setEnabled(true); } setErrorText(null); setOKActionEnabled(true); }
protected void customizeOptionsPanel() { if (myInsertOverrideAnnotationCheckbox != null && myIsInsertOverrideVisible) { CodeStyleSettings styleSettings = CodeStyleSettingsManager.getInstance(myProject).getCurrentSettings(); myInsertOverrideAnnotationCheckbox.setSelected(styleSettings.INSERT_OVERRIDE_ANNOTATION); } if (myCopyJavadocCheckbox != null) { myCopyJavadocCheckbox.setSelected( PropertiesComponent.getInstance().isTrueValue(PROP_COPYJAVADOC)); } }
/** Loading the values stored into configuration form */ private void loadValues() { PacketLoggingService packetLogging = LoggingUtilsActivator.getPacketLoggingService(); PacketLoggingConfiguration cfg = packetLogging.getConfiguration(); enableCheckBox.setSelected(cfg.isGlobalLoggingEnabled()); sipProtocolCheckBox.setSelected(cfg.isSipLoggingEnabled()); jabberProtocolCheckBox.setSelected(cfg.isJabberLoggingEnabled()); rtpProtocolCheckBox.setSelected(cfg.isRTPLoggingEnabled()); ice4jProtocolCheckBox.setSelected(cfg.isIce4JLoggingEnabled()); fileCountField.setText(String.valueOf(cfg.getLogfileCount())); fileSizeField.setText(String.valueOf(cfg.getLimit() / 1000)); updateButtonsState(); }
@Override public void chatLinkClicked(URI url) { String action = url.getPath(); if (action.equals("/SHOWPREVIEW")) { enableReplacement.setSelected(cfg.getBoolean(ReplacementProperty.REPLACEMENT_ENABLE, true)); enableReplacementProposal.setSelected( cfg.getBoolean(ReplacementProperty.REPLACEMENT_PROPOSAL, true)); currentMessageID = url.getQuery(); currentLinkPosition = url.getFragment(); this.setVisible(true); this.setLocationRelativeTo(chatPanel); } }
@Override public Component getTreeCellRendererComponent( JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { invalidate(); final VirtualFile file = getFile(value); final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; if (file == null) { if (value instanceof DefaultMutableTreeNode) { final Object uo = node.getUserObject(); if (uo instanceof String) { myColoredRenderer.getTreeCellRendererComponent( tree, value, selected, expanded, leaf, row, hasFocus); return myColoredRenderer; } } return myEmpty; } myCheckbox.setVisible(true); final TreeNodeState state = mySelectionManager.getState(node); myCheckbox.setEnabled( TreeNodeState.CLEAR.equals(state) || TreeNodeState.SELECTED.equals(state)); myCheckbox.setSelected(!TreeNodeState.CLEAR.equals(state)); myCheckbox.setOpaque(false); myCheckbox.setBackground(null); setBackground(null); myTextRenderer.getListCellRendererComponent(myFictive, file, 0, selected, hasFocus); revalidate(); return this; }
private JPanel getClickableTagsPanel() { JPanel pnl = new JPanel(); pnl.setLayout(new GridLayout(0, 3)); ArrayList<Commontags> listTags = new ArrayList<>(mapAllTags.values()); Collections.sort(listTags); for (final Commontags ctag : listTags) { JCheckBox cb = new JCheckBox(ctag.getText()); cb.setForeground(GUITools.getColor(ctag.getColor())); cb.setFont(ctag.getType() == 0 ? SYSConst.ARIAL12 : SYSConst.ARIAL12BOLD); cb.setSelected(listSelectedTags.contains(ctag)); cb.addItemListener( e -> { if (e.getStateChange() == ItemEvent.SELECTED) { listSelectedTags.add(ctag); add(createButton(ctag)); } else { listSelectedTags.remove(ctag); mapButtons.remove(ctag); } notifyListeners(ctag); }); pnl.add(cb); } return pnl; }
/** Show the filter dialog */ public void showDialog() { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); include_panel = new ServiceFilterPanel("Include messages based on target service:", filter_include_list); exclude_panel = new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list); status_box = new JCheckBox("Filter messages based on status:"); status_box.addActionListener(this); status_active = new JRadioButton("Active messages only"); status_active.setSelected(true); status_active.setEnabled(false); status_complete = new JRadioButton("Complete messages only"); status_complete.setEnabled(false); status_group = new ButtonGroup(); status_group.add(status_active); status_group.add(status_complete); if (filter_active || filter_complete) { status_box.setSelected(true); status_active.setEnabled(true); status_complete.setEnabled(true); if (filter_complete) { status_complete.setSelected(true); } } status_options = new JPanel(); status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS)); status_options.add(status_active); status_options.add(status_complete); status_options.setBorder(indent_border); status_panel = new JPanel(); status_panel.setLayout(new BorderLayout()); status_panel.add(status_box, BorderLayout.NORTH); status_panel.add(status_options, BorderLayout.CENTER); status_panel.setBorder(empty_border); ok_button = new JButton("Ok"); ok_button.addActionListener(this); cancel_button = new JButton("Cancel"); cancel_button.addActionListener(this); buttons = new JPanel(); buttons.setLayout(new FlowLayout()); buttons.add(ok_button); buttons.add(cancel_button); panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(include_panel); panel.add(exclude_panel); panel.add(status_panel); panel.add(buttons); dialog = new JDialog(); dialog.setTitle("SOAP Monitor Filter"); dialog.setContentPane(panel); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setModal(true); dialog.pack(); Dimension d = dialog.getToolkit().getScreenSize(); dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2); ok_pressed = false; dialog.show(); }
void checkAllProductNodes(boolean checked) { for (JCheckBox checker : checkers) { if (checker.isEnabled()) { checker.setSelected(checked); } } }
private void loadFloor() { if (currentFloor == null) return; isLoading = true; blendingCheckbox.setSelected(currentFloor.occlude); switch (previewBox.getMode()) { case RT3_GAME: gameColour.setColour(currentFloor.colour2); gameTexture.setValue(currentFloor.texture); gameName.setText(currentFloor.name); break; case RT3_MAP: gameColour.setColour(currentFloor.minimapColour); gameTexture.setValue(currentFloor.texture); gameName.setText(currentFloor.name); break; case RT4P_OVERLAY: gameColour.setColour(currentFloor.hdColour); gameTexture.setValue(currentFloor.hdTexture); // gameName.setText(currentFloor.name); break; case RT4P_UNDERLAY: gameColour.setColour(currentFloor.hdUlColour); gameTexture.setValue(currentFloor.hdUlTexture); // gameName.setText(currentFloor.name); break; } isLoading = false; previewBox.repaint(); }
/** * Creates a checkbox and sets it's value. * * @param strText either 'yes' or 'no' if yes then set the checkbox selected. */ protected JCheckBox createChkBox(String strText, JPanel pnlDisplay) { JCheckBox chkField = new JCheckBox(); boolean bSelected = (strText.equalsIgnoreCase("yes")) ? true : false; chkField.setSelected(bSelected); pnlDisplay.add(chkField); return chkField; }
private void completePanel() { if (criterion != null) { jtfCode.setText(criterion.getCode()); jtfCode.setEditable(false); jtfLibelle.setText(criterion.getLibelle()); jcbSortOrder.setSelectedIndex((criterion.getSortOrder() > 0) ? 0 : 1); jcbPlacementCriterion.setSelected(criterion.isPlacement()); jcbClassementCriterion.setSelected(criterion.isClassement()); jcbSortOrder.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); jcbPlacementCriterion.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); jcbClassementCriterion.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); } }
/** * Call this to set a custom gradle executor. We'll enable all fields appropriately and setup the * foundation settings. We'll also fire off a refresh. * * @param file the file to use as a custom executor. Null not to use one. */ private void setCustomGradleExecutor(File file) { String storagePath; boolean isUsingCustom = false; if (file == null) { isUsingCustom = false; storagePath = null; } else { isUsingCustom = true; storagePath = file.getAbsolutePath(); } // set the executor in the foundation if (gradlePluginLord.setCustomGradleExecutor(file)) { // refresh the tasks only if we actually changed the executor gradlePluginLord.addRefreshRequestToQueue(); } // set the UI values useCustomGradleExecutorCheckBox.setSelected(isUsingCustom); customGradleExecutorField.setText(storagePath); // enable the UI appropriately. browseForCustomGradleExecutorButton.setEnabled(isUsingCustom); customGradleExecutorField.setEnabled(isUsingCustom); // store the settings settingsNode.setValueOfChild(CUSTOM_GRADLE_EXECUTOR, storagePath); }
private Component createOptionsPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); onlyShowOutputOnErrorCheckBox = new JCheckBox("Only Show Output When Errors Occur"); onlyShowOutputOnErrorCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { updateShowOutputOnErrorsSetting(); settingsNode.setValueOfChildAsBoolean( SHOW_OUTPUT_ON_ERROR, onlyShowOutputOnErrorCheckBox.isSelected()); } }); // initialize its default value boolean valueAsBoolean = settingsNode.getValueOfChildAsBoolean( SHOW_OUTPUT_ON_ERROR, onlyShowOutputOnErrorCheckBox.isSelected()); onlyShowOutputOnErrorCheckBox.setSelected(valueAsBoolean); updateShowOutputOnErrorsSetting(); panel.add(Utility.addLeftJustifiedComponent(onlyShowOutputOnErrorCheckBox)); return panel; }
private void resetInterface() { for (JCheckBox b : new JCheckBox[] {crispBox, globalKeyEventsBox, pauseOnBlurBox /*, transparentBox*/}) { b.setSelected(false); } for (JTextField f : new JTextField[] {fontField, preloadField}) { f.setText(""); } }
public void setTreeActionState(Class<? extends TreeAction> action, boolean state) { final JCheckBox checkBox = myCheckBoxes.get(action); if (checkBox != null) { checkBox.setSelected(state); for (ActionListener listener : checkBox.getActionListeners()) { listener.actionPerformed(new ActionEvent(this, 1, "")); } } }
/** <code>clearActionPerformed()</code> defines for reseting all components. */ private void clearActionPerformed() { txfTitle.setText(""); txfNumber.setText(""); txfFromDate.setDate(null); txfToDate.setDate(null); txfUserName.setText(""); rdoCopyrightReq.setSelected(true); rdoNoAnswerReq.setSelected(true); rdoHasNumber.setSelected(true); chkAnswerDate.setSelected(false); chkRequestDate.setSelected(false); chkSetNumberDate.setSelected(false); txfFromDate.setEnabled(false); txfToDate.setEnabled(false); cmbDocType.setEnabled(false); userId = 0; dataFetcher.setReportObject(null); grid.refresh(); }
public JPanel getAdditionalCharacteristicsPanel(final DisplayObjectType displayObjectType) { JLabel translationFactorLabel = new JLabel("Verschiebungsfaktor: "); SpinnerModel spinnerModel = new SpinnerNumberModel(100, 0, 5000, 1); _translationFactorSpinner.setModel(spinnerModel); _translationFactorSpinner.setMaximumSize(new Dimension(60, 30)); _translationFactorSpinner.setEnabled(_dotDefinitionDialogFrame.isEditable()); JPanel translationPanel = new JPanel(); translationPanel.setLayout(new BoxLayout(translationPanel, BoxLayout.X_AXIS)); translationPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 10)); translationPanel.add(translationFactorLabel); translationPanel.add(_translationFactorSpinner); JLabel joinByLineLabel = new JLabel("Verbindungslinie: "); _joinByLineCheckBox.setSelected(false); _joinByLineCheckBox.setEnabled(_dotDefinitionDialogFrame.isEditable()); JPanel joinByLinePanel = new JPanel(); joinByLinePanel.setLayout(new BoxLayout(joinByLinePanel, BoxLayout.X_AXIS)); joinByLinePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); joinByLinePanel.add(joinByLineLabel); joinByLinePanel.add(_joinByLineCheckBox); JPanel invisiblePanel = new JPanel(); invisiblePanel.add(new JTextField()); invisiblePanel.setVisible(false); JPanel thePanel = new JPanel(); thePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); thePanel.setLayout(new SpringLayout()); thePanel.add(translationPanel); thePanel.add(joinByLinePanel); thePanel.add(invisiblePanel); SpringUtilities.makeCompactGrid(thePanel, 3, 5, 5); if (displayObjectType != null) { DOTPoint dotPoint = (DOTPoint) displayObjectType; _translationFactorSpinner.setValue(dotPoint.getTranslationFactor()); _joinByLineCheckBox.setSelected(dotPoint.isJoinByLine()); } addChangeListeners(); // Erst jetzt, denn sonst werden die Setzungen von // _translationFactorSpinner und _joinByLineCheckBox schon verarbeitet! return thePanel; }
void addBooleanComponent(String name, boolean currentValue) { configGridLayout.setRows(configGridLayout.getRows() + 1); addConfigLabel(name); JCheckBox checkBox = new JCheckBox(); checkBox.setSelected(currentValue); componentByName.put(name, checkBox); configPanel.add(checkBox); }
public void requestUpdate() { MavenArchetype selectedArch = getSelectedArchetype(); if (selectedArch == null) { selectedArch = myBuilder.getArchetype(); } if (selectedArch != null) myUseArchetypeCheckBox.setSelected(true); if (myArchetypesTree.getRowCount() == 0) updateArchetypesList(selectedArch); }
@NotNull @Override public Component getTableCellRendererComponent( @NotNull JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { myTable = table; myRow = row; myColumn = column; boolean isEnabled = true; final DefaultMutableTreeNode node = (DefaultMutableTreeNode) ((TreeTable) table).getTree().getPathForRow(row).getLastPathComponent(); Option key = null; if (node instanceof MyTreeNode) { isEnabled = ((MyTreeNode) node).isEnabled(); key = ((MyTreeNode) node).getKey(); } if (!table.isEnabled()) { isEnabled = false; } Color background = table.getBackground(); if (value instanceof Boolean) { myCheckBox.setSelected(((Boolean) value).booleanValue()); myCheckBox.setBackground(background); myCheckBox.setEnabled(isEnabled); return myCheckBox; } else if (value instanceof String) { /* myComboBox.removeAllItems(); myComboBox.addItem(value); */ myComboBox.setText((String) value); myComboBox.setBackground(background); myComboBox.setEnabled(isEnabled); return myComboBox; } else if (value instanceof Integer) { if (key instanceof IntOption && ((IntOption) key).isDefaultValue(value)) { myIntLabel.setText(((IntOption) key).getDefaultValueText()); } else { myIntLabel.setText(value.toString()); } return myIntLabel; } myCheckBox.putClientProperty("JComponent.sizeVariant", "small"); myComboBox.putClientProperty("JComponent.sizeVariant", "small"); myEmptyLabel.setBackground(background); return myEmptyLabel; }
/** * Loads the account with the given identifier. * * @param accountID the account identifier */ public void loadAccount(AccountID accountID) { enableDefaultEncryption.setSelected( accountID.getAccountPropertyBoolean(ProtocolProviderFactory.DEFAULT_ENCRYPTION, true)); Map<String, Integer> encryptionProtocols = accountID.getIntegerPropertiesByPrefix(ProtocolProviderFactory.ENCRYPTION_PROTOCOL, true); Map<String, Boolean> encryptionProtocolStatus = accountID.getBooleanPropertiesByPrefix( ProtocolProviderFactory.ENCRYPTION_PROTOCOL_STATUS, true, false); this.loadEncryptionProtocols(encryptionProtocols, encryptionProtocolStatus); enableSipZrtpAttribute.setSelected( accountID.getAccountPropertyBoolean( ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE, true)); cboSavpOption.setSelectedIndex( accountID.getAccountPropertyInt( ProtocolProviderFactory.SAVP_OPTION, ProtocolProviderFactory.SAVP_OFF)); cipherModel.loadData( accountID.getAccountPropertyString(ProtocolProviderFactory.SDES_CIPHER_SUITES)); loadStates(); }
void doReset(RunnerAndConfigurationSettings settings) { myRunConfiguration = settings.getConfiguration(); originalTasks.clear(); RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myRunConfiguration.getProject()); originalTasks.addAll(runManager.getBeforeRunTasks(myRunConfiguration)); myModel.replaceAll(originalTasks); myShowSettingsBeforeRunCheckBox.setSelected(settings.isEditBeforeRun()); myShowSettingsBeforeRunCheckBox.setEnabled(!(isUnknown())); myPanel.setVisible(checkBeforeRunTasksAbility(false)); updateText(); }
/** Constructor */ public ServiceFilterPanel(String text, Vector list) { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); service_box = new JCheckBox(text); service_box.addActionListener(this); service_data = new Vector(); if (list != null) { service_box.setSelected(true); service_data = (Vector) list.clone(); } service_list = new JList(service_data); service_list.setBorder(new EtchedBorder()); service_list.setVisibleRowCount(5); service_list.addListSelectionListener(this); service_list.setEnabled(service_box.isSelected()); service_scroll = new JScrollPane(service_list); service_scroll.setBorder(new EtchedBorder()); remove_service_button = new JButton("Remove"); remove_service_button.addActionListener(this); remove_service_button.setEnabled(false); remove_service_panel = new JPanel(); remove_service_panel.setLayout(new FlowLayout()); remove_service_panel.add(remove_service_button); service_area = new JPanel(); service_area.setLayout(new BorderLayout()); service_area.add(service_scroll, BorderLayout.CENTER); service_area.add(remove_service_panel, BorderLayout.EAST); service_area.setBorder(indent_border); add_service_field = new JTextField(); add_service_field.addActionListener(this); add_service_field.getDocument().addDocumentListener(this); add_service_field.setEnabled(service_box.isSelected()); add_service_button = new JButton("Add"); add_service_button.addActionListener(this); add_service_button.setEnabled(false); add_service_panel = new JPanel(); add_service_panel.setLayout(new BorderLayout()); JPanel dummy = new JPanel(); dummy.setBorder(empty_border); add_service_panel.add(dummy, BorderLayout.WEST); add_service_panel.add(add_service_button, BorderLayout.EAST); add_service_area = new JPanel(); add_service_area.setLayout(new BorderLayout()); add_service_area.add(add_service_field, BorderLayout.CENTER); add_service_area.add(add_service_panel, BorderLayout.EAST); add_service_area.setBorder(indent_border); setLayout(new BorderLayout()); add(service_box, BorderLayout.NORTH); add(service_area, BorderLayout.CENTER); add(add_service_area, BorderLayout.SOUTH); setBorder(empty_border); }
public BooleanField(BooleanOption option) { super(option); checkbox = new JCheckBox(); checkbox.setSelected(option.isDefault()); checkbox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { fireChangeEvent(); } }); }
/*-------------------------------------------------------------------------*/ public void refresh(Collection<FoeType> types) { if (types == null) { // select none for (JCheckBox cb : checkBoxes.values()) { cb.setSelected(false); } return; } // disable all for (JCheckBox cb : checkBoxes.values()) { cb.setSelected(false); } for (FoeType ft : types) { JCheckBox cb = checkBoxes.get(ft.getName()); if (cb == null) { // someone has deleted something continue; } cb.setSelected(true); } }
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.startsWith("start")) { discard_all = true; } else if (command.startsWith("stop")) { discard_all = false; Component[] comps = checkboxes.getComponents(); for (Component c : comps) { if (c instanceof JCheckBox) { ((JCheckBox) c).setSelected(false); } } ignoredMembers.clear(); } }
@NotNull @Override public Component getTableCellRendererComponent( @NotNull JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final RegistryValue v = ((MyTableModel) table.getModel()).getRegistryValue(row); myLabel.setIcon(null); myLabel.setText(null); myLabel.setHorizontalAlignment(SwingConstants.LEFT); Color fg = isSelected ? table.getSelectionForeground() : table.getForeground(); Color bg = isSelected ? table.getSelectionBackground() : table.getBackground(); if (v != null) { switch (column) { case 0: myLabel.setIcon(v.isRestartRequired() ? RESTART_ICON : null); myLabel.setHorizontalAlignment(SwingConstants.CENTER); break; case 1: myLabel.setText(v.getKey()); break; case 2: if (v.asColor(null) != null) { myLabel.setIcon(createColoredIcon(v.asColor(null))); } else if (v.isBoolean()) { final JCheckBox box = new JCheckBox(); box.setSelected(v.asBoolean()); box.setBackground(bg); return box; } else { myLabel.setText(v.asString()); } } myLabel.setOpaque(true); myLabel.setFont( myLabel.getFont().deriveFont(v.isChangedFromDefault() ? Font.BOLD : Font.PLAIN)); myLabel.setForeground(fg); myLabel.setBackground(bg); } return myLabel; }