/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { __xdgSimpleJComboBox = new SimpleJComboBox(); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Diversion> diversionsVector = (java.util.List<StateMod_Diversion>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_DIVERSION_STATIONS).getData(); IList <StateMod_Diversion> diversionsVector = (IList <StateMod_Diversion>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_DIVERSION_STATIONS).getData(); IList <string> list_names = StateMod_Util.createIdentifierListFromStateModData(diversionsVector, true, null); int size = list_names.Count; for (int i = 0; i < size; i++) { __xdgSimpleJComboBox.add(list_names[i] + " - Diversion"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlow> instreamFlowsVector = (java.util.List<StateMod_InstreamFlow>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_INSTREAM_STATIONS).getData(); IList <StateMod_InstreamFlow> instreamFlowsVector = (IList <StateMod_InstreamFlow>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_INSTREAM_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(instreamFlowsVector, true, null); size = list_names.Count; for (int i = 0; i < size; i++) { __xdgSimpleJComboBox.add(list_names[i] + " - Instream Flow"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamGage> gageVector = (java.util.List<StateMod_StreamGage>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMGAGE_STATIONS).getData(); IList <StateMod_StreamGage> gageVector = (IList <StateMod_StreamGage>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMGAGE_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(gageVector, true, null); size = list_names.Count; for (int i = 0; i < size; i++) { __xdgSimpleJComboBox.add(list_names[i] + " - Stream Gage"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate> estimateVector = (java.util.List<StateMod_StreamEstimate>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS).getData(); IList <StateMod_StreamEstimate> estimateVector = (IList <StateMod_StreamEstimate>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(estimateVector, true, null); size = list_names.Count; for (int i = 0; i < size; i++) { __xdgSimpleJComboBox.add(list_names[i] + " - Stream Estimate"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Reservoir> reservoirsVector = (java.util.List<StateMod_Reservoir>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_STATIONS).getData(); IList <StateMod_Reservoir> reservoirsVector = (IList <StateMod_Reservoir>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_RESERVOIR_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(reservoirsVector, true, null); size = list_names.Count; __xrgSimpleJComboBox = new SimpleJComboBox(); for (int i = 0; i < size; i++) { __xrgSimpleJComboBox.add(list_names[i] + " - Reservoir"); } //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Well> wellsVector = (java.util.List<StateMod_Well>) __dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_STATIONS).getData(); IList <StateMod_Well> wellsVector = (IList <StateMod_Well>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_WELL_STATIONS).getData(); list_names = StateMod_Util.createIdentifierListFromStateModData(wellsVector, true, null); size = list_names.Count; __xwgSimpleJComboBox = new SimpleJComboBox(); for (int i = 0; i < size; i++) { __xwgSimpleJComboBox.add(list_names[i] + " - Well"); } // Define the button groups and add radio buttons to the group in the // order of the GUI... __general_ButtonGroup = new ButtonGroup(); __general_ButtonGroup.add(__xstJRadioButton = new JRadioButton("-xst", false)); __general_ButtonGroup.add(__xwbJRadioButton = new JRadioButton("-xwb", true)); __general_ButtonGroup.add(__xwrJRadioButton = new JRadioButton("-xwr", false)); __general_ButtonGroup.add(__xcuJRadioButton = new JRadioButton("-xcu", false)); __compare_ButtonGroup = new ButtonGroup(); __compare_ButtonGroup.add(__xdcJRadioButton = new JRadioButton("-xdc", true)); __compare_ButtonGroup.add(__xrcJRadioButton = new JRadioButton("-xrc", false)); __compare_ButtonGroup.add(__xwcJRadioButton = new JRadioButton("-xwc", false)); __compare_ButtonGroup.add(__xscJRadioButton = new JRadioButton("-xsc", false)); __graph_ButtonGroup = new ButtonGroup(); __graph_ButtonGroup.add(__xdgJRadioButton = new JRadioButton("-xdg", true)); __graph_ButtonGroup.add(__xrgJRadioButton = new JRadioButton("-xrg", false)); __graph_ButtonGroup.add(__xwgJRadioButton = new JRadioButton("-xwg", false)); __daily_ButtonGroup = new ButtonGroup(); __daily_ButtonGroup.add(__xdyJRadioButton = new JRadioButton("-xdy", true)); __daily_ButtonGroup.add(__xryJRadioButton = new JRadioButton("-xry", false)); __daily_ButtonGroup.add(__xwyJRadioButton = new JRadioButton("-xwy", false)); __other_ButtonGroup = new ButtonGroup(); __other_ButtonGroup.add(__xnmJRadioButton = new JRadioButton("-xnm", true)); __other_ButtonGroup.add(__xrxJRadioButton = new JRadioButton("-xrx", false)); __other_ButtonGroup.add(__xspJRadioButton = new JRadioButton("-xsp", false)); __other_ButtonGroup.add(__xbnJRadioButton = new JRadioButton("-xbn", false)); // Set the selected item in the graph output, based on whether data // exists... bool something_selected = false; // To help select a radio button if (__xdgSimpleJComboBox.getItemCount() == 0) { __xdgSimpleJComboBox.setEnabled(false); } else { __xdgSimpleJComboBox.select(0); __xdgJRadioButton.setSelected(true); something_selected = true; } if (__xrgSimpleJComboBox.getItemCount() == 0) { __xrgSimpleJComboBox.setEnabled(false); } else { __xrgSimpleJComboBox.select(0); if (!something_selected) { __xrgJRadioButton.setSelected(true); something_selected = true; } } if (__xwgSimpleJComboBox.getItemCount() == 0) { __xwgSimpleJComboBox.setEnabled(false); } else { __xwgSimpleJComboBox.select(0); if (!something_selected) { __xwgJRadioButton.setSelected(true); } } __runStateModJButton = new JButton(__BUTTON_RUN_REPORT); __cancelJButton = new JButton(__BUTTON_CANCEL); // REVISIT - enable when full help system is redesigned //__helpJButton = new JButton(__BUTTON_HELP); GridBagLayout gb = new GridBagLayout(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(gb); int col1 = 0; int col2 = 1; int col3 = 2; int y; int bound = 2; // buffer around components. __main_JTabbedPane = new JTabbedPane(); __general_JPanel = new JPanel(); __general_JPanel.setLayout(gb); __compare_JPanel = new JPanel(); __compare_JPanel.setLayout(gb); __graph_JPanel = new JPanel(); __graph_JPanel.setLayout(gb); __daily_JPanel = new JPanel(); __daily_JPanel.setLayout(gb); __other_JPanel = new JPanel(); __other_JPanel.setLayout(gb); ///////////////////////////////////////////////////////////// // general panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__general_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__general_JPanel, __xstJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel1 = new JLabel("Direct and Instream Flow Data (*.xdd)"); __xstJLabel1.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel1, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel2 = new JLabel("Reservoir Data - Total and by Account " + "(*.xre)"); __xstJLabel2.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel2, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel3 = new JLabel("Operation Right Summary (*.xop)"); __xstJLabel3.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel3, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel4 = new JLabel("Instream Flow Reach Summary (*.xir)"); __xstJLabel4.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel4, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xstJLabel5 = new JLabel("Well Summary (*.xwe)"); __xstJLabel5.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xstJLabel5, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__general_JPanel, __xwbJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xwbJLabel = new JLabel("Water balance (*.xwb) and " + "Ground Water Balance (*.xgw)"); __xwbJLabel.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xwbJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__general_JPanel, __xwrJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xwrJLabel = new JLabel("Water rights list, sorted by basin " + "rank (*.xwr)"); __xwrJLabel.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xwrJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__general_JPanel, __xcuJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xcuJLabel1 = new JLabel("Simulated Diversions and " + "Consumptive Use (*.xcu)"); __xcuJLabel1.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xcuJLabel1, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xcuJLabel2 = new JLabel("Water supply summary (*.xsu)"); __xcuJLabel2.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xcuJLabel2, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xcuJLabel3 = new JLabel("Shortage Summary (*.xsh)"); __xcuJLabel3.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xcuJLabel3, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xcuJLabel4 = new JLabel("CU by Water District (*.xwd)"); __xcuJLabel4.addMouseListener(this); JGUIUtil.addComponent(__general_JPanel, __xcuJLabel4, col2, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); ///////////////////////////////////////////////////////////// // compare panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__compare_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__compare_JPanel, __xdcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xdcJLabel = new JLabel("Diversion comparison (*.xdc)"); __xdcJLabel.addMouseListener(this); JGUIUtil.addComponent(__compare_JPanel, __xdcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__compare_JPanel, __xrcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xrcJLabel = new JLabel("Reservoir comparison (*.xrc)"); __xrcJLabel.addMouseListener(this); JGUIUtil.addComponent(__compare_JPanel, __xrcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__compare_JPanel, __xwcJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xwcJLabel = new JLabel("Well comparison (*.xwc)"); __xwcJLabel.addMouseListener(this); JGUIUtil.addComponent(__compare_JPanel, __xwcJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__compare_JPanel, __xscJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xscJLabel = new JLabel("Stream flow gage comparison (*.xsc)"); __xscJLabel.addMouseListener(this); JGUIUtil.addComponent(__compare_JPanel, __xscJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); ///////////////////////////////////////////////////////////// // graph panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__graph_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xdgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xdgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); __xdgSimpleJComboBox.addMouseListener(this); __xdgJLabel = new JLabel("Direct diversion, instream flow and " + "gage graph (*.xdg)"); __xdgJLabel.addMouseListener(this); JGUIUtil.addComponent(__graph_JPanel, __xdgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xrgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xrgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); __xrgSimpleJComboBox.addMouseListener(this); __xrgJLabel = new JLabel("Reservoir graph (*.xrg)"); __xrgJLabel.addMouseListener(this); JGUIUtil.addComponent(__graph_JPanel, __xrgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xwgJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__graph_JPanel, __xwgSimpleJComboBox, col2, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); __xwgSimpleJComboBox.addMouseListener(this); __xwgJLabel = new JLabel("Well graph (*.xwg)"); __xwgJLabel.addMouseListener(this); JGUIUtil.addComponent(__graph_JPanel, __xwgJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); ///////////////////////////////////////////////////////////// // daily panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__daily_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__daily_JPanel, __xdyJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xdyJLabel = new JLabel("Daily Direct Diversion and Instream Flow Data" + " (*.xdy)"); __xdyJLabel.addMouseListener(this); JGUIUtil.addComponent(__daily_JPanel, __xdyJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__daily_JPanel, __xryJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xryJLabel = new JLabel("Daily Reservoir Data (*.xry)"); __xryJLabel.addMouseListener(this); JGUIUtil.addComponent(__daily_JPanel, __xryJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__daily_JPanel, __xwyJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xwyJLabel = new JLabel("Daily Well Data (*.xwy)"); __xwyJLabel.addMouseListener(this); JGUIUtil.addComponent(__daily_JPanel, __xwyJLabel, col2, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); ///////////////////////////////////////////////////////////// // other panel ///////////////////////////////////////////////////////////// y = 0; JGUIUtil.addComponent(__other_JPanel, new JLabel("Select one of the following report options." + " Output files will have the extensions shown."), col1, y, 3, 1, 0, 0, 0, 0, bound, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__other_JPanel, __xnmJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xnmJLabel1 = new JLabel("Detailed Node Accounting, monthly (*.xnm) and "); __xnmJLabel1.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xnmJLabel1, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xnmJLabel2 = new JLabel("Summary Node Accounting, average (*.xna)"); __xnmJLabel2.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xnmJLabel2, col3, ++y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__other_JPanel, __xrxJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xrxJLabel = new JLabel("River data summary (*.xrx)"); __xrxJLabel.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xrxJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__other_JPanel, __xspJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xspJLabel = new JLabel("Selected parameter printout," + " uses output control file (*.xsp)"); __xspJLabel.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xspJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(__other_JPanel, __xbnJRadioButton, col1, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __xbnJLabel = new JLabel("ASCII listing of Binary Direct and " + "Instream Data (*.xbn)"); __xbnJLabel.addMouseListener(this); JGUIUtil.addComponent(__other_JPanel, __xbnJLabel, col3, y, 1, 1, 0, 0, 0, bound, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __main_JTabbedPane.add("General", __general_JPanel); __main_JTabbedPane.add("Compare", __compare_JPanel); __main_JTabbedPane.add("Graph", __graph_JPanel); __main_JTabbedPane.add("Daily", __daily_JPanel); __main_JTabbedPane.add("Other", __other_JPanel); getContentPane().add("Center", __main_JTabbedPane); // add buttons JPanel p1 = new JPanel(); p1.add(__runStateModJButton); p1.add(__cancelJButton); // REVISIT - add when full help system is redesigned. //p1.add(__helpJButton); //__helpJButton.setEnabled(false); //__helpJButton.addActionListener(this); __runStateModJButton.addActionListener(this); __cancelJButton.addActionListener(this); getContentPane().add("South", p1); if (__dataset_wm != null) { __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_RUN_REPORT, this); } pack(); JGUIUtil.center(this); setVisible(true); }
// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { canvas = new BufferedImage(320, 320, BufferedImage.TYPE_BYTE_GRAY); buttonGroup1 = new ButtonGroup(); buttonGroup2 = new ButtonGroup(); jPanel4 = new JPanel(); jSlider2 = new JSlider(); jLabel1 = new JLabel(); jPanel2 = new JPanel(new GridBagLayout()); JLabel canvasLabel = new JLabel(new ImageIcon(canvas)); jPanel2.add(canvasLabel, null); jPanel3 = new JPanel(); jRadioButton3 = new JRadioButton(); jRadioButton4 = new JRadioButton(); jRadioButton5 = new JRadioButton(); jRadioButton6 = new JRadioButton(); jRadioButton7 = new JRadioButton(); jRadioButton8 = new JRadioButton(); jButton1 = new JButton(); DefaultCloseOperation = WindowConstants.EXIT_ON_CLOSE; Title = "FuNet1 --- powered by Neuroph"; jPanel4.Border = BorderFactory.createTitledBorder("Line thickness"); jSlider2.MajorTickSpacing = 10; jSlider2.Maximum = 51; jSlider2.Minimum = 1; jSlider2.MinorTickSpacing = 5; jSlider2.PaintTicks = true; jSlider2.addChangeListener(new ChangeListenerAnonymousInnerClassHelper(this)); // jLabel1.setText("Stroke Size (Radius)"); GroupLayout jPanel4Layout = new GroupLayout(jPanel4); jPanel4.Layout = jPanel4Layout; jPanel4Layout.HorizontalGroup = jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 51, short.MaxValue).addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(jLabel1).addComponent(jSlider2, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)).addContainerGap()); label = new JLabel(""); Font labelFont = label.Font; label.Font = new Font(labelFont.Name, Font.PLAIN, 30); jPanel4Layout.VerticalGroup = jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(jSlider2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addGroup(jPanel4Layout.createSequentialGroup().addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(jLabel1)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED))); jPanel2.Background = new Color(0, 0, 0); jPanel2.Border = BorderFactory.createBevelBorder(BevelBorder.RAISED); // add the listeners to the label that contains the canvas buffered image canvasLabel.addMouseListener(new MouseAdapterAnonymousInnerClassHelper(this)); canvasLabel.addMouseMotionListener(new MouseMotionAdapterAnonymousInnerClassHelper(this)); jButton1.Text = "Clear"; jButton1.addActionListener(new ActionListenerAnonymousInnerClassHelper(this)); GroupLayout layout = new GroupLayout(ContentPane); ContentPane.Layout = layout; layout.HorizontalGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jPanel2, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, short.MaxValue).addGroup(layout.createSequentialGroup().addComponent(jPanel4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jPanel3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jButton1, GroupLayout.DEFAULT_SIZE, 112, short.MaxValue).addComponent(label, GroupLayout.DEFAULT_SIZE, 112, short.MaxValue)))).addContainerGap()); layout.VerticalGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false).addGroup(layout.createSequentialGroup().addGap(4, 4, 4).addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE).addComponent(label, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)).addComponent(jPanel4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, short.MaxValue).addComponent(jPanel3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, short.MaxValue)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, short.MaxValue).addContainerGap()); Graphics g = canvas.Graphics; g.Color = Color.WHITE; g.fillRect(0, 0, canvas.Width, canvas.Height); repaint(); pack(); } // </editor-fold>
/** * Set up the applet's GUI. * As recommended, the init method executes this in the event-dispatching * thread. */ public void run() { Container pane = getContentPane(); pane.setLayout(new BorderLayout()); // Build the button controls JRadioButton voronoiButton = new JRadioButton("Voronoi Diagram"); voronoiButton.setActionCommand("voronoi"); JRadioButton delaunayButton = new JRadioButton("Delaunay Triangulation"); delaunayButton.setActionCommand("delaunay"); JButton clearButton = new JButton("Clear"); clearButton.setActionCommand("clear"); ButtonGroup group = new ButtonGroup(); group.add(voronoiButton); group.add(delaunayButton); JPanel buttonPanel = new JPanel(); buttonPanel.add(voronoiButton); buttonPanel.add(delaunayButton); buttonPanel.add(clearButton); pane.add(buttonPanel, "North"); // Build the mouse-entry switches JLabel circleLabel = new JLabel("Show Empty Circles"); circleLabel.setName("circles"); JLabel delaunayLabel = new JLabel("Show Delaunay Edges"); delaunayLabel.setName("delaunay"); JLabel voronoiLabel = new JLabel("Show Voronoi Edges"); voronoiLabel.setName("voronoi"); JPanel switchPanel = new JPanel(); switchPanel.add(circleLabel); switchPanel.add(new Label(" ")); switchPanel.add(delaunayLabel); switchPanel.add(new Label(" ")); switchPanel.add(voronoiLabel); pane.add(switchPanel, "South"); // Build the graphics panel DelaunayPanel graphicsPanel = new DelaunayPanel(); graphicsPanel.setBackground(Color.gray); pane.add(graphicsPanel, "Center"); // Register the listeners voronoiButton.addActionListener(graphicsPanel); delaunayButton.addActionListener(graphicsPanel); clearButton.addActionListener(graphicsPanel); graphicsPanel.addMouseListener(graphicsPanel); circleLabel.addMouseListener(graphicsPanel); delaunayLabel.addMouseListener(graphicsPanel); voronoiLabel.addMouseListener(graphicsPanel); // Initialize the radio buttons voronoiButton.doClick(); }