List of usage examples for javax.swing JComboBox setSelectedIndex
@BeanProperty(bound = false, preferred = true, description = "The item at index is selected.") public void setSelectedIndex(int anIndex)
anIndex
. From source file:TableSelectionDemo.java
public TableSelectionDemo() { super(new BorderLayout()); String[] columnNames = { "French", "Spanish", "Italian" }; String[][] tableData = { { "un", "uno", "uno" }, { "deux", "dos", "due" }, { "trois", "tres", "tre" }, { "quatre", "cuatro", "quattro" }, { "cinq", "cinco", "cinque" }, { "six", "seis", "sei" }, { "sept", "siete", "sette" } }; table = new JTable(tableData, columnNames); listSelectionModel = table.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); table.setSelectionModel(listSelectionModel); JScrollPane tablePane = new JScrollPane(table); // Build control area (use default FlowLayout). JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); }//w w w .ja v a 2 s. c o m output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); // Build output area. output = new JTextArea(1, 10); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); // Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); JPanel tableContainer = new JPanel(new GridLayout(1, 1)); tableContainer.setBorder(BorderFactory.createTitledBorder("Table")); tableContainer.add(tablePane); tablePane.setPreferredSize(new Dimension(420, 130)); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(250, 50)); topHalf.setPreferredSize(new Dimension(200, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.PAGE_START); bottomHalf.add(outputPane, BorderLayout.CENTER); // XXX: next line needed if bottomHalf is a scroll pane: // bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 110)); splitPane.add(bottomHalf); }
From source file:SwingThreadTest.java
public SwingThreadFrame() { setTitle("SwingThreadTest"); final JComboBox combo = new JComboBox(); combo.insertItemAt(Integer.MAX_VALUE, 0); combo.setPrototypeDisplayValue(combo.getItemAt(0)); combo.setSelectedIndex(0); JPanel panel = new JPanel(); JButton goodButton = new JButton("Good"); goodButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { new Thread(new GoodWorkerRunnable(combo)).start(); }//from www . j av a 2 s .c o m }); panel.add(goodButton); JButton badButton = new JButton("Bad"); badButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { new Thread(new BadWorkerRunnable(combo)).start(); } }); panel.add(badButton); panel.add(combo); add(panel); pack(); }
From source file:SimpleDateFormatDemo.java
public SimpleDateFormatDemo() { today = new Date(); availableLocales = new LocaleGroup(); String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z", "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" }; currentPattern = patternExamples[0]; // Set up the UI for selecting a pattern. JLabel patternLabel1 = new JLabel("Enter the pattern string or"); JLabel patternLabel2 = new JLabel("select one from the list:"); patternLabel1.setAlignmentX(Component.LEFT_ALIGNMENT); patternLabel2.setAlignmentX(Component.LEFT_ALIGNMENT); JComboBox patternList = new JComboBox(patternExamples); patternList.setSelectedIndex(0); patternList.setEditable(true);//from w w w.j av a2 s . com patternList.setAlignmentX(Component.LEFT_ALIGNMENT); PatternListener patternListener = new PatternListener(); patternList.addActionListener(patternListener); // Set up the UI for selecting a locale. JLabel localeLabel = new JLabel("Select a Locale from the list:"); localeLabel.setAlignmentX(Component.LEFT_ALIGNMENT); JComboBox localeList = new JComboBox(availableLocales.getStrings()); localeList.setSelectedIndex(0); localeList.setAlignmentX(Component.LEFT_ALIGNMENT); LocaleListener localeListener = new LocaleListener(); localeList.addActionListener(localeListener); // Create the UI for displaying result JLabel resultLabel = new JLabel("Current Date and Time", JLabel.LEFT); resultLabel.setAlignmentX(Component.LEFT_ALIGNMENT); result = new JLabel(" "); result.setForeground(Color.black); result.setAlignmentX(Component.LEFT_ALIGNMENT); result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // Lay out everything JPanel patternPanel = new JPanel(); patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.Y_AXIS)); patternPanel.add(patternLabel1); patternPanel.add(patternLabel2); patternPanel.add(patternList); JPanel localePanel = new JPanel(); localePanel.setLayout(new BoxLayout(localePanel, BoxLayout.Y_AXIS)); localePanel.add(localeLabel); localePanel.add(localeList); JPanel resultPanel = new JPanel(); resultPanel.setLayout(new GridLayout(0, 1)); resultPanel.add(resultLabel); resultPanel.add(result); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); patternPanel.setAlignmentX(Component.CENTER_ALIGNMENT); localePanel.setAlignmentX(Component.CENTER_ALIGNMENT); resultPanel.setAlignmentX(Component.CENTER_ALIGNMENT); add(patternPanel); add(Box.createVerticalStrut(10)); add(localePanel); add(Box.createVerticalStrut(10)); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); reformat(); }
From source file:ComboBoxWithItemChangedListener.java
public ComboPanel() { final JComboBox combo = new JComboBox(treasure); combo.setMaximumRowCount(5);//from w w w . jav a 2s . c o m combo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { System.out.println("Combo: " + combo.getSelectedItem()); } }); combo.setSelectedIndex(4); add(combo); }
From source file:org.kineticsystem.commons.data.demo.panels.AggregationChartPane.java
/** * Constructor.//from www .ja v a 2s . c o m * @param source This is the source list being modified ate the same time * by many threads. */ public AggregationChartPane(ActiveList<RandomContact> source) { // Define aggregators. GroupAggregator[] aggregators = new GroupAggregator[] { new ContactsPerContinentAggr(), new AvgAgePerContinentAggr(), new MaxAgePerContinentAggr(), new MinAgePerContinentAggr() }; // Aggregator selector. DefaultComboBoxModel groupComboModel = new DefaultComboBoxModel(aggregators); final JComboBox groupCombo = new JComboBox(groupComboModel); groupCombo.setSelectedIndex(1); groupCombo.setToolTipText("Select an aggregation function."); // Create the dataset. dataset = new DefaultCategoryDataset(); List<Country> countries = RandomContactGenerator.getCountries(); Set<String> continents = new TreeSet<String>(); for (Country country : countries) { continents.add(country.getContinent()); } for (String continent : continents) { dataset.setValue(0, continent, ""); } // Define the aggregated list. groups = new GroupMapping<RandomContact>(source); groups.setAggregator(aggregators[0]); groups.getTarget().addActiveListListener(this); // Create the chart. JFreeChart chart = ChartFactory.createBarChart("", "Continent", groups.getAggregator().toString(), dataset, PlotOrientation.VERTICAL, true, // legend? true, // tooltips? false // URLs? ); final ValueAxis axis = chart.getCategoryPlot().getRangeAxis(); axis.setAutoRange(true); axis.setRange(0, 250); ChartPanel chartPanel = new ChartPanel(chart); // Create the selector. ActionListener groupComboListener = new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); GroupAggregator aggr = (GroupAggregator) cb.getSelectedItem(); groups.setAggregator(aggr); axis.setLabel(aggr.toString()); } }; groupCombo.addActionListener(groupComboListener); // Layout the GUI. Cell cell = new Cell(); TetrisLayout groupTableLayout = new TetrisLayout(2, 1); groupTableLayout.setRowWeight(0, 0); groupTableLayout.setRowWeight(1, 100); setLayout(groupTableLayout); add(groupCombo, cell); add(chartPanel, cell); }
From source file:Main.java
public void actionPerformed(ActionEvent e) { JComboBox jcb = (JComboBox) e.getSource(); System.out.println("down action"); ComboBoxUI ui = jcb.getUI();// w w w .j ava2 s .co m if (ui.isPopupVisible(jcb)) { int i = jcb.getSelectedIndex(); if (i < jcb.getModel().getSize() - 1) { jcb.setSelectedIndex(i + 1); jcb.repaint(); } } else { int nItems = jcb.getItemCount(); ComboBoxEditor cbe = jcb.getEditor(); String st; // Search text st = ((String) cbe.getItem()).toUpperCase(); for (int i = 0; i < nItems; i++) { String item = ((String) jcb.getItemAt(i)).toUpperCase(); if (item.startsWith(st)) { jcb.setSelectedIndex(i); break; } } ui.setPopupVisible(jcb, true); } }
From source file:DecimalFormatDemo.java
public DecimalFormatDemo() { availableLocales = new LocaleGroup(); inputFormatter = NumberFormat.getNumberInstance(); String[] patternExamples = { "##.##", "###,###.##", "##,##,##.##", "#", "000,000.0000", "##.0000", "'hello'###.##" }; currentPattern = patternExamples[0]; // Set up the UI for entering a number. JLabel numberLabel = new JLabel("Enter the number to format:"); numberLabel.setAlignmentX(Component.LEFT_ALIGNMENT); JTextField numberField = new JTextField(); numberField.setEditable(true);//from w w w . j av a2 s . c om numberField.setAlignmentX(Component.LEFT_ALIGNMENT); NumberListener numberListener = new NumberListener(); numberField.addActionListener(numberListener); // Set up the UI for selecting a pattern. JLabel patternLabel1 = new JLabel("Enter the pattern string or"); JLabel patternLabel2 = new JLabel("select one from the list:"); patternLabel1.setAlignmentX(Component.LEFT_ALIGNMENT); patternLabel2.setAlignmentX(Component.LEFT_ALIGNMENT); JComboBox patternList = new JComboBox(patternExamples); patternList.setSelectedIndex(0); patternList.setEditable(true); patternList.setAlignmentX(Component.LEFT_ALIGNMENT); PatternListener patternListener = new PatternListener(); patternList.addActionListener(patternListener); // Set up the UI for selecting a locale. JLabel localeLabel = new JLabel("Select a Locale from the list:"); localeLabel.setAlignmentX(Component.LEFT_ALIGNMENT); JComboBox localeList = new JComboBox(availableLocales.getStrings()); localeList.setSelectedIndex(0); localeList.setAlignmentX(Component.LEFT_ALIGNMENT); LocaleListener localeListener = new LocaleListener(); localeList.addActionListener(localeListener); // Create the UI for displaying result. JLabel resultLabel = new JLabel("Result", JLabel.LEFT); resultLabel.setAlignmentX(Component.LEFT_ALIGNMENT); result = new JLabel(" "); result.setForeground(Color.black); result.setAlignmentX(Component.LEFT_ALIGNMENT); result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // Lay out everything JPanel numberPanel = new JPanel(); numberPanel.setLayout(new GridLayout(0, 1)); numberPanel.add(numberLabel); numberPanel.add(numberField); JPanel patternPanel = new JPanel(); patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.Y_AXIS)); patternPanel.add(patternLabel1); patternPanel.add(patternLabel2); patternPanel.add(patternList); JPanel localePanel = new JPanel(); localePanel.setLayout(new BoxLayout(localePanel, BoxLayout.Y_AXIS)); localePanel.add(localeLabel); localePanel.add(localeList); JPanel resultPanel = new JPanel(); resultPanel.setLayout(new GridLayout(0, 1)); resultPanel.add(resultLabel); resultPanel.add(result); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); patternPanel.setAlignmentX(Component.CENTER_ALIGNMENT); numberPanel.setAlignmentX(Component.CENTER_ALIGNMENT); localePanel.setAlignmentX(Component.CENTER_ALIGNMENT); resultPanel.setAlignmentX(Component.CENTER_ALIGNMENT); add(numberPanel); add(Box.createVerticalStrut(10)); add(patternPanel); add(Box.createVerticalStrut(10)); add(localePanel); add(Box.createVerticalStrut(10)); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); reformat(); numberField.setText(result.getText()); }
From source file:components.SharedModelDemo.java
public SharedModelDemo() { super(new BorderLayout()); Vector data = new Vector(7); String[] columnNames = { "French", "Spanish", "Italian" }; String[] oneData = { "un", "uno", "uno" }; String[] twoData = { "deux", "dos", "due" }; String[] threeData = { "trois", "tres", "tre" }; String[] fourData = { "quatre", "cuatro", "quattro" }; String[] fiveData = { "cinq", "cinco", "cinque" }; String[] sixData = { "six", "seis", "sei" }; String[] sevenData = { "sept", "siete", "sette" }; //Build the model. SharedDataModel dataModel = new SharedDataModel(columnNames); dataModel.addElement(oneData);//w w w . jav a 2 s .c o m dataModel.addElement(twoData); dataModel.addElement(threeData); dataModel.addElement(fourData); dataModel.addElement(fiveData); dataModel.addElement(sixData); dataModel.addElement(sevenData); list = new JList(dataModel); list.setCellRenderer(new DefaultListCellRenderer() { public Component getListCellRendererComponent(JList l, Object value, int i, boolean s, boolean f) { String[] array = (String[]) value; return super.getListCellRendererComponent(l, array[0], i, s, f); } }); listSelectionModel = list.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); JScrollPane listPane = new JScrollPane(list); table = new JTable(dataModel); table.setSelectionModel(listSelectionModel); JScrollPane tablePane = new JScrollPane(table); //Build control area (use default FlowLayout). JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); //Build output area. output = new JTextArea(10, 40); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); //Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.X_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); listContainer.setBorder(BorderFactory.createTitledBorder("List")); listContainer.add(listPane); JPanel tableContainer = new JPanel(new GridLayout(1, 1)); tableContainer.setBorder(BorderFactory.createTitledBorder("Table")); tableContainer.add(tablePane); tablePane.setPreferredSize(new Dimension(300, 100)); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(400, 50)); topHalf.setPreferredSize(new Dimension(400, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.NORTH); bottomHalf.add(outputPane, BorderLayout.CENTER); //XXX: next line needed if bottomHalf is a scroll pane: //bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 135)); splitPane.add(bottomHalf); }
From source file:com.game.ui.views.WeaponEditorPanel.java
public void doGui() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel( "<html><div style='width : 500px;'>Pls select a value to choose an Weapon or you can create a new " + "Weapon entity below. Once selected a weapon, its' details will be available below</div></html>"); noteLbl.setAlignmentX(0);//from w w w .j a v a2 s.c om add(noteLbl); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (Item item : GameBean.weaponDetails) { if (item instanceof Weapon) { model.addElement(((Weapon) item).getName()); } } comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setAlignmentX(0); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); add(Box.createVerticalStrut(10)); add(comboBox); add(Box.createVerticalStrut(10)); JPanel panel1 = new JPanel(); panel1.setAlignmentX(0); panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel1.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 1; c.gridwidth = 2; JLabel weaponDtsLbl = new JLabel("Weapon Details : "); weaponDtsLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); panel1.add(weaponDtsLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); panel1.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); panel1.add(name, c); c.gridx = 0; c.gridy = 2; JLabel weaponTypeLbl = new JLabel("Weapon Type : "); panel1.add(weaponTypeLbl, c); c.gridx = 1; JComboBox weaponType = new JComboBox(Configuration.weaponTypes); weaponType.setSelectedIndex(0); weaponType.setPreferredSize(name.getPreferredSize()); System.out.println(name.getPreferredSize()); panel1.add(weaponType, c); c.gridx = 0; c.gridy = 3; JLabel attackRangeLbl = new JLabel("Attack Range : "); panel1.add(attackRangeLbl, c); c.gridx = 1; JTextField attackRange = new JTextField(""); attackRange.setColumns(20); panel1.add(attackRange, c); c.gridx = 0; c.gridy = 4; JLabel attackPtsLbl = new JLabel("Attack Points : "); panel1.add(attackPtsLbl, c); c.gridx = 1; JTextField attackPts = new JTextField(""); attackPts.setColumns(20); panel1.add(attackPts, c); c.gridx = 0; c.gridy = 5; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); panel1.add(submit, c); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.weighty = 0; c.weightx = 1; validationMess = new JLabel("Pls enter all the fields or pls choose a weapon from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); panel1.add(validationMess, c); // c.fill = GridBagConstraints.BOTH; // c.gridy = 7; // c.weightx = 1; // c.weighty = 1; // panel1.add(new JLabel(""), c); panel1.setBorder(LineBorder.createGrayLineBorder()); add(panel1); add(Box.createVerticalGlue()); }
From source file:lu.lippmann.cdb.datasetview.tabs.ScatterPlotTabView.java
private void update0(final Instances dataSet, int xidx, int yidx, int coloridx, final boolean asSerie) { System.out.println(xidx + " " + yidx); this.panel.removeAll(); if (xidx == -1) xidx = 0;/* w w w . j av a 2s . c om*/ if (yidx == -1) yidx = 1; if (coloridx == -1) coloridx = 0; final Object[] numericAttrNames = WekaDataStatsUtil.getNumericAttributesNames(dataSet).toArray(); final JComboBox xCombo = new JComboBox(numericAttrNames); xCombo.setBorder(new TitledBorder("x")); xCombo.setSelectedIndex(xidx); final JComboBox yCombo = new JComboBox(numericAttrNames); yCombo.setBorder(new TitledBorder("y")); yCombo.setSelectedIndex(yidx); final JCheckBox jcb = new JCheckBox("Draw lines"); jcb.setSelected(asSerie); final JComboBox colorCombo = new JComboBox(numericAttrNames); colorCombo.setBorder(new TitledBorder("color")); colorCombo.setSelectedIndex(coloridx); colorCombo.setVisible(dataSet.classIndex() < 0); xCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update0(dataSet, xCombo.getSelectedIndex(), yCombo.getSelectedIndex(), colorCombo.getSelectedIndex(), jcb.isSelected()); } }); yCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update0(dataSet, xCombo.getSelectedIndex(), yCombo.getSelectedIndex(), colorCombo.getSelectedIndex(), jcb.isSelected()); } }); colorCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update0(dataSet, xCombo.getSelectedIndex(), yCombo.getSelectedIndex(), colorCombo.getSelectedIndex(), jcb.isSelected()); } }); jcb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update0(dataSet, xCombo.getSelectedIndex(), yCombo.getSelectedIndex(), colorCombo.getSelectedIndex(), jcb.isSelected()); } }); final JXPanel comboPanel = new JXPanel(); comboPanel.setLayout(new GridLayout(1, 0)); comboPanel.add(xCombo); comboPanel.add(yCombo); comboPanel.add(colorCombo); comboPanel.add(jcb); this.panel.add(comboPanel, BorderLayout.NORTH); final java.util.List<Integer> numericAttrIdx = WekaDataStatsUtil.getNumericAttributesIndexes(dataSet); final ChartPanel scatterplotChartPanel = buildChartPanel(dataSet, numericAttrIdx.get(xidx), numericAttrIdx.get(yidx), numericAttrIdx.get(coloridx), asSerie); this.panel.add(scatterplotChartPanel, BorderLayout.CENTER); this.panel.repaint(); this.panel.updateUI(); }