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

The following examples show how to use javax.swing.JCheckBox#setSelected() . 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: CodeSetupPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, 
        boolean hasFocus, int row, int column) {
    Component ret = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    String paramName = (String) tableModel.getValueAt(row, 0);

    if (value == null) {
        return new JLabel(NbBundle.getMessage(CodeSetupPanel.class, "LBL_NotSet"));
    } else if (value instanceof Class) {
        return new JLabel(((Class) value).getName());
    } else if (value instanceof Boolean) {
        JCheckBox cb = new JCheckBox();
        cb.setHorizontalAlignment(JLabel.CENTER);
        cb.setBorderPainted(true);
        cb.setSelected((Boolean) value);
        return cb;
    } else if (paramName.contains(Constants.PASSWORD)) {
        return new JPasswordField((String) value);
    } 
    return ret;
}
 
Example 2
Source File: WebDriverConfigGui.java    From jmeter-plugins-webdriver with Apache License 2.0 6 votes vote down vote up
private JPanel createExperimentalPanel() {
    JPanel panel = new VerticalPanel();

    // LABEL
    JLabel experimentalLabel = new JLabel("EXPERIMENTAL PROPERTIES - USE AT YOUR DISCRETION");
    experimentalLabel.setFont(new Font(Font.MONOSPACED, Font.BOLD, 16));
    panel.add(experimentalLabel);

    maximizeBrowser = new JCheckBox("Maximize browser window");
    maximizeBrowser.setSelected(true);
    panel.add(maximizeBrowser);

    // EXPERIMENTAL PROPERTIES
    recreateBrowserOnIterationStart = new JCheckBox("Create a new Browser at the start of each iteration");
    recreateBrowserOnIterationStart.setSelected(false);
    panel.add(recreateBrowserOnIterationStart);

    devMode = new JCheckBox("Development Mode (keep browser opened on error)");
    devMode.setSelected(false);
    panel.add(devMode);

    return panel;
}
 
Example 3
Source File: ImageGallery.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
/**
 * create returns the thumb selector component
 *
 * @param f
 * @return
 */
private JComponent getThumbSelector(final String f) {
    final JCheckBox cb = new JCheckBox();
    cb.setText("");
    cb.setSelected(false);
    cb.setName(f);
    cb.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (cb.isSelected()) {
                selflist.add(f);
            } else {
                selflist.remove(f);
            }
        }
    });
    cb.setPreferredSize(CB_SIZE);
    return cb;

}
 
Example 4
Source File: ActionSelectorField.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
/**
 * 
 */
public ActionSelectorField(String address, List<ActionSelector> selectors) {
   label = new JCheckBox(address);
   label.setSelected(true);
   label.addActionListener((e) -> onChecked());
   for(ActionSelector selector: selectors) {
      for(FieldWrapper<?, ?> wrapper: ActionSelectorFactory.create(selector)) {
         addField(wrapper);
      }
   }
   getComponent().setName(address);
   ServiceLocator
      .getInstance(ModelController.class)
      .getName(address)
      .onSuccess((name) -> label.setText(name));
}
 
Example 5
Source File: AdvantageEditor.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
private JCheckBox createTypeCheckBox(boolean selected, String tooltip) {
    JCheckBox button = new JCheckBox();
    button.setSelected(selected);
    button.setToolTipText(Text.wrapPlainTextForToolTip(tooltip));
    button.setEnabled(mIsEditable);
    UIUtilities.setToPreferredSizeOnly(button);
    add(button);
    return button;
}
 
Example 6
Source File: EncodingTab.java    From BurpSuiteHTTPSmuggler with GNU Affero General Public License v3.0 5 votes vote down vote up
private void setValueFromExtensionSettings(JCheckBox jCheckBox, String name, Object defaultValue) {
	String value = _callbacks.loadExtensionSetting(name);
	if(value!=null && !value.equals("")) {
		boolean temp_value = Boolean.valueOf(value);
		if(temp_value!=jCheckBox.isSelected())
			jCheckBox.setSelected(temp_value);
	}else {
		jCheckBox.setSelected((boolean) defaultValue);
	}
}
 
Example 7
Source File: WebDriverConfigGui.java    From jmeter-plugins-webdriver with Apache License 2.0 5 votes vote down vote up
private void createManualProxy(JPanel panel, ButtonGroup group) {
    manualProxy = new JRadioButton("Manual proxy configuration");
    group.add(manualProxy);
    panel.add(manualProxy);

    manualProxy.addItemListener(this);

    JPanel manualPanel = new VerticalPanel();
    manualPanel.setBorder(BorderFactory.createEmptyBorder(0, PROXY_FIELD_INDENT, 0, 0));

    httpProxyHost = new JTextField();
    httpProxyPort = new JFormattedTextField(NUMBER_FORMAT);
    httpProxyPort.setText(String.valueOf(DEFAULT_PROXY_PORT));
    manualPanel.add(createProxyHostAndPortPanel(httpProxyHost, httpProxyPort, "HTTP Proxy:"));
    useHttpSettingsForAllProtocols = new JCheckBox("Use HTTP proxy server for all protocols");
    useHttpSettingsForAllProtocols.setSelected(true);
    useHttpSettingsForAllProtocols.setEnabled(false);
    useHttpSettingsForAllProtocols.addItemListener(this);
    manualPanel.add(useHttpSettingsForAllProtocols);

    httpsProxyHost = new JTextField();
    httpsProxyPort = new JFormattedTextField(NUMBER_FORMAT);
    httpsProxyPort.setText(String.valueOf(DEFAULT_PROXY_PORT));
    manualPanel.add(createProxyHostAndPortPanel(httpsProxyHost, httpsProxyPort, "SSL Proxy:"));

    ftpProxyHost = new JTextField();
    ftpProxyPort = new JFormattedTextField(NUMBER_FORMAT);
    ftpProxyPort.setText(String.valueOf(DEFAULT_PROXY_PORT));
    manualPanel.add(createProxyHostAndPortPanel(ftpProxyHost, ftpProxyPort, "FTP Proxy:"));

    socksProxyHost = new JTextField();
    socksProxyPort = new JFormattedTextField(NUMBER_FORMAT);
    socksProxyPort.setText(String.valueOf(DEFAULT_PROXY_PORT));
    manualPanel.add(createProxyHostAndPortPanel(socksProxyHost, socksProxyPort, "SOCKS Proxy:"));

    manualPanel.add(createNoProxyPanel());

    panel.add(manualPanel);
}
 
Example 8
Source File: SearchPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void init(Presenter explicitPresenter) {

        presenters = makePresenters(explicitPresenter);
        setLayout(new GridLayout(1, 1));

        if (presenters.isEmpty()) {
            throw new IllegalStateException("No presenter found");      //NOI18N
        } else if (presenters.size() == 1) {
            selectedPresenter = presenters.get(0).getPresenter();
            add(selectedPresenter.getForm());
        } else {
            tabbedPane = new JTabbedPane();
            for (PresenterProxy pp : presenters) {
                Component tab = tabbedPane.add(pp.getForm());
                if (pp.isInitialized()) {
                    tabbedPane.setSelectedComponent(tab);
                    selectedPresenter = pp.getPresenter();
                }
            }
            tabbedPane.addChangeListener(new ChangeListener() {
                @Override
                public void stateChanged(ChangeEvent e) {
                    tabChanged();
                }
            });
            add(tabbedPane);
        }
        if (selectedPresenter == null) {
            chooseLastUsedPresenter();
        }
        newTabCheckBox = new JCheckBox(NbBundle.getMessage(SearchPanel.class,
                "TEXT_BUTTON_NEW_TAB"));                                //NOI18N
        newTabCheckBox.setMaximumSize(new Dimension(1000, 200));
        newTabCheckBox.setSelected(
                FindDialogMemory.getDefault().isOpenInNewTab());
        initLocalStrings();
        initAccessibility();
    }
 
Example 9
Source File: EffectUtil.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" 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 10
Source File: CreateFromTextDialog.java    From chipster with MIT License 4 votes vote down vote up
public CreateFromTextDialog(ClientApplication clientApplication) {
    super(Session.getSession().getFrames().getMainFrame(), true);

    this.setTitle("Create dataset from text");
    this.setModal(true);
    
    // Layout
    GridBagConstraints c = new GridBagConstraints();
    this.setLayout(new GridBagLayout());
    
    // Name label
    nameLabel = new JLabel("Filename");
    c.anchor = GridBagConstraints.WEST;
    c.insets.set(10, 10, 5, 10);
    c.gridx = 0; 
    c.gridy = 0;
    this.add(nameLabel, c);
    
    // Name field
    nameField = new JTextField();
    nameField.setPreferredSize(new Dimension(150, 20));
    nameField.setText("data.txt");
    nameField.addCaretListener(this);
    c.insets.set(0,10,10,10);       
    c.gridy++;
    this.add(nameField, c);
    
    // Folder to store the file
    folderNameCombo = new JComboBox(ImportUtils.getFolderNames(true).toArray());
    folderNameCombo.setPreferredSize(new Dimension(150, 20));
    folderNameCombo.setEditable(true);
    c.insets.set(10,10,5,10);
    c.gridy++;
    this.add(new JLabel("Create in folder"), c);
    c.insets.set(0,10,10,10);
    c.gridy++;
    this.add(folderNameCombo,c);
    
    // Text label
    textLabel = new JLabel("Text");
    c.anchor = GridBagConstraints.WEST;
    c.insets.set(10, 10, 5, 10);
    c.gridy++;
    this.add(textLabel, c);
    
    // Text area
    textArea = new JTextArea();
    textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    textArea.setBorder(BorderFactory.createEmptyBorder());
    textArea.addCaretListener(this);
    JScrollPane areaScrollPane = new JScrollPane(textArea);
    areaScrollPane.setVerticalScrollBarPolicy(
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    areaScrollPane.setHorizontalScrollBarPolicy(
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    areaScrollPane.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    areaScrollPane.setPreferredSize(new Dimension(570, 300));
    c.insets.set(0,10,10,10);  
    c.gridy++;
    this.add(areaScrollPane, c);
    
    // OK button
    okButton = new JButton("OK");
    okButton.setPreferredSize(BUTTON_SIZE);
    okButton.addActionListener(this);
    
    // Cancel button
    cancelButton = new JButton("Cancel");
    cancelButton.setPreferredSize(BUTTON_SIZE);
    cancelButton.addActionListener(this);
    
    // Import checkbox
    importCheckBox = new JCheckBox("Import as plain text");
    importCheckBox.setSelected(true);
    c.insets.set(10, 10, 5, 10);
    c.gridy++;
    this.add(importCheckBox, c);
    
    // Buttons pannel
    JPanel buttonsPanel = new JPanel();
    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets.set(10, 10, 5, 10);
    c.gridy++;
    this.add(buttonsPanel, c);
    
    // Show
    this.pack();
    this.setResizable(false);
    Session.getSession().getFrames().setLocationRelativeToMainFrame(this);
    
    // Default focus
    textArea.requestFocusInWindow();
    this.setVisible(true);
}
 
Example 11
Source File: ComponentController.java    From swingsane with Apache License 2.0 4 votes vote down vote up
private void updateUsingBlackThresholdCheckBox(boolean usingDefaultBlackThreshold) {
  JCheckBox useDefaultBlackThreshold = components.getDefaultThresholdCheckBox();
  useDefaultBlackThreshold.setSelected(usingDefaultBlackThreshold);
}
 
Example 12
Source File: TabPanelResourceProcesses.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
public void initializeUI() {
		uiDone = true;
		mgr = settlement.getBuildingManager();
		buildings = mgr.getBuildings(FunctionType.RESOURCE_PROCESSING);
		size = buildings.size();

		// Prepare resource processes label panel.
		JPanel resourceProcessesLabelPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
		topContentPanel.add(resourceProcessesLabelPanel);

		// Prepare esource processes label.
		JLabel resourceProcessesLabel = new JLabel(Msg.getString("TabPanelResourceProcesses.label"), JLabel.CENTER); //$NON-NLS-1$
		resourceProcessesLabel.setFont(new Font("Serif", Font.BOLD, 16));
		//resourceProcessesLabel.setForeground(new Color(102, 51, 0)); // dark brown
		resourceProcessesLabelPanel.add(resourceProcessesLabel);

		// Create scroll panel for the outer table panel.
		processesScrollPane = new JScrollPane();
		processesScrollPane.setPreferredSize(new Dimension(220, 280));
		// increase vertical mousewheel scrolling speed for this one
		processesScrollPane.getVerticalScrollBar().setUnitIncrement(16);
		centerContentPanel.add(processesScrollPane,BorderLayout.CENTER);

		// Prepare process list panel.
		processListPanel = new JPanel(new GridLayout(0, 1, 5, 2));
//		processListPanel.setBorder(new MarsPanelBorder());
		processesScrollPane.setViewportView(processListPanel);
		populateProcessList();

		// Create override check box panel.
		JPanel overrideCheckboxPane = new JPanel(new FlowLayout(FlowLayout.CENTER));
		topContentPanel.add(overrideCheckboxPane,BorderLayout.SOUTH);

		// Create override check box.
		overrideCheckbox = new JCheckBox(Msg.getString("TabPanelResourceProcesses.checkbox.overrideResourceProcessToggling")); //$NON-NLS-1$
		overrideCheckbox.setToolTipText(Msg.getString("TabPanelResourceProcesses.tooltip.overrideResourceProcessToggling")); //$NON-NLS-1$
		overrideCheckbox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				setResourceProcessOverride(overrideCheckbox.isSelected());
			}
		});
		//overrideCheckbox.setSelected(settlement.getManufactureOverride());
		overrideCheckbox.setSelected(settlement.getResourceProcessOverride());
		overrideCheckboxPane.add(overrideCheckbox);
	}
 
Example 13
Source File: HostDialog.java    From megamek with GNU General Public License v2.0 4 votes vote down vote up
/** Constructs a host game dialog for hosting or loading a game. */
public HostDialog(JFrame frame) {
    super(frame, Messages.getString("MegaMek.HostDialog.title"), true); //$NON-NLS-1$
    JLabel yourNameL = new JLabel(
            Messages.getString("MegaMek.yourNameL"), SwingConstants.RIGHT); //$NON-NLS-1$
    JLabel serverPassL = new JLabel(
            Messages.getString("MegaMek.serverPassL"), SwingConstants.RIGHT); //$NON-NLS-1$
    JLabel portL = new JLabel(
            Messages.getString("MegaMek.portL"), SwingConstants.RIGHT); //$NON-NLS-1$
    yourNameF = new JTextField(cPrefs.getLastPlayerName(), 16);
    yourNameL.setLabelFor(yourNameF);
    yourNameF.addActionListener(this);
    serverPassF = new JTextField(cPrefs.getLastServerPass(), 16);
    serverPassL.setLabelFor(serverPassF);
    serverPassF.addActionListener(this);
    portF = new JTextField(cPrefs.getLastServerPort() + "", 4); //$NON-NLS-1$
    portL.setLabelFor(portF);
    portF.addActionListener(this);
    metaserver = cPrefs.getMetaServerName();
    JLabel metaserverL = new JLabel(
            Messages.getString("MegaMek.metaserverL"), SwingConstants.RIGHT); //$NON-NLS-1$
    metaserverF = new JTextField(metaserver);
    metaserverL.setEnabled(register);
    metaserverL.setLabelFor(metaserverF);
    metaserverF.setEnabled(register);
    registerC = new JCheckBox(Messages.getString("MegaMek.registerC")); //$NON-NLS-1$
    register = false;
    registerC.setSelected(register);
    metaserverL.setEnabled(registerC.isSelected());
    metaserverF.setEnabled(registerC.isSelected());
    registerC.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            metaserverL.setEnabled(registerC.isSelected());
            metaserverF.setEnabled(registerC.isSelected());
        }
    });
    
    JPanel middlePanel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.insets = new Insets(5, 5, 5, 5);
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.EAST;
    
    addOptionRow(middlePanel, c, yourNameL, yourNameF);
    addOptionRow(middlePanel, c, serverPassL, serverPassF);
    addOptionRow(middlePanel, c, portL, portF);
    
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.WEST;
    middlePanel.add(registerC, c);
    
    addOptionRow(middlePanel, c, metaserverL, metaserverF);
    
    add(middlePanel, BorderLayout.CENTER);  
    
    // The buttons
    JButton okayB = new JButton(new OkayAction(this));
    JButton cancelB = new ButtonEsc(new CloseAction(this));

    JPanel buttonPanel = new JPanel(new FlowLayout());
    buttonPanel.add(okayB);
    buttonPanel.add(cancelB);
    add(buttonPanel, BorderLayout.PAGE_END);
    
    pack();
    setResizable(false);
    center();
}
 
Example 14
Source File: bug8032667.java    From jdk8u_jdk with GNU General Public License v2.0 4 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;
}
 
Example 15
Source File: DevicePanel.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
protected void loadParam(JCheckBox b, String key) {
       boolean g = Config.loadGraphBooleanValue("SDR", 0, 0, device.name, key);
	Log.println("Loaded " + key + ": " + g);
	b.setSelected(g);
}
 
Example 16
Source File: SwingJideClockWidget.java    From atdl4j with MIT License 4 votes vote down vote up
@Override
protected List< ? extends Component> createBrickComponents() {
  
  List<Component> components = new ArrayList<Component>();
  
  // tooltip
     String tooltip = control.getTooltip();      
     
     if ( parameter instanceof UTCTimestampT || parameter instanceof TZTimestampT )
     {
             if (getAtdl4jOptions()==null||getAtdl4jOptions().isShowDateInputOnTimestampClockControl())
             {
                 showMonthYear = true;
                 showDay = true;
             } else {
                 showMonthYear = false;
                 showDay = false;
                 useNowAsDate = true;
             }
         showTime = true;
     }
     else if ( parameter instanceof UTCDateOnlyT || parameter instanceof LocalMktDateT )
     {
         showMonthYear = true;
         showDay = true;
         showTime = false;
     }
     else if ( parameter instanceof MonthYearT )
     {
         showMonthYear = true;
         showDay = false;
         showTime = false;
     }
     else if ( parameter == null || parameter instanceof UTCTimeOnlyT || parameter instanceof TZTimeOnlyT )
     {
         showMonthYear = false;
         showDay = false;
         showTime = true;
     }
     
     if ( getAtdl4jOptions() != null && 
         getAtdl4jOptions().isShowEnabledCheckboxOnOptionalClockControl() && 
         parameter != null && 
         UseT.OPTIONAL.equals( parameter.getUse() ) )
     {
         hasLabelOrCheckbox = true;
         enabledButton = new JCheckBox();
         enabledButton.setName(getName()+"/enablebutton");
         if (control.getLabel() != null) {
             enabledButton.setText(control.getLabel());
         }
         enabledButton.setToolTipText("Click to enable optional parameter");
         enabledButton.setSelected(false);
         enabledButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
               updateFromView();                  
             }
         });
         components.add(enabledButton);
     }       
     else if (control.getLabel() != null)
     {
         // add label
         hasLabelOrCheckbox = true;
         label = new JLabel();
         label.setName(getName()+"/label");
         label.setText(control.getLabel());
         if (tooltip != null) label.setToolTipText(tooltip);
         components.add(label);
     }
     
     // date clock
     if (showMonthYear) {
         dateClock = new DateSpinner(showDay ? "dd.MM.yyyy" : "MM.yyyy");
         dateClock.setName(getName()+"/dateclock");
         if (tooltip != null) dateClock.setToolTipText(tooltip);
         components.add(dateClock);
     }
     // time clock
     if (showTime) {
         timeClock = new DateSpinner(show24HourClock ? "HH:mm:ss" : "hh:mm:ss");
         timeClock.setName(getName()+"/timeclock");
         if (tooltip != null) timeClock.setToolTipText(tooltip);
         components.add(timeClock);
     }

     // init value, if applicable
     setAndRenderInitValue( (XMLGregorianCalendar ) ControlHelper.getInitValue( control, getAtdl4jOptions() ), ((ClockT) control).getInitValueMode() );
     
     updateFromModel();
     return components;
}
 
Example 17
Source File: ConfigurationPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setInfo(FeatureInfo info, String displayName, Collection<UpdateElement> toInstall,
            Collection<FeatureInfo.ExtraModuleInfo> missingModules,
            Map<FeatureInfo.ExtraModuleInfo, FeatureInfo> extrasMap, boolean required) {
        this.extrasFilter = new HashSet<>();
        this.featureInfo = info;
        this.featureInstall = toInstall;
        boolean activateNow = toInstall.isEmpty() && missingModules.isEmpty();
        Set<FeatureInfo.ExtraModuleInfo> extraModules = featureInfo.getExtraModules();
        Collection<? extends ModuleInfo> lookupAll = Lookup.getDefault().lookupAll(ModuleInfo.class);
        FindComponentModules findModules = new FindComponentModules(info);
        Collection<UpdateElement> modulesToInstall = findModules.getModulesForInstall();
        selectionsPanel.removeAll();
        for (FeatureInfo.ExtraModuleInfo extraModule : extraModules) {
            JCheckBox jCheckBox = new JCheckBox(extraModule.displayName());
            for (ModuleInfo moduleInfo : lookupAll) {
                if (extraModule.matches(moduleInfo.getCodeName())) {
                    jCheckBox.setText(moduleInfo.getDisplayName());
                }
            }
            
            for (UpdateElement updateElement : modulesToInstall) {
                if (extraModule.matches(updateElement.getCodeName())){
                    jCheckBox.setText(updateElement.getDisplayName());
                }
            }
            
            if (extraModule.isRequiredFor(jdk)) {
                jCheckBox.setSelected(true);
//                jCheckBox.setEnabled(false);
                extrasFilter.add(extraModule);
            }
            jCheckBox.addActionListener(e -> {
                if (jCheckBox.isSelected()) {
                    extrasFilter.add(extraModule);
                } else {
                    extrasFilter.remove(extraModule);
                }
            });
            selectionsPanel.add(jCheckBox);
        }
        if (activateNow) {
            infoLabel.setVisible(false);
            downloadLabel.setVisible(false);
            activateButton.setVisible(false);
            downloadButton.setVisible(false);
            activateButtonActionPerformed(null);
        } else {
            FeatureManager.logUI("ERGO_QUESTION", featureInfo.clusterName, displayName);
            infoLabel.setVisible(true);
            downloadLabel.setVisible(true);
            activateButton.setVisible(true);
            downloadButton.setVisible(true);
            
            // collect descriptions from features contributing installed extras
            List<String> downloadStringList = collectExtraModulesTextsFromFeatures(extrasMap.values(), required);
            String lblDownloadMsg = generateDownloadMessageFromExtraModulesTexts(downloadStringList);
            
            if (required) {
                activateButton.setEnabled(false);
            } else {
                activateButton.setEnabled(true);
            }

            if (!missingModules.isEmpty()) {
                StringBuilder sb = new StringBuilder();
                for (FeatureInfo.ExtraModuleInfo s : missingModules) {
                    if (sb.length() > 0) {
                        sb.append(", "); // NOI18N
                    }
                    sb.append(s.displayName());
                }
                String list = sb.toString();
                if (required) {
                    lblDownloadMsg = NbBundle.getMessage(ConfigurationPanel.class, "MSG_MissingRequiredModules", displayName, list);
                    activateButton.setEnabled(false);
                } else {
                    lblDownloadMsg = NbBundle.getMessage(ConfigurationPanel.class, "MSG_MissingRecommendedModules", displayName, list);
                }
                downloadButton.setEnabled(false);
            } else {
                downloadButton.setEnabled(true);
            }

            String lblActivateMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_EnableInfo", displayName);
            String btnActivateMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_Enable");
            String btnDownloadMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_Download");
            org.openide.awt.Mnemonics.setLocalizedText(infoLabel, lblActivateMsg);
            org.openide.awt.Mnemonics.setLocalizedText(activateButton, btnActivateMsg);
            org.openide.awt.Mnemonics.setLocalizedText(downloadLabel, lblDownloadMsg);
            org.openide.awt.Mnemonics.setLocalizedText(downloadButton, btnDownloadMsg);
        }
    }
 
Example 18
Source File: GrammarVizView.java    From grammarviz2_src with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a parameters pane.
 */
private void buildSAXParamsPane() {

  saxParametersPane = new JPanel();
  saxParametersPane.setBorder(BorderFactory.createTitledBorder(
      BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "SAX parameteres", TitledBorder.LEFT,
      TitledBorder.CENTER, new Font(TITLE_FONT, Font.PLAIN, 10)));

  // insets: T, L, B, R.
  MigLayout saxPaneLayout = new MigLayout("insets 3 2 2 2",
      "[][]10[][fill,grow]10[][fill,grow]10[][fill,grow]10[][]", "[]");
  saxParametersPane.setLayout(saxPaneLayout);

  // the sliding window parameter
  JLabel slideWindowLabel = new JLabel("Slide the window");
  useSlidingWindowCheckBox = new JCheckBox();
  useSlidingWindowCheckBox.setSelected(this.controller.getSession().useSlidingWindow);
  useSlidingWindowCheckBox.setActionCommand(USE_SLIDING_WINDOW_ACTION_KEY);
  useSlidingWindowCheckBox.addActionListener(this);

  windowSizeLabel = new JLabel("Window size:");
  SAXwindowSizeField = new JTextField(String.valueOf(this.controller.getSession().saxWindow));

  paaSizeLabel = new JLabel("PAA size:");
  SAXpaaSizeField = new JTextField(String.valueOf(this.controller.getSession().saxPAA));

  JLabel alphabetSizeLabel = new JLabel("Alphabet size:");
  SAXalphabetSizeField = new JTextField(String.valueOf(this.controller.getSession().saxAlphabet));

  saxParametersPane.add(slideWindowLabel);
  saxParametersPane.add(useSlidingWindowCheckBox);

  saxParametersPane.add(windowSizeLabel);
  saxParametersPane.add(SAXwindowSizeField);

  saxParametersPane.add(paaSizeLabel);
  saxParametersPane.add(SAXpaaSizeField);

  saxParametersPane.add(alphabetSizeLabel);
  saxParametersPane.add(SAXalphabetSizeField);

  guessParametersButton = new JButton("Guess");
  guessParametersButton.setMnemonic('G');
  guessParametersButton.setActionCommand(GUESS_PARAMETERS);
  guessParametersButton.addActionListener(this);
  saxParametersPane.add(guessParametersButton, "");

  // numerosity reduction pane
  //
  numerosityReductionPane = new JPanel();
  numerosityReductionPane.setBorder(BorderFactory.createTitledBorder(
      BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Numerosity reduction",
      TitledBorder.LEFT, TitledBorder.CENTER, new Font(TITLE_FONT, Font.PLAIN, 10)));

  // insets: T, L, B, R.
  MigLayout numerosityPaneLayout = new MigLayout("insets 3 2 10 2", "[]5[]5[]", "[]");
  numerosityReductionPane.setLayout(numerosityPaneLayout);

  numerosityReductionOFFButton.setActionCommand(NumerosityReductionStrategy.NONE.toString());
  numerosityButtonsGroup.add(numerosityReductionOFFButton);
  numerosityReductionOFFButton.addActionListener(this);
  numerosityReductionPane.add(numerosityReductionOFFButton);

  numerosityReductionExactButton.setActionCommand(NumerosityReductionStrategy.EXACT.toString());
  numerosityButtonsGroup.add(numerosityReductionExactButton);
  numerosityReductionExactButton.addActionListener(this);
  numerosityReductionPane.add(numerosityReductionExactButton);

  numerosityReductionMINDISTButton
      .setActionCommand(NumerosityReductionStrategy.MINDIST.toString());
  numerosityButtonsGroup.add(numerosityReductionMINDISTButton);
  numerosityReductionMINDISTButton.addActionListener(this);
  numerosityReductionPane.add(numerosityReductionMINDISTButton);

  this.controller.getSession().numerosityReductionStrategy = NumerosityReductionStrategy.EXACT;
  numerosityReductionExactButton.setSelected(true);

  // PROCESS button
  //
  discretizeButton = new JButton("Discretize");
  discretizeButton.setMnemonic('P');
  discretizeButton.setActionCommand(PROCESS_DATA);
  discretizeButton.addActionListener(this);

  discretizePane = new JPanel();
  discretizePane.setBorder(BorderFactory.createTitledBorder(
      BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Hit to run GI", TitledBorder.LEFT,
      TitledBorder.CENTER, new Font(TITLE_FONT, Font.PLAIN, 10)));
  // insets: T, L, B, R.
  MigLayout processPaneLayout = new MigLayout("insets 3 2 4 2", "5[]5", "[]");
  discretizePane.setLayout(processPaneLayout);
  discretizePane.add(discretizeButton, "");

}
 
Example 19
Source File: CustomizerTesting.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NbBundle.Messages("CustomizerTesting.testingProviders.noneInstalled=No PHP testing provider found, install one via Plugins (e.g. PHPUnit).")
private void initProvidersPanel() {
    List<PhpTestingProvider> allTestingProviders = PhpTesting.getTestingProviders();
    if (allTestingProviders.isEmpty()) {
        category.setErrorMessage(Bundle.CustomizerTesting_testingProviders_noneInstalled());
        category.setValid(true);
        return;
    }
    List<String> currentTestingProviders = uiProps.getTestingProviders();
    GroupLayout providersPanelLayout = new GroupLayout(providersPanel);
    GroupLayout.ParallelGroup horizontalGroup = providersPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
    GroupLayout.SequentialGroup verticalGroup = providersPanelLayout.createSequentialGroup();
    boolean first = true;
    final Collator collator = Collator.getInstance();
    Collections.sort(allTestingProviders, new Comparator<PhpTestingProvider>() {
        @Override
        public int compare(PhpTestingProvider provider1, PhpTestingProvider provider2) {
            return collator.compare(provider1.getDisplayName(), provider2.getDisplayName());
        }
    });
    for (PhpTestingProvider testingProvider : allTestingProviders) {
        String identifier = testingProvider.getIdentifier();
        JCheckBox checkBox = new JCheckBox(testingProvider.getDisplayName());
        checkBox.addItemListener(new TestingProviderListener(identifier));
        if (currentTestingProviders.contains(identifier)) {
            checkBox.setSelected(true);
        }
        horizontalGroup.addComponent(checkBox);
        verticalGroup.addComponent(checkBox);
        if (first) {
            first = false;
        } else {
            verticalGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
        }
    }
    providersPanel.setLayout(providersPanelLayout);
    providersPanelLayout.setHorizontalGroup(
        providersPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(providersPanelLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(horizontalGroup)
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    providersPanelLayout.setVerticalGroup(
        providersPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(verticalGroup)
    );
    // set initial message (if any)
    validateAndStore();
}
 
Example 20
Source File: GenericPanelBuilder.java    From Ardulink-2 with Apache License 2.0 4 votes vote down vote up
private static JComponent setState(JCheckBox checkBox,
		ConfigAttribute attribute) {
	checkBox.setSelected(Boolean.valueOf((Boolean) attribute.getValue()));
	return checkBox;
}