List of usage examples for weka.gui AttributeSummaryPanel AttributeSummaryPanel
public AttributeSummaryPanel()
From source file:meka.gui.explorer.PreprocessTab.java
License:Open Source License
/** * Initializes the widgets.//from ww w .j ava 2s. c o m */ @Override protected void initGUI() { JPanel panel; JPanel panelLeft; JPanel panelRight; super.initGUI(); panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createTitledBorder("Filter")); add(panel, BorderLayout.NORTH); panel.add(m_GenericObjectEditor.getCustomPanel(), BorderLayout.CENTER); m_ButtonApplyFilter = new JButton("Apply"); m_ButtonApplyFilter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getOwner().addUndoPoint(); filterData((Filter) m_GenericObjectEditor.getValue(), null); } }); panel.add(m_ButtonApplyFilter, BorderLayout.EAST); // split view m_PanelSplit = new JPanel(new GridLayout(1, 2)); add(m_PanelSplit, BorderLayout.CENTER); panelLeft = new JPanel(new BorderLayout()); panelRight = new JPanel(new BorderLayout()); m_PanelSplit.add(panelLeft); m_PanelSplit.add(panelRight); // left view m_PanelDataSummary = new InstancesSummaryPanel(); m_PanelDataSummary.setBorder(BorderFactory.createTitledBorder("Current data set")); panelLeft.add(m_PanelDataSummary, BorderLayout.NORTH); panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createTitledBorder("Attributes")); panelLeft.add(panel, BorderLayout.CENTER); m_PanelAttributes = new AttributeSelectionPanel(); m_PanelAttributes.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; ListSelectionModel lm = (ListSelectionModel) e.getSource(); for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) { if (lm.isSelectedIndex(i)) { m_PanelAttributeSummary.setAttribute(i); break; } } } }); panel.add(m_PanelAttributes, BorderLayout.CENTER); m_ButtonRemoveAttributes = new JButton("Remove"); m_ButtonRemoveAttributes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeAttributes(); } }); panel.add(m_ButtonRemoveAttributes, BorderLayout.SOUTH); // right view panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createTitledBorder("Classes")); panelRight.add(panel, BorderLayout.NORTH); m_PanelClassAttributes = new AttributeSelectionPanel(); panel.add(m_PanelClassAttributes, BorderLayout.CENTER); m_ButtonSetClassAttributes = new JButton("Use class attributes"); m_ButtonSetClassAttributes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { useClassAttributes(); } }); panel.add(m_ButtonSetClassAttributes, BorderLayout.SOUTH); panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createTitledBorder("Selected attribute")); panelRight.add(panel, BorderLayout.CENTER); m_PanelAttributeSummary = new AttributeSummaryPanel(); panel.add(m_PanelAttributeSummary, BorderLayout.CENTER); }
From source file:sirius.trainer.step3.SelectFeaturePane.java
License:Open Source License
public SelectFeaturePane(JInternalFrame parent, JTabbedPane tabbedPane, ApplicationData applicationData) { this.parent = parent; this.applicationData = applicationData; this.statusPane = applicationData.getStatusPane(); this.tabbedPane = tabbedPane; JPanel north = new JPanel(new BorderLayout()); north.setBorder(BorderFactory.createTitledBorder("Filter Features")); applyFilterButton = new JButton("Apply Filter"); applyFilterButton.addActionListener(this); filterEditor = new GenericObjectEditor(); /** Filter configuration */ PropertyPanel filterPanel = new PropertyPanel(filterEditor); filterEditor.setClassType(weka.filters.Filter.class); north.add(filterPanel, BorderLayout.CENTER); undoButton = new JButton("Undo (Remove/Filter)"); undoButton.setEnabled(false);/*from w w w .j a v a 2 s . c om*/ undoButton.addActionListener(this); JPanel filterButtonsPanel = new JPanel(new GridLayout(1, 2)); filterButtonsPanel.add(applyFilterButton); north.add(filterButtonsPanel, BorderLayout.EAST); JPanel center = new JPanel(new GridLayout(1, 2)); //center_left JPanel center_left = new JPanel(new BorderLayout()); JPanel instancesSummaryPanel = new JPanel(new GridLayout(1, 2)); instancesSummaryPanel.setBorder(BorderFactory.createTitledBorder("Current File")); numberOfInstancesLabel = new JLabel(" Instances: "); numberOfFeaturesLabel = new JLabel("Features: "); instancesSummaryPanel.add(numberOfInstancesLabel); instancesSummaryPanel.add(numberOfFeaturesLabel); JPanel center_left_center = new JPanel(new BorderLayout()); center_left_center.setBorder(BorderFactory.createTitledBorder("Features")); myAttributeSelectionPanel = new MyAttributeSelectionPanel(); center_left_center.add(myAttributeSelectionPanel, BorderLayout.CENTER); JPanel removeAttributePanel = new JPanel(new GridLayout(1, 1)); removeAttributePanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); removeAttributeButton = new JButton("Remove Marked Features"); removeAttributeButton.setEnabled(false); removeAttributeButton.setToolTipText("Remove selected attributes."); removeAttributeButton.addActionListener(this); removeAttributePanel.add(removeAttributeButton); center_left_center.add(removeAttributePanel, BorderLayout.SOUTH); center_left.add(instancesSummaryPanel, BorderLayout.NORTH); center_left.add(center_left_center, BorderLayout.CENTER); this.saveArffButton = new JButton("Save as Arff (All)"); this.saveArffButton.addActionListener(this); this.saveArffNegOnlyButton = new JButton("Save as Arff (-ve Only)"); this.saveArffNegOnlyButton.addActionListener(this); this.saveArffPosOnlyButton = new JButton("Save as Arff (+ve Only)"); this.saveArffPosOnlyButton.addActionListener(this); JPanel outputPanel = new JPanel(new GridLayout(1, 3)); outputPanel.setBorder(BorderFactory.createTitledBorder("Output")); outputPanel.add(this.saveArffButton); outputPanel.add(this.saveArffPosOnlyButton); outputPanel.add(this.saveArffNegOnlyButton); center_left.add(outputPanel, BorderLayout.SOUTH); center.add(center_left); JPanel center_right = new JPanel(new GridLayout(2, 1)); attributeSummaryPanel = new AttributeSummaryPanel(); attributeSummaryPanel.setBorder(BorderFactory.createTitledBorder("Selected Features")); attributeVisualizePanel = new AttributeVisualizationPanel(); center_right.add(attributeSummaryPanel); center_right.add(attributeVisualizePanel); center.add(center_right); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); JPanel south = new JPanel(gridbag); south.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5)); previousStepButton = new JButton("<<< BACK"); previousStepButton.addActionListener(this); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; gridbag.setConstraints(previousStepButton, c); c.weightx = 3.0; c.weighty = 1.0; gridbag.setConstraints(this.undoButton, c); nextStepButton = new JButton("NEXT >>>"); nextStepButton.addActionListener(this); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; gridbag.setConstraints(nextStepButton, c); south.add(previousStepButton); south.add(this.undoButton); south.add(nextStepButton); setLayout(new BorderLayout()); add(center, BorderLayout.CENTER); add(north, BorderLayout.NORTH); add(south, BorderLayout.SOUTH); myAttributeSelectionPanel.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { ListSelectionModel lm = (ListSelectionModel) e.getSource(); for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) { if (lm.isSelectedIndex(i)) { attributeSummaryPanel.setAttribute(i); attributeVisualizePanel.setAttribute(i); break; } } } } }); }