List of usage examples for javax.swing JPanel setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:Widgets.Simulation.java
protected JPanel trajectoryTabb() { JPanel trajectoryPanel = new JPanel(); //judge if converged //final JLabel convergePanel = new JLabel(); plot.removeAllPlots();//from ww w. j ava 2 s .c o m plot.setAxisLabel(0, "t"); plot.setAxisLabel(1, "Expression Level"); plot.setPreferredSize(new Dimension(440, 390)); //ArrayList<DoubleMatrix2D> timeSeries_ = grn.getTimeSeries(); //ArrayList<DoubleMatrix1D> timeScale_ = grn.getTimeScale(); //display multiple time series //combobox //generate time series List String[] timeSeriesList = new String[grn.getTimeSeries().size()]; for (int i = 0; i < grn.getTimeSeries().size(); i++) timeSeriesList[i] = Integer.toString(i); JLabel selectPanelName = new JLabel("Select trajectory: "); JPanel selectPanel = new JPanel(); //selectPanel.setPreferredSize(new Dimension(1000,10)); final JComboBox<String> combo = new JComboBox<String>(timeSeriesList); //view window final JPanel trajectoryViewPanel = new JPanel(); //trajectoryViewPanel.setPreferredSize(new Dimension(990,500)); plot.setPreferredSize(new Dimension(440, 350)); double[] t = grn.getTimeScale().get(0).toArray(); for (int k = 0; k < grn.getTimeSeries().get(0).columns(); k++) plot.addLinePlot(grn.getNode(k).getLabel(), t, grn.getTimeSeries().get(0).viewColumn(k).toArray()); plot.addLegend("SOUTH"); plot.repaint(); //combobox action combo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int row = combo.getSelectedIndex(); plot.removeAllPlots(); double[] t = grn.getTimeScale().get(row).toArray(); for (int k = 0; k < grn.getTimeSeries().get(row).columns(); k++) { plot.addLinePlot(grn.getNode(k).getLabel(), t, grn.getTimeSeries().get(row).viewColumn(k).toArray()); } trajectoryViewPanel.repaint(); trajectoryViewPanel.setVisible(true); } }); selectPanel.setLayout(new BoxLayout(selectPanel, BoxLayout.X_AXIS)); selectPanel.add(selectPanelName); selectPanel.add(combo); trajectoryViewPanel.add(plot); //set layout trajectoryPanel.setLayout(new GridBagLayout()); NetLand.addComponent(trajectoryPanel, trajectoryViewPanel, 0, 0, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, 0, 1); NetLand.addComponent(trajectoryPanel, selectPanel, 0, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, 1, 0); //NetLand.addComponent(trajectoryPanel, convergePanel, 0, 2, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, 1, 0); return trajectoryPanel; }