/// <summary> /// Responds to action events. </summary> /// <param name="event"> the ActionEvent that happened. </param> public virtual void actionPerformed(ActionEvent @event) { string action = @event.getActionCommand(); object o = @event.getSource(); if (action.Equals(__BUTTON_CANCEL)) { dispose(); } else if (action.Equals(__BUTTON_OK)) { int type = -1; string s = __nodeTypeComboBox.getSelected(); if (s.Equals(__NODE_CONFLUENCE)) { type = HydrologyNode.NODE_TYPE_CONFLUENCE; } else if (s.Equals(__NODE_DIVERSION)) { type = HydrologyNode.NODE_TYPE_DIV; } else if (s.Equals(__NODE_DIVERSION_AND_WELL)) { type = HydrologyNode.NODE_TYPE_DIV_AND_WELL; } else if (s.Equals(__NODE_END)) { type = HydrologyNode.NODE_TYPE_END; } else if (s.Equals(__NODE_INSTREAM_FLOW)) { type = HydrologyNode.NODE_TYPE_ISF; } else if (s.Equals(__NODE_OTHER)) { type = HydrologyNode.NODE_TYPE_OTHER; } else if (s.Equals(__NODE_PLAN)) { type = HydrologyNode.NODE_TYPE_PLAN; } else if (s.Equals(__NODE_RESERVOIR)) { type = HydrologyNode.NODE_TYPE_RES; } else if (s.Equals(__NODE_STREAMFLOW)) { type = HydrologyNode.NODE_TYPE_FLOW; } else if (s.Equals(__NODE_WELL)) { type = HydrologyNode.NODE_TYPE_WELL; } else if (s.Equals(__NODE_XCONFLUENCE)) { type = HydrologyNode.NODE_TYPE_XCONFLUENCE; } StateMod_NodeNetwork network = __parent.getNetwork(); string up = __upstreamIDComboBox.getSelected().Trim(); if (up.Equals("[none]")) { up = null; } network.addNode(__nodeNameJTextField.getText().Trim(), type, up, __downstreamIDJTextField.getText().Trim(), __naturalFlowJCheckBox.isSelected(), __importJCheckBox.isSelected()); __parent.setNetwork(network, true, true); // __parent.resetNodeSize(); __parent.endAddNode(); dispose(); } else if (o == __nodeTypeComboBox) { string selected = __nodeTypeComboBox.getSelected(); if (!selected.Equals(__NODE_END)) { __naturalFlowJCheckBox.setEnabled(true); __importJCheckBox.setEnabled(true); } } }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { addWindowListener(this); __descriptionTextField = new JTextField(25); __origDesc = __nodes[__nodeNum].getDescription(); __descriptionTextField.setText(__origDesc); __idTextField = new JTextField(10); __origID = __nodes[__nodeNum].getCommonID(); __idTextField.setText(__origID); __idTextField.addKeyListener(this); __xTextField = new JTextField(10); __origX = StringUtil.formatString(__nodes[__nodeNum].getX(), "%13.6f").Trim(); __xTextField.setText(__origX); __xTextField.addKeyListener(this); __yTextField = new JTextField(10); __origY = StringUtil.formatString(__nodes[__nodeNum].getY(), "%13.6f").Trim(); __yTextField.setText(__origY); __yTextField.addKeyListener(this); __areaTextField = new JTextField(10); __origArea = StringUtil.formatString(__nodes[__nodeNum].getArea(), "%13.6f").Trim(); __areaTextField.setText(__origArea); __areaTextField.addKeyListener(this); __precipitationTextField = new JTextField(10); __origPrecipitation = StringUtil.formatString(__nodes[__nodeNum].getPrecip(), "%13.6f").Trim(); __precipitationTextField.setText(__origPrecipitation); __precipitationTextField.addKeyListener(this); __typeComboBox = new SimpleJComboBox(false); __typeComboBox.add(__NODE_DIVERSION); __typeComboBox.add(__NODE_DIVERSION_AND_WELL); __typeComboBox.add(__NODE_INSTREAM_FLOW); __typeComboBox.add(__NODE_OTHER); __typeComboBox.add(__NODE_PLAN); __typeComboBox.add(__NODE_RESERVOIR); __typeComboBox.add(__NODE_STREAMFLOW); __typeComboBox.add(__NODE_WELL); int type = __nodes[__nodeNum].getType(); if (type == HydrologyNode.NODE_TYPE_CONFLUENCE) { __typeComboBox.select(__NODE_CONFLUENCE); } else if (type == HydrologyNode.NODE_TYPE_DIV) { __typeComboBox.select(__NODE_DIVERSION); } else if (type == HydrologyNode.NODE_TYPE_DIV_AND_WELL) { __typeComboBox.select(__NODE_DIVERSION_AND_WELL); } else if (type == HydrologyNode.NODE_TYPE_END) { __typeComboBox.removeAll(); __typeComboBox.add(__NODE_END); } else if (type == HydrologyNode.NODE_TYPE_ISF) { __typeComboBox.select(__NODE_INSTREAM_FLOW); } else if (type == HydrologyNode.NODE_TYPE_OTHER) { __typeComboBox.select(__NODE_OTHER); } else if (type == HydrologyNode.NODE_TYPE_PLAN) { __typeComboBox.select(__NODE_PLAN); } else if (type == HydrologyNode.NODE_TYPE_RES) { __typeComboBox.select(__NODE_RESERVOIR); } else if (type == HydrologyNode.NODE_TYPE_FLOW) { __typeComboBox.select(__NODE_STREAMFLOW); } else if (type == HydrologyNode.NODE_TYPE_WELL) { __typeComboBox.select(__NODE_WELL); } else if (type == HydrologyNode.NODE_TYPE_XCONFLUENCE) { __typeComboBox.select(__NODE_XCONFLUENCE); } else { __typeComboBox.removeAll(); __typeComboBox.add("Unknown Type: " + type); } __typeComboBox.setMaximumRowCount(__typeComboBox.getItemCount()); __origIType = type; __origType = __typeComboBox.getSelected(); __labelPositionComboBox = new SimpleJComboBox(false); __labelPositionComboBox.add(__ABOVE_CENTER); __labelPositionComboBox.add(__UPPER_RIGHT); __labelPositionComboBox.add(__RIGHT); __labelPositionComboBox.add(__LOWER_RIGHT); __labelPositionComboBox.add(__BELOW_CENTER); __labelPositionComboBox.add(__LOWER_LEFT); __labelPositionComboBox.add(__LEFT); __labelPositionComboBox.add(__UPPER_LEFT); __labelPositionComboBox.add(__CENTER); __labelPositionComboBox.setMaximumRowCount(__labelPositionComboBox.getItemCount()); int dir = __nodes[__nodeNum].getLabelDirection() % 10; if (dir == 2) { __labelPositionComboBox.select(__BELOW_CENTER); } else if (dir == 1) { __labelPositionComboBox.select(__ABOVE_CENTER); } else if (dir == 4) { __labelPositionComboBox.select(__RIGHT); } else if (dir == 3) { __labelPositionComboBox.select(__LEFT); } else if (dir == 7) { __labelPositionComboBox.select(__UPPER_RIGHT); } else if (dir == 8) { __labelPositionComboBox.select(__LOWER_RIGHT); } else if (dir == 5) { __labelPositionComboBox.select(__LOWER_LEFT); } else if (dir == 6) { __labelPositionComboBox.select(__UPPER_LEFT); } else if (dir == 9) { __labelPositionComboBox.select(__CENTER); } else { __labelPositionComboBox.removeAll(); __labelPositionComboBox.add("Unknown Position: " + dir); } __origIDir = dir; __origDir = __labelPositionComboBox.getSelected(); __isNaturalFlowCheckBox = new JCheckBox(); __isImportCheckBox = new JCheckBox(); __origDirty = __nodes[__nodeNum].isDirty(); __reservoirDirectionLabel = new JLabel("Reservoir Direction: "); __reservoirDirectionComboBox = new SimpleJComboBox(false); __reservoirDirectionComboBox.setToolTipText("Reservoir body is to the indicated direction " + "(downstream follows the arrow)."); __reservoirDirectionComboBox.add(__TOP); __reservoirDirectionComboBox.add(__BOTTOM); __reservoirDirectionComboBox.add(__LEFT); __reservoirDirectionComboBox.add(__RIGHT); int resDir = __nodes[__nodeNum].getLabelDirection() / 10; if (resDir == 1) { __reservoirDirectionComboBox.select(__BOTTOM); } else if (resDir == 2) { __reservoirDirectionComboBox.select(__TOP); } else if (resDir == 3) { __reservoirDirectionComboBox.select(__RIGHT); } else if (resDir == 4) { __reservoirDirectionComboBox.select(__LEFT); } else if (resDir == 0) { } else { __reservoirDirectionComboBox.removeAll(); __reservoirDirectionComboBox.add("Unknown direction: " + resDir); } __origResIDir = resDir; __origResDir = __reservoirDirectionComboBox.getSelected(); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); int y = 0; JGUIUtil.addComponent(panel, new JLabel("ID: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __idTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Type: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __typeComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Description: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __descriptionTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("X: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __xTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Y: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __yTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Is natural flow?: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __isNaturalFlowCheckBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Is import?: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __isImportCheckBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Area: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __areaTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, new JLabel("Precipitation: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __precipitationTextField, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); if (__nodes[__nodeNum].getIsNaturalFlow()) { __isNaturalFlowCheckBox.setSelected(true); } else { __isNaturalFlowCheckBox.setSelected(false); __areaTextField.setEnabled(false); __precipitationTextField.setEnabled(false); } __isNaturalFlowCheckBox.addActionListener(this); if (__nodes[__nodeNum].getIsImport()) { __isImportCheckBox.setSelected(true); } else { __isImportCheckBox.setSelected(false); } __isImportCheckBox.addActionListener(this); __origNaturalFlow = __isNaturalFlowCheckBox.isSelected(); __origImport = __isImportCheckBox.isSelected(); y++; JGUIUtil.addComponent(panel, new JLabel("Label Position: "), 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __labelPositionComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(panel, __reservoirDirectionLabel, 0, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, __reservoirDirectionComboBox, 1, y, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; y = addUpstreamNodesToPanel(panel, y); addDownstreamNodeToPanel(panel, y); getContentPane().add(panel); JPanel southPanel = new JPanel(); southPanel.setLayout(new GridBagLayout()); __applyButton = new JButton(__BUTTON_APPLY); __applyButton.addActionListener(this); __okButton = new JButton(__BUTTON_OK); __okButton.addActionListener(this); JButton cancelButton = new JButton(__BUTTON_CANCEL); cancelButton.addActionListener(this); JGUIUtil.addComponent(southPanel, __applyButton, 0, 0, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(southPanel, __okButton, 2, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(southPanel, cancelButton, 3, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); getContentPane().add(southPanel, "South"); pack(); if (__origIType != HydrologyNode.NODE_TYPE_RES) { __reservoirDirectionLabel.setVisible(false); __reservoirDirectionComboBox.setVisible(false); } __typeComboBox.addActionListener(this); if (__parent.inStateModGUI()) { __typeComboBox.setEnabled(false); __precipitationTextField.setEditable(false); __precipitationTextField.removeKeyListener(this); __descriptionTextField.setEditable(false); __descriptionTextField.removeKeyListener(this); __areaTextField.removeKeyListener(this); __areaTextField.setEditable(false); __idTextField.removeKeyListener(this); __idTextField.setEditable(false); __isNaturalFlowCheckBox.setEnabled(false); __isImportCheckBox.setEnabled(false); } JGUIUtil.center(this); setVisible(true); }
/// <summary> /// Sets up the GUI. </summary> /// <param name="index"> the index to select </param> private void setupGUI(int index) { string routine = "setupGUI"; addWindowListener(this); JPanel p1 = new JPanel(); // first 6 months' effeciency //JPanel p2 = new JPanel(); // last 6 months' effeciency JPanel p3 = new JPanel(); // div sta id -> switch for diversion JPanel p4 = new JPanel(); // user name -> data type switch JPanel left_panel = new JPanel(); // multilist and search area __stationIDJTextField = new JTextField(12); __nameJTextField = new JTextField(24); __latitudeJTextField = new JTextField(12); __elevationJTextField = new JTextField(12); __region1JTextField = new JTextField(12); __region2JTextField = new JTextField(12); __searchID = new JTextField(10); __searchName = new JTextField(10); __searchName.setEditable(false); __findNextStation = new JButton(__BUTTON_FIND_NEXT); __searchCriteriaGroup = new ButtonGroup(); __searchIDJRadioButton = new JRadioButton(__BUTTON_ID, true); __searchNameJRadioButton = new JRadioButton(__BUTTON_NAME, false); __searchCriteriaGroup.add(__searchIDJRadioButton); __searchCriteriaGroup.add(__searchNameJRadioButton); JButton applyJButton = new JButton(__BUTTON_APPLY); JButton cancelJButton = new JButton(__BUTTON_CANCEL); JButton helpJButton = new JButton(__BUTTON_HELP); helpJButton.setEnabled(false); JButton closeJButton = new JButton(__BUTTON_CLOSE); GridBagLayout gb = new GridBagLayout(); JPanel mainJPanel = new JPanel(); mainJPanel.setLayout(gb); p1.setLayout(new GridLayout(4, 6, 2, 0)); p3.setLayout(gb); p4.setLayout(gb); left_panel.setLayout(gb); int y; PropList p = new PropList("StateCU_ClimateStation_JFrame.JWorksheet"); p.add("JWorksheet.CellFont=Courier"); p.add("JWorksheet.CellStyle=Plain"); p.add("JWorksheet.CellSize=11"); p.add("JWorksheet.HeaderFont=Arial"); p.add("JWorksheet.HeaderStyle=Plain"); p.add("JWorksheet.HeaderSize=11"); p.add("JWorksheet.HeaderBackground=LightGray"); p.add("JWorksheet.RowColumnPresent=false"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; try { StateCU_ClimateStation_TableModel tmw = new StateCU_ClimateStation_TableModel(__stationsVector); StateCU_ClimateStation_CellRenderer crw = new StateCU_ClimateStation_CellRenderer(tmw); __worksheet = new JWorksheet(crw, tmw, p); widths = crw.getColumnWidths(); } catch (Exception e) { Message.printWarning(2, routine, e); __worksheet = new JWorksheet(0, 0, p); Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } __worksheet.setPreferredScrollableViewportSize(null); __worksheet.setHourglassJFrame(this); __worksheet.addMouseListener(this); __worksheet.addKeyListener(this); JGUIUtil.addComponent(left_panel, new JScrollPane(__worksheet), 0, 0, 6, 6, 1, 1, 0, 0, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER); y = 0; JGUIUtil.addComponent(p3, new JLabel("Station ID:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __stationIDJTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); __stationIDJTextField.setEditable(false); y++; JGUIUtil.addComponent(p3, new JLabel("Name:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __nameJTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(p3, new JLabel("Latitude (Dec. Deg.):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __latitudeJTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(p3, new JLabel("Elevation (Feet):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __elevationJTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(p3, new JLabel("Region 1:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __region1JTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(p3, new JLabel("Region 2:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p3, __region2JTextField, 1, y, 1, 1, 1, 0, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JPanel graphPanel = new JPanel(); graphPanel.setLayout(gb); graphPanel.setBorder(BorderFactory.createTitledBorder("Time Series")); int yy = 0; __precipitationCheckBox = new JCheckBox("Precipitation (Monthly)"); __temperatureCheckBox = new JCheckBox("Temperature (Monthly)"); __frostDatesCheckBox = new JCheckBox("Frost Dates (Yearly)"); JGUIUtil.addComponent(graphPanel, __precipitationCheckBox, 0, yy++, 3, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(graphPanel, __temperatureCheckBox, 0, yy++, 3, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(graphPanel, __frostDatesCheckBox, 0, yy++, 3, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); if (!__dataset.getComponentForComponentType(StateCU_DataSet.COMP_PRECIPITATION_TS_MONTHLY).hasData()) { __precipitationCheckBox.setEnabled(false); } if (!__dataset.getComponentForComponentType(StateCU_DataSet.COMP_TEMPERATURE_TS_MONTHLY_AVERAGE).hasData()) { __temperatureCheckBox.setEnabled(false); } if (!__dataset.getComponentForComponentType(StateCU_DataSet.COMP_FROST_DATES_TS_YEARLY).hasData()) { __frostDatesCheckBox.setEnabled(false); } JButton graphButton = new SimpleJButton(__BUTTON_GRAPH, __BUTTON_GRAPH, this); JButton tableButton = new SimpleJButton(__BUTTON_TABLE, __BUTTON_TABLE, this); JButton summaryButton = new SimpleJButton(__BUTTON_SUMMARY, __BUTTON_SUMMARY, this); JGUIUtil.addComponent(graphPanel, graphButton, 0, yy, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(graphPanel, tableButton, 1, yy, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(graphPanel, summaryButton, 2, yy++, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(p3, graphPanel, 0, y++, 2, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST); // add search areas y = 7; JPanel searchPanel = new JPanel(); searchPanel.setLayout(gb); searchPanel.setBorder(BorderFactory.createTitledBorder("Search above list for: ")); JGUIUtil.addComponent(left_panel, searchPanel, 0, y, 4, 1, 0, 0, 10, 10, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); int y2 = 0; JGUIUtil.addComponent(searchPanel, __searchIDJRadioButton, 0, y2, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __searchIDJRadioButton.addActionListener(this); JGUIUtil.addComponent(searchPanel, __searchID, 1, y2, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); __searchID.addActionListener(this); y2++; JGUIUtil.addComponent(searchPanel, __searchNameJRadioButton, 0, y2, 1, 1, 0, 0, 5, 10, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __searchNameJRadioButton.addActionListener(this); JGUIUtil.addComponent(searchPanel, __searchName, 1, y2, 1, 1, 1, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); __searchName.addActionListener(this); y2++; JGUIUtil.addComponent(searchPanel, __findNextStation, 0, y2, 4, 1, 0, 0, 20, 10, 20, 10, GridBagConstraints.NONE, GridBagConstraints.WEST); __findNextStation.addActionListener(this); // add buttons which lead to station water rights, // direct flow demand, and return flow information y = 6; FlowLayout fl = new FlowLayout(FlowLayout.CENTER); JPanel p5 = new JPanel(); p5.setLayout(new GridLayout(5, 2)); // add help and close buttons y = 10; JPanel p6 = new JPanel(); p6.setLayout(fl); if (__editable) { p6.add(applyJButton); p6.add(cancelJButton); } p6.add(helpJButton); p6.add(closeJButton); // two top panels of info JGUIUtil.addComponent(mainJPanel, p3, 6, 0, 1, 6, 0, 1, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(mainJPanel, p6, 6, 7, 1, 1, 0, 0, 30, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTH); applyJButton.addActionListener(this); cancelJButton.addActionListener(this); helpJButton.addActionListener(this); closeJButton.addActionListener(this); JGUIUtil.addComponent(mainJPanel, left_panel, 0, 0, 4, 10, 1, 1, 10, 10, 10, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); getContentPane().add(mainJPanel); JPanel bottomJPanel = new JPanel(); bottomJPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __messageJTextField, 0, 0, 7, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); __statusJTextField = new JTextField(5); __statusJTextField.setEditable(false); JGUIUtil.addComponent(bottomJPanel, __statusJTextField, 7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.WEST); getContentPane().add("South", bottomJPanel); initializeDisables(); // JGUIUtil.center(this); pack(); setSize(900,440); selectTableIndex(index); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } }