List of usage examples for javax.swing JCheckBox setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:org.forester.archaeopteryx.ControlPanel.java
void addSecondLevelJCheckBox(final JCheckBox jcb, final JPanel p) { jcb.setFocusPainted(false);/*w w w . j av a2 s. c o m*/ jcb.setFont(ControlPanel.jcb_font); if (!_configuration.isUseNativeUI()) { jcb.setBackground(ControlPanel.jcb_background_color); jcb.setForeground(ControlPanel.jcb_text_color); } Box box = Box.createHorizontalBox(); p.setBackground(background_color); box.add(Box.createRigidArea(new Dimension(12, 0))); jcb.setVisible(_color_branches_cb.isSelected()); box.add(jcb); p.add(box, "Center"); jcb.addActionListener(this); }
From source file:org.forester.archaeopteryx.ControlPanel.java
void addSecondLevelJCheckBoxWithSlider(final JCheckBox jcb, final JPanel p) { jcb.setFocusPainted(false);/*from w w w. j a v a 2s .c om*/ jcb.setFont(ControlPanel.jcb_font); if (!_configuration.isUseNativeUI()) { jcb.setBackground(ControlPanel.jcb_background_color); jcb.setForeground(ControlPanel.jcb_text_color); } Box box = Box.createHorizontalBox(); p.setBackground(background_color); box.add(Box.createRigidArea(new Dimension(12, 0))); jcb.setVisible(_color_branches_cb.isSelected()); box.add(jcb); buildJSlider(60, _slider_min, _slider_max); getColorBranchesEdplSlider().setVisible(_color_branches_cb.isSelected()); getColorBranchesEdplSlider().setEnabled(_color_branches_edpl.isSelected()); box.add(getColorBranchesEdplSlider()); p.add(box, "Center"); jcb.addActionListener(this); }
From source file:org.datacleaner.widgets.properties.MultipleInputColumnsPropertyWidget.java
@Inject public MultipleInputColumnsPropertyWidget(ComponentBuilder componentBuilder, ConfiguredPropertyDescriptor propertyDescriptor) { super(componentBuilder, propertyDescriptor); // setBorder(WidgetUtils.BORDER_LIST_ITEM); _checkBoxes = new LinkedHashMap<>(); _checkBoxDecorations = new IdentityHashMap<>(); _firstUpdate = true;/*from ww w. j a va2 s . co m*/ _dataType = propertyDescriptor.getTypeArgument(0); getAnalysisJobBuilder().addSourceColumnChangeListener(this); getAnalysisJobBuilder().addTransformerChangeListener(this); setLayout(new VerticalLayout(2)); _searchDatastoreTextField = WidgetFactory.createTextField("Search/filter columns"); _searchDatastoreTextField.setBorder( new CompoundBorder(WidgetUtils.BORDER_CHECKBOX_LIST_INDENTATION, WidgetUtils.BORDER_THIN)); _searchDatastoreTextField.getDocument().addDocumentListener(new DCDocumentListener() { @Override protected void onChange(DocumentEvent event) { String text = _searchDatastoreTextField.getText(); if (StringUtils.isNullOrEmpty(text)) { // when there is no search query, set all datastores // visible for (JCheckBox cb : _checkBoxes.values()) { cb.setVisible(true); } } else { // do a case insensitive search text = text.trim().toLowerCase(); for (JCheckBox cb : _checkBoxes.values()) { String name = cb.getText().toLowerCase(); cb.setVisible(name.contains(text)); } } } }); if (_dataType == null || _dataType == Object.class) { _notAvailableCheckBox = new DCCheckBox<>( "<html><font color=\"gray\">- no columns available -</font></html>", false); } else { _notAvailableCheckBox = new DCCheckBox<>("<html><font color=\"gray\">- no <i>" + LabelUtils.getDataTypeLabel(_dataType) + "</i> columns available -</font></html>", false); } _notAvailableCheckBox.setEnabled(false); _buttonPanel = new DCPanel(); _buttonPanel.setLayout(new HorizontalLayout(2)); _buttonPanel.setBorder(WidgetUtils.BORDER_CHECKBOX_LIST_INDENTATION); JButton selectAllButton = WidgetFactory.createDefaultButton("Select all"); selectAllButton.setFont(WidgetUtils.FONT_SMALL); selectAllButton.addActionListener(selectAllActionListener); _buttonPanel.add(selectAllButton); JButton selectNoneButton = WidgetFactory.createDefaultButton("Select none"); selectNoneButton.setFont(WidgetUtils.FONT_SMALL); selectNoneButton.addActionListener(selectNoneActionListener); _buttonPanel.add(selectNoneButton); if (propertyDescriptor.isArray()) { if (_dataType == String.class || _dataType == Object.class) { final JButton expressionColumnButton = WidgetFactory .createSmallButton(IconUtils.MODEL_COLUMN_EXPRESSION); expressionColumnButton.setToolTipText("Create expression/value based column"); expressionColumnButton .addActionListener(AddExpressionBasedColumnActionListener.forMultipleColumns(this)); _buttonPanel.add(expressionColumnButton); } final JButton reorderColumnsButton = WidgetFactory.createSmallButton(IconUtils.ACTION_REORDER_COLUMNS); reorderColumnsButton.setToolTipText("Reorder columns"); reorderColumnsButton.addActionListener(new ReorderColumnsActionListener(this)); _buttonPanel.add(reorderColumnsButton); } add(_buttonPanel); add(_searchDatastoreTextField); }
From source file:org.eobjects.datacleaner.widgets.properties.MultipleInputColumnsPropertyWidget.java
@Inject public MultipleInputColumnsPropertyWidget(AbstractBeanJobBuilder<?, ?, ?> beanJobBuilder, ConfiguredPropertyDescriptor propertyDescriptor) { super(beanJobBuilder, propertyDescriptor); setBorder(new EtchedBorder(EtchedBorder.LOWERED)); _checkBoxes = new LinkedHashMap<InputColumn<?>, DCCheckBox<InputColumn<?>>>(); _checkBoxDecorations = new IdentityHashMap<DCCheckBox<InputColumn<?>>, JComponent>(); _firstUpdate = true;//w w w . j a v a 2 s.c o m _dataType = propertyDescriptor.getTypeArgument(0); getAnalysisJobBuilder().getSourceColumnListeners().add(this); getAnalysisJobBuilder().getTransformerChangeListeners().add(this); setLayout(new VerticalLayout(2)); _searchDatastoreTextField = WidgetFactory.createTextField("Search/filter columns"); _searchDatastoreTextField.setBorder(new CompoundBorder(_indentBorder, WidgetUtils.BORDER_THIN)); _searchDatastoreTextField.getDocument().addDocumentListener(new DCDocumentListener() { @Override protected void onChange(DocumentEvent event) { String text = _searchDatastoreTextField.getText(); if (StringUtils.isNullOrEmpty(text)) { // when there is no search query, set all datastores // visible for (JCheckBox cb : _checkBoxes.values()) { cb.setVisible(true); } } else { // do a case insensitive search text = text.trim().toLowerCase(); for (JCheckBox cb : _checkBoxes.values()) { String name = cb.getText().toLowerCase(); cb.setVisible(name.indexOf(text) != -1); } } } }); _notAvailableCheckBox = new DCCheckBox<InputColumn<?>>("<html><font color=\"gray\">- no <i>" + LabelUtils.getDataTypeLabel(_dataType) + "</i> columns available -</font></html>", false); _notAvailableCheckBox.setEnabled(false); _buttonPanel = new DCPanel(); _buttonPanel.setLayout(new HorizontalLayout(2)); _buttonPanel.setBorder(_indentBorder); JButton selectAllButton = new JButton("Select all"); selectAllButton.setFont(WidgetUtils.FONT_SMALL); selectAllButton.addActionListener(selectAllActionListener); _buttonPanel.add(selectAllButton); JButton selectNoneButton = new JButton("Select none"); selectNoneButton.setFont(WidgetUtils.FONT_SMALL); selectNoneButton.addActionListener(selectNoneActionListener); _buttonPanel.add(selectNoneButton); if (propertyDescriptor.isArray()) { if (_dataType == String.class || _dataType == Object.class) { final JButton expressionColumnButton = WidgetFactory .createSmallButton(IconUtils.BUTTON_EXPRESSION_COLUMN_IMAGEPATH); expressionColumnButton.setToolTipText("Create expression/value based column"); expressionColumnButton .addActionListener(AddExpressionBasedColumnActionListener.forMultipleColumns(this)); _buttonPanel.add(expressionColumnButton); } final JButton reorderColumnsButton = WidgetFactory .createSmallButton(IconUtils.BUTTON_REORDER_COLUMN_IMAGEPATH); reorderColumnsButton.setToolTipText("Reorder columns"); reorderColumnsButton.addActionListener(new ReorderColumnsActionListener(this)); _buttonPanel.add(reorderColumnsButton); } add(_buttonPanel); add(_searchDatastoreTextField); }
From source file:org.geworkbench.components.lincs.LincsInterface.java
public LincsInterface() { final String lincsCwbFileName = this.getClass().getPackage().getName().replace(".", FilePathnameUtils.FILE_SEPARATOR) + FilePathnameUtils.FILE_SEPARATOR + "Lincs.cwb.xml"; setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); // temp do this, if data is there, then may be take out hideColumnList.add("P-value"); add(queryTypePanel);/*www.j a va 2s . c o m*/ add(queryConditionPanel1); add(queryConditionPanel2); add(queryCommandPanel); experimental.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(experimental); group.add(computational); queryTypePanel.add(new JLabel("Query Type")); queryTypePanel.add(experimental); queryTypePanel.add(computational); queryTypePanel.add(new JLabel(" ")); JLabel viewLicenseLabel = new JLabel("<html><font color=blue><u><b>View License</b></u></font></html>"); ; queryTypePanel.add(viewLicenseLabel); viewLicenseLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { viewLicense_actionPerformed(lincsCwbFileName); } }); String url = getLincsWsdlUrl(); // String url = // "http://localhost:8080/axis2/services/LincsService?wsdl"; lincs = new Lincs(url, null, null); queryConditionPanel1.setLayout(new GridLayout(2, 7)); final JLabel tissueTypeLabel = new JLabel("Tissue Type"); final JLabel cellLineLabel = new JLabel("Cell Line"); final JLabel drug1Label = new JLabel("Drug 1"); final JLabel drug2Label = new JLabel("Drug 2"); final JLabel assayTypeLabel = new JLabel("Assay Type"); final JLabel synergyMeasurementLabel = new JLabel("Synergy Measurement Type"); final JLabel similarityAlgorithmLabel = new JLabel("Similarity Algorithm"); final JLabel blankLabel = new JLabel(""); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(drug1Label); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(new JLabel("")); queryConditionPanel1.add(blankLabel); queryConditionPanel1.add(tissueTypeLabel); queryConditionPanel1.add(cellLineLabel); queryConditionPanel1.add(drug1Search); queryConditionPanel1.add(drug2Label); queryConditionPanel1.add(assayTypeLabel); queryConditionPanel1.add(synergyMeasurementLabel); queryConditionPanel1.add(new JLabel("")); queryConditionPanel2.setLayout(new GridLayout(1, 7)); List<String> tissueTypeList = null; List<String> drug1List = null; List<String> assayTypeList = null; List<String> synergyMeasuremetnTypeList = null; List<String> similarityAlgorithmList = null; try { tissueTypeList = addAll(lincs.getAllTissueNames()); drug1List = addAll(lincs.getCompound1NamesFromExperimental(null, null)); assayTypeList = addAll(lincs.getAllAssayTypeNames()); synergyMeasuremetnTypeList = addAll(lincs.getAllMeasurementTypeNames()); similarityAlgorithmList = addAll(lincs.getALLSimilarAlgorithmNames()); } catch (Exception ex) { log.error(ex.getMessage()); } tissueTypeBox = new JList(); final JScrollPane tissueTypeBoxPanel = buildJListPanel(tissueTypeList, tissueTypeBox); cellLineBox = new JList(); final JScrollPane cellLineBoxPanel = buildJListPanel(null, cellLineBox); cellLineBox.setEnabled(false); final JScrollPane drug1BoxPanel = buildFilterJListPanel(drug1List, drug1Box); drug2Box = new JList(); final JScrollPane drug2BoxPanel = buildJListPanel(null, drug2Box); drug2Box.setEnabled(false); assayTypeBox = new JList(); final JScrollPane assayTypeBoxPanel = buildJListPanel(assayTypeList, assayTypeBox); synergyMeasurementTypeBox = new JList(); final JScrollPane synergyMeasuremetnTypeBoxPanel = buildJListPanel(synergyMeasuremetnTypeList, synergyMeasurementTypeBox); similarityAlgorithmTypeBox = new JList(); final JScrollPane similarityAlgorithmTypeBoxPanel = buildJListPanel(similarityAlgorithmList, similarityAlgorithmTypeBox); onlyTitration = new JCheckBox("Only with titration"); queryConditionPanel2.add(tissueTypeBoxPanel); queryConditionPanel2.add(cellLineBoxPanel); queryConditionPanel2.add(drug1BoxPanel); queryConditionPanel2.add(drug2BoxPanel); queryConditionPanel2.add(assayTypeBoxPanel); queryConditionPanel2.add(synergyMeasuremetnTypeBoxPanel); queryConditionPanel2.add(onlyTitration); // dynamic dependency parts tissueTypeBox.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { List<String> selectedTissueList = getSelectedValues(tissueTypeBox); List<String> cellLineDataList = null; List<String> drug1DataList = null; try { cellLineDataList = addAll(lincs.getAllCellLineNamesForTissueTypes(selectedTissueList)); if (experimental.isSelected() == true) drug1DataList = addAll( lincs.getCompound1NamesFromExperimental(selectedTissueList, null)); else drug1DataList = addAll( lincs.getCompound1NamesFromComputational(selectedTissueList, null)); } catch (Exception ex) { log.error(ex.getMessage()); } if (tissueTypeBox.getSelectedValues() != null && tissueTypeBox.getSelectedValues().length > 0) cellLineBox.setModel(new LincsListModel(cellLineDataList)); else cellLineBox.setModel(new LincsListModel(null)); cellLineBox.setEnabled(true); cellLineBox.clearSelection(); drug1Box.removeAllItems(); for (int i = 0; i < drug1DataList.size(); i++) drug1Box.addItem(drug1DataList.get(i)); drug1Box.clearSelection(); drug2Box.clearSelection(); drug2Box.setModel(new LincsListModel(null)); drug2Box.setEnabled(false); cellLineBox.ensureIndexIsVisible(0); drug1Box.ensureIndexIsVisible(0); } } }); // dynamic dependency parts cellLineBox.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { List<String> selectedTissueList = getSelectedValues(tissueTypeBox); List<String> selectedCellLineList = getSelectedValues(cellLineBox); List<String> drug1DataList = null; try { if (experimental.isSelected() == true) drug1DataList = addAll(lincs.getCompound1NamesFromExperimental(selectedTissueList, selectedCellLineList)); else drug1DataList = addAll(lincs.getCompound1NamesFromComputational(selectedTissueList, selectedCellLineList)); } catch (Exception ex) { log.error(ex.getMessage()); } drug1Box.removeAllItems(); for (int i = 0; i < drug1DataList.size(); i++) drug1Box.addItem(drug1DataList.get(i)); drug1Box.ensureIndexIsVisible(0); drug1Box.clearSelection(); drug2Box.clearSelection(); drug2Box.setModel(new LincsListModel(null)); drug2Box.setEnabled(false); } } }); // dynamic dependency parts drug1Box.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { List<String> selectedTissueList = getSelectedValues(tissueTypeBox); List<String> selectedCellLineList = getSelectedValues(cellLineBox); List<String> selectedDrug1List = getSelectedValues(drug1Box); List<String> drug2DataList = null; try { if (experimental.isSelected() == true) drug2DataList = addAll(lincs.getCompound2NamesFromExperimental(selectedTissueList, selectedCellLineList, selectedDrug1List)); else drug2DataList = addAll(lincs.getCompound2NamesFromComputational(selectedTissueList, selectedCellLineList, selectedDrug1List)); } catch (Exception ex) { log.error(ex.getMessage()); } if (drug1Box.getSelectedValues() != null && drug1Box.getSelectedValues().length > 0) drug2Box.setModel(new LincsListModel(drug2DataList)); else drug2Box.setModel(new LincsListModel(null)); drug2Box.setEnabled(true); drug2Box.ensureIndexIsVisible(0); } } }); maxResult = new JCheckBox("Max results"); maxResultNumber = new JTextField("10", 10); searchButton = new JButton("Search"); resetButton = new JButton("Reset"); colorGradient = new JCheckBox("Color gradient for Score"); queryCommandPanel.add(maxResult); queryCommandPanel.add(maxResultNumber); queryCommandPanel.add(searchButton); queryCommandPanel.add(resetButton); queryCommandPanel.add(colorGradient); resultTable = new TableViewer(experimentalColumnNames, null, hideColumnList); add(resultTable); add(resultProcessingPanel); queryResultPanel.setLayout(new BorderLayout()); // queryResultPanel.add(new JScrollPane(resultTable), // BorderLayout.CENTER); plotOptions = new JComboBox(new String[] { HEATMAP, NETWORK }); JButton plotButton = new JButton("Plot"); final JCheckBox limitNetwork = new JCheckBox("Limit network to multiply-connected pairs"); limitNetwork.setEnabled(false); limitNetwork.setVisible(false); JButton exportButton = new JButton("Export"); exportButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { List<String> hideColumns = new ArrayList<String>(); hideColumns.add("Include"); TableViewer.export(resultTable.getTable(), hideColumns, resultTable); } }); resultProcessingPanel.add(new JLabel("Plot options:")); resultProcessingPanel.add(plotOptions); resultProcessingPanel.add(plotButton); resultProcessingPanel.add(limitNetwork); resultProcessingPanel.add(exportButton); plotOptions.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (plotOptions.getSelectedItem().toString().equals(HEATMAP)) { limitNetwork.setEnabled(false); } else if (plotOptions.getSelectedItem().toString().equals(NETWORK)) { limitNetwork.setEnabled(true); } } }); plotButton.addActionListener(plotListener); colorGradient.addActionListener(colorGradientListener); computational.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { queryConditionPanel1.remove(blankLabel); queryConditionPanel1.remove(assayTypeLabel); queryConditionPanel1.remove(synergyMeasurementLabel); queryConditionPanel2.remove(assayTypeBoxPanel); queryConditionPanel2.remove(synergyMeasuremetnTypeBoxPanel); queryConditionPanel1.add(similarityAlgorithmLabel, 10); queryConditionPanel2.add(similarityAlgorithmTypeBoxPanel, 4); queryConditionPanel1.updateUI(); queryConditionPanel2.updateUI(); onlyTitration.setEnabled(false); reset(); } }); experimental.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { queryConditionPanel1.remove(similarityAlgorithmLabel); queryConditionPanel2.remove(similarityAlgorithmTypeBoxPanel); queryConditionPanel1.add(blankLabel, 6); queryConditionPanel1.add(assayTypeLabel, 11); queryConditionPanel1.add(synergyMeasurementLabel, 12); queryConditionPanel2.add(assayTypeBoxPanel, 4); queryConditionPanel2.add(synergyMeasuremetnTypeBoxPanel, 5); queryConditionPanel1.updateUI(); queryConditionPanel2.updateUI(); onlyTitration.setEnabled(true); reset(); } }); searchButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int rowLimit = 0; List<String> tissueTypes = getSelectedValues(tissueTypeBox); List<String> cellLineNames = getSelectedValues(cellLineBox); List<String> drug1Names = getSelectedValues(drug1Box); List<String> drug2Names = getSelectedValues(drug2Box); if (maxResult.isSelected()) { try { rowLimit = new Integer(maxResultNumber.getText().trim()).intValue(); } catch (NumberFormatException nbe) { JOptionPane.showMessageDialog(null, "Please enter a number."); maxResultNumber.requestFocus(); return; } } if ((drug1Names == null || drug1Names.isEmpty()) && (drug2Names == null || drug2Names.isEmpty())) { JOptionPane.showMessageDialog(null, "Please select at least one drug constraint, multiple drugs can be selected."); return; } AbstractAnalysis selectedAnalysis = new LincsSearchAnalysis(); String dataSetName = null; if (experimental.isSelected()) { selectedAnalysis.setLabel("LINCS Experimental Query"); dataSetName = "LINCS Data"; } else { selectedAnalysis.setLabel("LINCS Computational Query"); dataSetName = "LINCS Data"; } final AnalysisInvokedEvent invokeEvent = new AnalysisInvokedEvent(selectedAnalysis, dataSetName); publishAnalysisInvokedEvent(invokeEvent); try { if (experimental.isSelected()) { List<String> assayTypes = getSelectedValues(assayTypeBox); List<String> measurementTypes = getSelectedValues(synergyMeasurementTypeBox); List<ExperimentalData> dataList = lincs.getExperimentalData(tissueTypes, cellLineNames, drug1Names, drug2Names, measurementTypes, assayTypes, onlyTitration.isSelected(), rowLimit); Object[][] objects = convertExperimentalData(dataList); updateResultTable(objects); } else { List<String> similarityAlgorithmTypes = getSelectedValues(similarityAlgorithmTypeBox); List<ComputationalData> dataList = lincs.getComputationalData(tissueTypes, cellLineNames, drug1Names, drug2Names, similarityAlgorithmTypes, rowLimit); Object[][] objects = convertComputationalData(dataList); updateResultTable(objects); } publishAnalysisCompleteEvent(new AnalysisCompleteEvent(invokeEvent)); } catch (Exception ex) { log.error(ex.getMessage()); publishAnalysisAbortEvent(new AnalysisAbortEvent(invokeEvent)); } if (resultTable.getData() == null || resultTable.getData().length == 0) { JOptionPane.showMessageDialog(null, "There is no row in the database for your query.", "Empty Set", JOptionPane.INFORMATION_MESSAGE); return; } freeVariables = getFreeVariables(); } }); resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); }
From source file:org.yccheok.jstock.gui.StockJDialog.java
private void initBoardCheckBoxes() { final JStock m = JStock.instance(); final StockInfoDatabase stockInfoDatabase = m.getStockInfoDatabase(); boardCheckBoxes.add(jCheckBox1);// w w w. j a va2 s. c o m boardCheckBoxes.add(jCheckBox2); boardCheckBoxes.add(jCheckBox21); boardCheckBoxes.add(jCheckBox3); boardCheckBoxes.add(jCheckBox4); boardCheckBoxes.add(jCheckBox23); boardCheckBoxes.add(jCheckBox25); boardCheckBoxes.add(jCheckBox26); boardCheckBoxes.add(jCheckBox27); for (JCheckBox checkBox : boardCheckBoxes) { checkBox.setVisible(false); } java.util.List<Board> sortedBoards = stockInfoDatabase.getBoards(); Collections.sort(sortedBoards); int count = 0; for (Board board : sortedBoards) { if (count >= boardCheckBoxes.size()) { log.error("You do not have enough check box components (" + boardCheckBoxes.size() + ") to hold board (" + sortedBoards.size() + ")"); break; } javax.swing.JCheckBox checkBox = boardCheckBoxes.get(count++); checkBox.setText(board.toString()); checkBox.setVisible(true); checkBoxToBoard.put(checkBox, board); } }
From source file:org.yccheok.jstock.gui.StockJDialog.java
private void initIndustryCheckBoxes() { final JStock m = JStock.instance(); final StockInfoDatabase stockInfoDatabase = m.getStockInfoDatabase(); industryCheckBoxes.add(jCheckBox5);//ww w.ja v a2s. co m industryCheckBoxes.add(jCheckBox7); industryCheckBoxes.add(jCheckBox9); industryCheckBoxes.add(jCheckBox6); industryCheckBoxes.add(jCheckBox8); industryCheckBoxes.add(jCheckBox10); industryCheckBoxes.add(jCheckBox11); industryCheckBoxes.add(jCheckBox12); industryCheckBoxes.add(jCheckBox13); industryCheckBoxes.add(jCheckBox14); industryCheckBoxes.add(jCheckBox15); industryCheckBoxes.add(jCheckBox16); industryCheckBoxes.add(jCheckBox17); industryCheckBoxes.add(jCheckBox18); industryCheckBoxes.add(jCheckBox22); industryCheckBoxes.add(jCheckBox19); industryCheckBoxes.add(jCheckBox20); industryCheckBoxes.add(jCheckBox24); for (JCheckBox checkBox : industryCheckBoxes) { checkBox.setVisible(false); } java.util.List<Industry> sortedIndustries = stockInfoDatabase.getIndustries(); Collections.sort(sortedIndustries); int count = 0; for (Industry industry : sortedIndustries) { if (count >= industryCheckBoxes.size()) { log.error("You do not have enough check box components (" + industryCheckBoxes.size() + ") to hold industry (" + sortedIndustries.size() + ")"); break; } javax.swing.JCheckBox checkBox = industryCheckBoxes.get(count++); checkBox.setText(industry.toString()); checkBox.setVisible(true); checkBoxToIndustry.put(checkBox, industry); } }
From source file:org.yccheok.jstock.gui.WizardSelectStockJPanel.java
private void initBoardCheckBoxes(StockInfoDatabase stockInfoDatabase) { boardCheckBoxes.add(jCheckBox1);/*from w w w. ja va2 s . c o m*/ boardCheckBoxes.add(jCheckBox2); boardCheckBoxes.add(jCheckBox21); boardCheckBoxes.add(jCheckBox3); boardCheckBoxes.add(jCheckBox4); boardCheckBoxes.add(jCheckBox23); boardCheckBoxes.add(jCheckBox25); boardCheckBoxes.add(jCheckBox26); boardCheckBoxes.add(jCheckBox27); for (JCheckBox checkBox : boardCheckBoxes) { checkBox.setVisible(false); } java.util.List<Board> sortedBoards = stockInfoDatabase.getBoards(); Collections.sort(sortedBoards); int count = 0; for (Board board : sortedBoards) { if (count >= boardCheckBoxes.size()) { log.error("You do not have enough check box components (" + boardCheckBoxes.size() + ") to hold board (" + sortedBoards.size() + ")"); break; } javax.swing.JCheckBox checkBox = boardCheckBoxes.get(count++); checkBox.setText(board.toString()); checkBox.setVisible(true); checkBoxToBoard.put(checkBox, board); } }
From source file:org.yccheok.jstock.gui.WizardSelectStockJPanel.java
private void initIndustryCheckBoxes(StockInfoDatabase stockInfoDatabase) { industryCheckBoxes.add(jCheckBox5);/*from w ww . j a v a2 s .c o m*/ industryCheckBoxes.add(jCheckBox7); industryCheckBoxes.add(jCheckBox9); industryCheckBoxes.add(jCheckBox6); industryCheckBoxes.add(jCheckBox8); industryCheckBoxes.add(jCheckBox10); industryCheckBoxes.add(jCheckBox11); industryCheckBoxes.add(jCheckBox12); industryCheckBoxes.add(jCheckBox13); industryCheckBoxes.add(jCheckBox14); industryCheckBoxes.add(jCheckBox15); industryCheckBoxes.add(jCheckBox16); industryCheckBoxes.add(jCheckBox17); industryCheckBoxes.add(jCheckBox18); industryCheckBoxes.add(jCheckBox22); industryCheckBoxes.add(jCheckBox19); industryCheckBoxes.add(jCheckBox20); industryCheckBoxes.add(jCheckBox24); for (JCheckBox checkBox : industryCheckBoxes) { checkBox.setVisible(false); } java.util.List<Industry> sortedIndustries = stockInfoDatabase.getIndustries(); Collections.sort(sortedIndustries); int count = 0; for (Industry industry : sortedIndustries) { if (count >= industryCheckBoxes.size()) { log.error("You do not have enough check box components (" + industryCheckBoxes.size() + ") to hold industry (" + sortedIndustries.size() + ")"); break; } javax.swing.JCheckBox checkBox = industryCheckBoxes.get(count++); checkBox.setText(industry.toString()); checkBox.setVisible(true); checkBoxToIndustry.put(checkBox, industry); } }