public BooleanProperty(PropertyHolder element, string name) : base((Class) ClassLiteral<Boolean>.Value, element, name) { BooleanProperty booleanProperty = this; this.box = new JCheckBox(); this.checkbox = new DefaultCellEditor(this.box); this.renderer = (TableCellRenderer) new BooleanProperty\u00241(this); }
public BooleanProperty(PropertyHolder element, string name, bool defaultValue) { int num = defaultValue ? 1 : 0; // ISSUE: explicit constructor call base.\u002Ector((Class) ClassLiteral<Boolean>.Value, element, name, (object) Boolean.valueOf(num != 0)); BooleanProperty booleanProperty = this; this.box = new JCheckBox(); this.checkbox = new DefaultCellEditor(this.box); this.renderer = (TableCellRenderer) new BooleanProperty\u00241(this); }
public DefaultColorBarEditor([In] ColorBar obj0) : base((NumberAxis) obj0.getAxis()) { DefaultColorBarEditor defaultColorBarEditor = this; this.invertPalette = false; this.stepPalette = false; this.invertPalette = obj0.getColorPalette().isInverse(); this.stepPalette = obj0.getColorPalette().isStepped(); PaletteSample.__\u003Cclinit\u003E(); this.currentPalette = new PaletteSample(obj0.getColorPalette()); this.availablePaletteSamples = new PaletteSample[2]; PaletteSample[] paletteSampleArray1 = this.availablePaletteSamples; int index1 = 0; PaletteSample.__\u003Cclinit\u003E(); PaletteSample paletteSample1 = new PaletteSample((ColorPalette) new RainbowPalette()); paletteSampleArray1[index1] = paletteSample1; PaletteSample[] paletteSampleArray2 = this.availablePaletteSamples; int index2 = 1; PaletteSample.__\u003Cclinit\u003E(); PaletteSample paletteSample2 = new PaletteSample((ColorPalette) new GreyPalette()); paletteSampleArray2[index2] = paletteSample2; JTabbedPane otherTabs = this.getOtherTabs(); JPanel.__\u003Cclinit\u003E(); JPanel jpanel1 = new JPanel((LayoutManager) new LCBLayout(4)); ((JComponent) jpanel1).setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); ((Container) jpanel1).add((Component) new JPanel()); JCheckBox.__\u003Cclinit\u003E(); this.invertPaletteCheckBox = new JCheckBox(DefaultColorBarEditor.localizationResources.getString("Invert_Palette"), this.invertPalette); ((AbstractButton) this.invertPaletteCheckBox).setActionCommand("invertPalette"); ((AbstractButton) this.invertPaletteCheckBox).addActionListener((ActionListener) this); ((Container) jpanel1).add((Component) this.invertPaletteCheckBox); ((Container) jpanel1).add((Component) new JPanel()); ((Container) jpanel1).add((Component) new JPanel()); JCheckBox.__\u003Cclinit\u003E(); this.stepPaletteCheckBox = new JCheckBox(DefaultColorBarEditor.localizationResources.getString("Step_Palette"), this.stepPalette); ((AbstractButton) this.stepPaletteCheckBox).setActionCommand("stepPalette"); ((AbstractButton) this.stepPaletteCheckBox).addActionListener((ActionListener) this); ((Container) jpanel1).add((Component) this.stepPaletteCheckBox); ((Container) jpanel1).add((Component) new JPanel()); JPanel jpanel2 = jpanel1; JLabel.__\u003Cclinit\u003E(); JLabel jlabel = new JLabel(DefaultColorBarEditor.localizationResources.getString("Palette")); ((Container) jpanel2).add((Component) jlabel); JButton.__\u003Cclinit\u003E(); JButton jbutton = new JButton(DefaultColorBarEditor.localizationResources.getString("Set_palette...")); ((AbstractButton) jbutton).setActionCommand("PaletteChoice"); ((AbstractButton) jbutton).addActionListener((ActionListener) this); ((Container) jpanel1).add((Component) this.currentPalette); ((Container) jpanel1).add((Component) jbutton); otherTabs.add(DefaultColorBarEditor.localizationResources.getString("Palette"), (Component) jpanel1); }
/// <summary> /// Constructor. </summary> /// <param name="data"> the data to display in the worksheet. Can be null or empty, in /// which case an empty worksheet is shown. </param> /// <param name="titleString"> the String to display as the GUI title. </param> /// <param name="monthlyData"> if true, the delay tables are showing monthly data. If /// false, they are showing daily data. </param> /// <param name="editable"> whether the data in the JFrame can be edited or not. If true /// the data can be edited, if false they can not. </param> /// <exception cref="Exception"> if there is an error building the worksheet. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public StateMod_DelayTable_Data_JFrame(java.util.List<StateMod_DelayTable_Data_TableModel> data, String titleString, boolean monthlyData, boolean editable) throws Exception public StateMod_DelayTable_Data_JFrame(IList <StateMod_DelayTable_Data_TableModel> data, string titleString, bool monthlyData, bool editable) : base() { __monthlyData = monthlyData; initialize(data, titleString, editable); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); JLabel label = new JLabel("Show totals: "); JGUIUtil.addComponent(panel, label, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __checkBox = new JCheckBox((string)null, true); __checkBox.addActionListener(this); JGUIUtil.addComponent(panel, __checkBox, 1, 0, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); getContentPane().add("North", panel); pack(); __tableModel = (StateMod_DelayTable_Data_TableModel)_worksheet.getTableModel(); __tableModel.setJWorksheet(_worksheet); setSize(300, 600); }
public DefaultChartEditor([In] JFreeChart obj0) { base.\u002Ector(); DefaultChartEditor defaultChartEditor = this; ((Container) this).setLayout((LayoutManager) new BorderLayout()); JPanel.__\u003Cclinit\u003E(); JPanel jpanel1 = new JPanel((LayoutManager) new BorderLayout()); ((JComponent) jpanel1).setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); JPanel.__\u003Cclinit\u003E(); JPanel jpanel2 = new JPanel((LayoutManager) new BorderLayout()); ((JComponent) jpanel2).setBorder((Border) BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), DefaultChartEditor.localizationResources.getString("General"))); JPanel.__\u003Cclinit\u003E(); JPanel jpanel3 = new JPanel((LayoutManager) new LCBLayout(6)); ((JComponent) jpanel3).setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); JCheckBox.__\u003Cclinit\u003E(); this.antialias = new JCheckBox(DefaultChartEditor.localizationResources.getString("Draw_anti-aliased")); ((AbstractButton) this.antialias).setSelected(obj0.getAntiAlias()); ((Container) jpanel3).add((Component) this.antialias); ((Container) jpanel3).add((Component) new JLabel("")); ((Container) jpanel3).add((Component) new JLabel("")); JPanel jpanel4 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel1 = new JLabel(DefaultChartEditor.localizationResources.getString("Background_paint")); ((Container) jpanel4).add((Component) jlabel1); PaintSample.__\u003Cclinit\u003E(); this.background = new PaintSample(obj0.getBackgroundPaint()); ((Container) jpanel3).add((Component) this.background); JButton.__\u003Cclinit\u003E(); JButton jbutton1 = new JButton(DefaultChartEditor.localizationResources.getString("Select...")); ((AbstractButton) jbutton1).setActionCommand("BackgroundPaint"); ((AbstractButton) jbutton1).addActionListener((ActionListener) this); ((Container) jpanel3).add((Component) jbutton1); JPanel jpanel5 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel2 = new JLabel(DefaultChartEditor.localizationResources.getString("Series_Paint")); ((Container) jpanel5).add((Component) jlabel2); JTextField.__\u003Cclinit\u003E(); JTextField jtextField1 = new JTextField(DefaultChartEditor.localizationResources.getString("No_editor_implemented")); ((JComponent) jtextField1).setEnabled(false); ((Container) jpanel3).add((Component) jtextField1); JButton.__\u003Cclinit\u003E(); JButton jbutton2 = new JButton(DefaultChartEditor.localizationResources.getString("Edit...")); ((AbstractButton) jbutton2).setEnabled(false); ((Container) jpanel3).add((Component) jbutton2); JPanel jpanel6 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel3 = new JLabel(DefaultChartEditor.localizationResources.getString("Series_Stroke")); ((Container) jpanel6).add((Component) jlabel3); JTextField.__\u003Cclinit\u003E(); JTextField jtextField2 = new JTextField(DefaultChartEditor.localizationResources.getString("No_editor_implemented")); ((JComponent) jtextField2).setEnabled(false); ((Container) jpanel3).add((Component) jtextField2); JButton.__\u003Cclinit\u003E(); JButton jbutton3 = new JButton(DefaultChartEditor.localizationResources.getString("Edit...")); ((AbstractButton) jbutton3).setEnabled(false); ((Container) jpanel3).add((Component) jbutton3); JPanel jpanel7 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel4 = new JLabel(DefaultChartEditor.localizationResources.getString("Series_Outline_Paint")); ((Container) jpanel7).add((Component) jlabel4); JTextField.__\u003Cclinit\u003E(); JTextField jtextField3 = new JTextField(DefaultChartEditor.localizationResources.getString("No_editor_implemented")); ((JComponent) jtextField3).setEnabled(false); ((Container) jpanel3).add((Component) jtextField3); JButton.__\u003Cclinit\u003E(); JButton jbutton4 = new JButton(DefaultChartEditor.localizationResources.getString("Edit...")); ((AbstractButton) jbutton4).setEnabled(false); ((Container) jpanel3).add((Component) jbutton4); JPanel jpanel8 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel5 = new JLabel(DefaultChartEditor.localizationResources.getString("Series_Outline_Stroke")); ((Container) jpanel8).add((Component) jlabel5); JTextField.__\u003Cclinit\u003E(); JTextField jtextField4 = new JTextField(DefaultChartEditor.localizationResources.getString("No_editor_implemented")); ((JComponent) jtextField4).setEnabled(false); ((Container) jpanel3).add((Component) jtextField4); JButton.__\u003Cclinit\u003E(); JButton jbutton5 = new JButton(DefaultChartEditor.localizationResources.getString("Edit...")); ((AbstractButton) jbutton5).setEnabled(false); ((Container) jpanel3).add((Component) jbutton5); ((Container) jpanel2).add((Component) jpanel3, (object) "North"); ((Container) jpanel1).add((Component) jpanel2, (object) "North"); JPanel.__\u003Cclinit\u003E(); JPanel jpanel9 = new JPanel((LayoutManager) new BorderLayout()); TextTitle title = obj0.getTitle(); Plot plot = obj0.getPlot(); JTabbedPane jtabbedPane = new JTabbedPane(); this.titleEditor = new DefaultTitleEditor((Title) title); ((JComponent) this.titleEditor).setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); jtabbedPane.addTab(DefaultChartEditor.localizationResources.getString("Title"), (Component) this.titleEditor); this.plotEditor = new DefaultPlotEditor(plot); ((JComponent) this.plotEditor).setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); jtabbedPane.addTab(DefaultChartEditor.localizationResources.getString("Plot"), (Component) this.plotEditor); jtabbedPane.add(DefaultChartEditor.localizationResources.getString("Other"), (Component) jpanel1); ((Container) jpanel9).add((Component) jtabbedPane, (object) "North"); ((Container) this).add((Component) jpanel9); }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { string routine = "StateMod_Save_JDialog.setupGUI"; addWindowListener(this); PropList p = new PropList("StateMod_Save_JDialog.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=MultipleDiscontinuousRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { __tableModel = new StateMod_Save_TableModel(__dataset); StateMod_Save_CellRenderer crr = new StateMod_Save_CellRenderer(__tableModel); jsw = new JScrollWorksheet(crr, __tableModel, p); __worksheet = jsw.getJWorksheet(); widths = crr.getColumnWidths(); // Select all the rows initially... __worksheet.selectAllRows(); } catch (Exception e) { Message.printWarning(1, routine, "Error building worksheet."); Message.printWarning(2, routine, e); jsw = new JScrollWorksheet(0, 0, p); __worksheet = jsw.getJWorksheet(); } __worksheet.setPreferredScrollableViewportSize(null); __worksheet.setHourglassJFrame(__parent); __helpButton = new SimpleJButton(__BUTTON_HELP, this); __helpButton.setEnabled(false); __saveButton = new SimpleJButton(__BUTTON_SAVE, this); __saveButton.setToolTipText("Save data to file(s)."); __cancelButton = new SimpleJButton(__BUTTON_CANCEL, this); __cancelButton.setToolTipText("Cancel without saving data to file(s)."); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); JGUIUtil.addComponent(panel, new JLabel("Data from the following files have been modified."), 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(panel, new JLabel("Select files to be saved and press the \"Save Selected Files\" button."), 0, 1, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(panel, new JLabel("To change the filenames, use the Data...Control...Response menu"), 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(panel, new JLabel("Data set base name (from *.rsp): "), 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST); JGUIUtil.addComponent(panel, new JLabel(__dataset.getBaseName()), 1, 3, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST); JGUIUtil.addComponent(panel, new JLabel("Data set directory: "), 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST); JGUIUtil.addComponent(panel, new JLabel(__dataset.getDataSetDirectory()), 1, 4, 1, 1, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST); __updateCheckbox = new JCheckBox((string)null, true); JGUIUtil.addComponent(panel, __updateCheckbox, 0, 6, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST); JGUIUtil.addComponent(panel, new JLabel("Carry forward old file comments?"), 1, 6, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); getContentPane().add("North", panel); getContentPane().add("Center", jsw); JPanel button_panel = new JPanel(); button_panel.add(__saveButton); button_panel.add(__cancelButton); // button_panel.add(__helpButton); JPanel bottom_panel = new JPanel(); bottom_panel.setLayout(new BorderLayout()); getContentPane().add("South", bottom_panel); bottom_panel.add("South", button_panel); pack(); setSize(700, 500); JGUIUtil.center(this); if (widths != null) { __worksheet.setColumnWidths(widths, __parent.getGraphics()); } setVisible(true); }
public DefaultTitleEditor([In] Title obj0) { base.\u002Ector(); DefaultTitleEditor defaultTitleEditor = this; TextTitle textTitle1; if (obj0 != null) { textTitle1 = (TextTitle) obj0; } else { TextTitle.__\u003Cclinit\u003E(); textTitle1 = new TextTitle(DefaultTitleEditor.localizationResources.getString("Title")); } TextTitle textTitle2 = textTitle1; this.showTitle = obj0 != null; this.titleFont = textTitle2.getFont(); JTextField.__\u003Cclinit\u003E(); this.titleField = new JTextField(textTitle2.getText()); PaintSample.__\u003Cclinit\u003E(); this.titlePaint = new PaintSample(textTitle2.getPaint()); ((Container) this).setLayout((LayoutManager) new BorderLayout()); JPanel.__\u003Cclinit\u003E(); JPanel jpanel1 = new JPanel((LayoutManager) new BorderLayout()); ((JComponent) jpanel1).setBorder((Border) BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), DefaultTitleEditor.localizationResources.getString("General"))); JPanel.__\u003Cclinit\u003E(); JPanel jpanel2 = new JPanel((LayoutManager) new LCBLayout(4)); ((JComponent) jpanel2).setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); JPanel jpanel3 = jpanel2; JLabel.__\u003Cclinit\u003E(); JLabel jlabel1 = new JLabel(DefaultTitleEditor.localizationResources.getString("Show_Title")); ((Container) jpanel3).add((Component) jlabel1); this.showTitleCheckBox = new JCheckBox(); ((AbstractButton) this.showTitleCheckBox).setSelected(this.showTitle); ((AbstractButton) this.showTitleCheckBox).setActionCommand("ShowTitle"); ((AbstractButton) this.showTitleCheckBox).addActionListener((ActionListener) this); ((Container) jpanel2).add((Component) new JPanel()); ((Container) jpanel2).add((Component) this.showTitleCheckBox); JLabel.__\u003Cclinit\u003E(); JLabel jlabel2 = new JLabel(DefaultTitleEditor.localizationResources.getString("Text")); ((Container) jpanel2).add((Component) jlabel2); ((Container) jpanel2).add((Component) this.titleField); ((Container) jpanel2).add((Component) new JPanel()); JLabel.__\u003Cclinit\u003E(); JLabel jlabel3 = new JLabel(DefaultTitleEditor.localizationResources.getString("Font")); FontDisplayField.__\u003Cclinit\u003E(); this.fontfield = (JTextField) new FontDisplayField(this.titleFont); JButton.__\u003Cclinit\u003E(); this.selectFontButton = new JButton(DefaultTitleEditor.localizationResources.getString("Select...")); ((AbstractButton) this.selectFontButton).setActionCommand("SelectFont"); ((AbstractButton) this.selectFontButton).addActionListener((ActionListener) this); ((Container) jpanel2).add((Component) jlabel3); ((Container) jpanel2).add((Component) this.fontfield); ((Container) jpanel2).add((Component) this.selectFontButton); JLabel.__\u003Cclinit\u003E(); JLabel jlabel4 = new JLabel(DefaultTitleEditor.localizationResources.getString("Color")); JButton.__\u003Cclinit\u003E(); this.selectPaintButton = new JButton(DefaultTitleEditor.localizationResources.getString("Select...")); ((AbstractButton) this.selectPaintButton).setActionCommand("SelectPaint"); ((AbstractButton) this.selectPaintButton).addActionListener((ActionListener) this); ((Container) jpanel2).add((Component) jlabel4); ((Container) jpanel2).add((Component) this.titlePaint); ((Container) jpanel2).add((Component) this.selectPaintButton); this.enableOrDisableControls(); ((Container) jpanel1).add((Component) jpanel2); ((Container) this).add((Component) jpanel1, (object) "North"); }
public DefaultPlotEditor([In] Plot obj0) { base.\u002Ector(); DefaultPlotEditor defaultPlotEditor = this; this.plotInsets = obj0.getInsets(); PaintSample.__\u003Cclinit\u003E(); this.backgroundPaintSample = new PaintSample(obj0.getBackgroundPaint()); StrokeSample.__\u003Cclinit\u003E(); this.outlineStrokeSample = new StrokeSample(obj0.getOutlineStroke()); PaintSample.__\u003Cclinit\u003E(); this.outlinePaintSample = new PaintSample(obj0.getOutlinePaint()); if (obj0 is CategoryPlot) this.plotOrientation = ((CategoryPlot) obj0).getOrientation(); else if (obj0 is XYPlot) this.plotOrientation = ((XYPlot) obj0).getOrientation(); if (obj0 is CategoryPlot) { CategoryItemRenderer renderer = ((CategoryPlot) obj0).getRenderer(); if (renderer is LineAndShapeRenderer) { LineAndShapeRenderer andShapeRenderer = (LineAndShapeRenderer) renderer; this.drawLines = BooleanUtilities.valueOf(andShapeRenderer.getBaseLinesVisible()); this.drawShapes = BooleanUtilities.valueOf(andShapeRenderer.getBaseShapesVisible()); } } else if (obj0 is XYPlot) { XYItemRenderer renderer = ((XYPlot) obj0).getRenderer(); if (renderer is StandardXYItemRenderer) { StandardXYItemRenderer standardXyItemRenderer = (StandardXYItemRenderer) renderer; this.drawLines = BooleanUtilities.valueOf(standardXyItemRenderer.getPlotLines()); this.drawShapes = BooleanUtilities.valueOf(standardXyItemRenderer.getBaseShapesVisible()); } } ((Container) this).setLayout((LayoutManager) new BorderLayout()); this.availableStrokeSamples = new StrokeSample[4]; this.availableStrokeSamples[0] = new StrokeSample((Stroke) null); StrokeSample[] strokeSampleArray1 = this.availableStrokeSamples; int index1 = 1; StrokeSample.__\u003Cclinit\u003E(); StrokeSample strokeSample1 = new StrokeSample((Stroke) new BasicStroke(1f)); strokeSampleArray1[index1] = strokeSample1; StrokeSample[] strokeSampleArray2 = this.availableStrokeSamples; int index2 = 2; StrokeSample.__\u003Cclinit\u003E(); StrokeSample strokeSample2 = new StrokeSample((Stroke) new BasicStroke(2f)); strokeSampleArray2[index2] = strokeSample2; StrokeSample[] strokeSampleArray3 = this.availableStrokeSamples; int index3 = 3; StrokeSample.__\u003Cclinit\u003E(); StrokeSample strokeSample3 = new StrokeSample((Stroke) new BasicStroke(3f)); strokeSampleArray3[index3] = strokeSample3; JPanel.__\u003Cclinit\u003E(); JPanel jpanel1 = new JPanel((LayoutManager) new BorderLayout()); ((JComponent) jpanel1).setBorder((Border) BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), new StringBuffer().append(obj0.getPlotType()).append(DefaultPlotEditor.localizationResources.getString(":")).toString())); JPanel.__\u003Cclinit\u003E(); JPanel jpanel2 = new JPanel((LayoutManager) new BorderLayout()); ((JComponent) jpanel2).setBorder((Border) BorderFactory.createTitledBorder(DefaultPlotEditor.localizationResources.getString("General"))); JPanel.__\u003Cclinit\u003E(); JPanel jpanel3 = new JPanel((LayoutManager) new LCBLayout(7)); ((JComponent) jpanel3).setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); JPanel jpanel4 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel1 = new JLabel(DefaultPlotEditor.localizationResources.getString("Outline_stroke")); ((Container) jpanel4).add((Component) jlabel1); JButton.__\u003Cclinit\u003E(); JButton jbutton1 = new JButton(DefaultPlotEditor.localizationResources.getString("Select...")); ((AbstractButton) jbutton1).setActionCommand("OutlineStroke"); ((AbstractButton) jbutton1).addActionListener((ActionListener) this); ((Container) jpanel3).add((Component) this.outlineStrokeSample); ((Container) jpanel3).add((Component) jbutton1); JPanel jpanel5 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel2 = new JLabel(DefaultPlotEditor.localizationResources.getString("Outline_Paint")); ((Container) jpanel5).add((Component) jlabel2); JButton.__\u003Cclinit\u003E(); JButton jbutton2 = new JButton(DefaultPlotEditor.localizationResources.getString("Select...")); ((AbstractButton) jbutton2).setActionCommand("OutlinePaint"); ((AbstractButton) jbutton2).addActionListener((ActionListener) this); ((Container) jpanel3).add((Component) this.outlinePaintSample); ((Container) jpanel3).add((Component) jbutton2); JPanel jpanel6 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel3 = new JLabel(DefaultPlotEditor.localizationResources.getString("Background_paint")); ((Container) jpanel6).add((Component) jlabel3); JButton.__\u003Cclinit\u003E(); JButton jbutton3 = new JButton(DefaultPlotEditor.localizationResources.getString("Select...")); ((AbstractButton) jbutton3).setActionCommand("BackgroundPaint"); ((AbstractButton) jbutton3).addActionListener((ActionListener) this); ((Container) jpanel3).add((Component) this.backgroundPaintSample); ((Container) jpanel3).add((Component) jbutton3); if (this.plotOrientation != null) { int num = !this.plotOrientation.equals((object) PlotOrientation.__\u003C\u003EVERTICAL) ? 1 : 0; JPanel jpanel7 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel4 = new JLabel(DefaultPlotEditor.localizationResources.getString("Orientation")); ((Container) jpanel7).add((Component) jlabel4); JComboBox.__\u003Cclinit\u003E(); this.orientationCombo = new JComboBox((object[]) DefaultPlotEditor.orientationNames); this.orientationCombo.setSelectedIndex(num); this.orientationCombo.setActionCommand("Orientation"); this.orientationCombo.addActionListener((ActionListener) this); ((Container) jpanel3).add((Component) new JPanel()); ((Container) jpanel3).add((Component) this.orientationCombo); } if (this.drawLines != null) { JPanel jpanel7 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel4 = new JLabel(DefaultPlotEditor.localizationResources.getString("Draw_lines")); ((Container) jpanel7).add((Component) jlabel4); this.drawLinesCheckBox = new JCheckBox(); ((AbstractButton) this.drawLinesCheckBox).setSelected(this.drawLines.booleanValue()); ((AbstractButton) this.drawLinesCheckBox).setActionCommand("DrawLines"); ((AbstractButton) this.drawLinesCheckBox).addActionListener((ActionListener) this); ((Container) jpanel3).add((Component) new JPanel()); ((Container) jpanel3).add((Component) this.drawLinesCheckBox); } if (this.drawShapes != null) { JPanel jpanel7 = jpanel3; JLabel.__\u003Cclinit\u003E(); JLabel jlabel4 = new JLabel(DefaultPlotEditor.localizationResources.getString("Draw_shapes")); ((Container) jpanel7).add((Component) jlabel4); this.drawShapesCheckBox = new JCheckBox(); ((AbstractButton) this.drawShapesCheckBox).setSelected(this.drawShapes.booleanValue()); ((AbstractButton) this.drawShapesCheckBox).setActionCommand("DrawShapes"); ((AbstractButton) this.drawShapesCheckBox).addActionListener((ActionListener) this); ((Container) jpanel3).add((Component) new JPanel()); ((Container) jpanel3).add((Component) this.drawShapesCheckBox); } ((Container) jpanel2).add((Component) jpanel3, (object) "North"); JPanel.__\u003Cclinit\u003E(); JPanel jpanel8 = new JPanel((LayoutManager) new BorderLayout()); ((JComponent) jpanel8).setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); ((Container) jpanel8).add((Component) jpanel2, (object) "North"); JTabbedPane jtabbedPane = new JTabbedPane(); ((JComponent) jtabbedPane).setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); Axis axis = (Axis) null; if (obj0 is CategoryPlot) axis = (Axis) ((CategoryPlot) obj0).getDomainAxis(); else if (obj0 is XYPlot) axis = (Axis) ((XYPlot) obj0).getDomainAxis(); this.domainAxisPropertyPanel = DefaultAxisEditor.getInstance(axis); if (this.domainAxisPropertyPanel != null) { ((JComponent) this.domainAxisPropertyPanel).setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); jtabbedPane.add(DefaultPlotEditor.localizationResources.getString("Domain_Axis"), (Component) this.domainAxisPropertyPanel); } ValueAxis valueAxis = (ValueAxis) null; if (obj0 is CategoryPlot) valueAxis = ((CategoryPlot) obj0).getRangeAxis(); else if (obj0 is XYPlot) valueAxis = ((XYPlot) obj0).getRangeAxis(); this.rangeAxisPropertyPanel = DefaultAxisEditor.getInstance((Axis) valueAxis); if (this.rangeAxisPropertyPanel != null) { ((JComponent) this.rangeAxisPropertyPanel).setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); jtabbedPane.add(DefaultPlotEditor.localizationResources.getString("Range_Axis"), (Component) this.rangeAxisPropertyPanel); } ColorBar colorBar = (ColorBar) null; if (obj0 is ContourPlot) colorBar = ((ContourPlot) obj0).getColorBar(); this.colorBarAxisPropertyPanel = DefaultColorBarEditor.getInstance(colorBar); if (this.colorBarAxisPropertyPanel != null) { ((JComponent) this.colorBarAxisPropertyPanel).setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); jtabbedPane.add(DefaultPlotEditor.localizationResources.getString("Color_Bar"), (Component) this.colorBarAxisPropertyPanel); } jtabbedPane.add(DefaultPlotEditor.localizationResources.getString("Appearance"), (Component) jpanel8); ((Container) jpanel1).add((Component) jtabbedPane); ((Container) this).add((Component) jpanel1); }
public FontChooserPanel(Font font) { base.\u002Ector(); FontChooserPanel fontChooserPanel = this; string[] availableFontFamilyNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); ((Container) this).setLayout((LayoutManager) new BorderLayout()); JPanel.__\u003Cclinit\u003E(); JPanel jpanel1 = new JPanel((LayoutManager) new BorderLayout()); JPanel.__\u003Cclinit\u003E(); JPanel jpanel2 = new JPanel((LayoutManager) new BorderLayout()); ((JComponent) jpanel2).setBorder((Border) BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), FontChooserPanel.localizationResources.getString("Font"))); this.fontlist = new JList((object[]) availableFontFamilyNames); JScrollPane.__\u003Cclinit\u003E(); JScrollPane jscrollPane1 = new JScrollPane((Component) this.fontlist); ((JComponent) jscrollPane1).setBorder(BorderFactory.createEtchedBorder()); ((Container) jpanel2).add((Component) jscrollPane1); ((Container) this).add((Component) jpanel2); JPanel.__\u003Cclinit\u003E(); JPanel jpanel3 = new JPanel((LayoutManager) new BorderLayout()); ((JComponent) jpanel3).setBorder((Border) BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), FontChooserPanel.localizationResources.getString("Size"))); JList.__\u003Cclinit\u003E(); this.sizelist = new JList((object[]) FontChooserPanel.__\u003C\u003ESIZES); JScrollPane.__\u003Cclinit\u003E(); JScrollPane jscrollPane2 = new JScrollPane((Component) this.sizelist); ((JComponent) jscrollPane2).setBorder(BorderFactory.createEtchedBorder()); ((Container) jpanel3).add((Component) jscrollPane2); JPanel.__\u003Cclinit\u003E(); JPanel jpanel4 = new JPanel((LayoutManager) new GridLayout(1, 2)); JCheckBox.__\u003Cclinit\u003E(); this.bold = new JCheckBox(FontChooserPanel.localizationResources.getString("Bold")); JCheckBox.__\u003Cclinit\u003E(); this.italic = new JCheckBox(FontChooserPanel.localizationResources.getString("Italic")); ((Container) jpanel4).add((Component) this.bold); ((Container) jpanel4).add((Component) this.italic); ((JComponent) jpanel4).setBorder((Border) BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), FontChooserPanel.localizationResources.getString("Attributes"))); ((Container) jpanel1).add((Component) jpanel3, (object) "Center"); ((Container) jpanel1).add((Component) jpanel4, (object) "South"); ((Container) this).add((Component) jpanel1, (object) "East"); this.setSelectedFont(font); }
private void initGUI() { try { setPreferredSize(new Dimension(400, 300)); { generalPanel = new JPanel(); FlowLayout generalPanelLayout = new FlowLayout(); generalPanelLayout.setAlignment(FlowLayout.LEFT); generalPanel.setLayout(generalPanelLayout); this.addTab("General", null, generalPanel, null); { resolutionPanel = new JPanel(); generalPanel.add(resolutionPanel); FlowLayout resolutionPanelLayout = new FlowLayout(); resolutionPanel.setLayout(resolutionPanelLayout); resolutionPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Resolution", TitledBorder.LEADING, TitledBorder.TOP)); { resolutionCheckBox = new JCheckBox(); resolutionPanel.add(resolutionCheckBox); resolutionCheckBox.setText("Override"); } { jLabel1 = new JLabel(); resolutionPanel.add(jLabel1); jLabel1.setText("Image Width:"); } { resolutionXTextField = new JTextField(); resolutionPanel.add(resolutionXTextField); resolutionXTextField.setText("640"); resolutionXTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } { jLabel2 = new JLabel(); resolutionPanel.add(jLabel2); jLabel2.setText("Image Height:"); } { resolutionYTextField = new JTextField(); resolutionPanel.add(resolutionYTextField); resolutionYTextField.setText("480"); resolutionYTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } } { threadsPanel = new JPanel(); generalPanel.add(threadsPanel); threadsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Threads", TitledBorder.LEADING, TitledBorder.TOP)); { threadCheckBox = new JCheckBox(); threadsPanel.add(threadCheckBox); threadCheckBox.setText("Use All Processors"); } { jLabel3 = new JLabel(); threadsPanel.add(jLabel3); jLabel3.setText("Threads:"); } { threadTextField = new JTextField(); threadsPanel.add(threadTextField); threadTextField.setText("1"); threadTextField.setPreferredSize(new java.awt.Dimension(50, 20)); } } } { rendererPanel = new JPanel(); FlowLayout rendererPanelLayout = new FlowLayout(); rendererPanelLayout.setAlignment(FlowLayout.LEFT); rendererPanel.setLayout(rendererPanelLayout); this.addTab("Renderer", null, rendererPanel, null); { defaultRendererRadioButton = new JRadioButton(); rendererPanel.add(defaultRendererRadioButton); defaultRendererRadioButton.setText("Default Renderer"); } { bucketRendererPanel = new JPanel(); BoxLayout bucketRendererPanelLayout = new BoxLayout(bucketRendererPanel, javax.swing.BoxLayout.Y_AXIS); bucketRendererPanel.setLayout(bucketRendererPanelLayout); rendererPanel.add(bucketRendererPanel); bucketRendererPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Bucket Renderer", TitledBorder.LEADING, TitledBorder.TOP)); { bucketRendererRadioButton = new JRadioButton(); bucketRendererPanel.add(bucketRendererRadioButton); bucketRendererRadioButton.setText("Enable"); } { samplingPanel = new JPanel(); GridLayout samplingPanelLayout = new GridLayout(2, 2); samplingPanelLayout.setColumns(2); samplingPanelLayout.setHgap(5); samplingPanelLayout.setVgap(5); samplingPanelLayout.setRows(2); samplingPanel.setLayout(samplingPanelLayout); bucketRendererPanel.add(samplingPanel); { jLabel5 = new JLabel(); samplingPanel.add(jLabel5); jLabel5.setText("Min:"); } { ComboBoxModel minSamplingComboBoxModel = new DefaultComboBoxModel(new string[] { "Item One", "Item Two" }); minSamplingComboBox = new JComboBox(); samplingPanel.add(minSamplingComboBox); minSamplingComboBox.setModel(minSamplingComboBoxModel); } { jLabel6 = new JLabel(); samplingPanel.add(jLabel6); jLabel6.setText("Max:"); } { ComboBoxModel maxSamplingComboxBoxModel = new DefaultComboBoxModel(new string[] { "Item One", "Item Two" }); maxSamplingComboxBox = new JComboBox(); samplingPanel.add(maxSamplingComboxBox); maxSamplingComboxBox.setModel(maxSamplingComboxBoxModel); } } } } } catch (Exception e) { e.printStackTrace(); } }
//-------- //-------- Constructors //-------- /// <summary> /// Constructor a frame to contain the device data. Provide /// the device and the log file name /// </summary> public TagMainFrame() : base("1-Wire Tag Viewer") { // construct the frame //set the look and feel to the system look and feel try { UIManager.LookAndFeel = UIManager.SystemLookAndFeelClassName; } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } // add an event listener to end the aplication when the frame is closed addWindowListener(new WindowAdapterAnonymousInnerClassHelper(this, e)); // create the main panel mainPanel = new JPanel(new BorderLayout(10, 10)); // create the sub-pannels northPanel = new JPanel(); northPanel.Border = BorderFactory.createLoweredBevelBorder(); centerPanel = new JPanel(); centerPanel.Layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); southPanel = new JPanel(); southPanel.Layout = new BoxLayout(southPanel, BoxLayout.Y_AXIS); southPanel.Border = BorderFactory.createLoweredBevelBorder(); westPanel = new JPanel(); westPanel.Border = BorderFactory.createRaisedBevelBorder(); westPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); eastPanel = new JPanel(); eastPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); // fill the panels // north logLabel = new JLabel("Log Filename: "); northPanel.add(logLabel); logField = new JTextField("log.txt", 20); logField.addActionListener(this); northPanel.add(logField); // center listData = new DefaultListModel(); listData.addElement(" "); listData.addElement(" "); listData.addElement(" "); listData.addElement(" "); pathList = new JList(listData); pathList.VisibleRowCount = 5; scrollPanel = new JScrollPane(pathList); scrollPanel.Border = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "1-Wire Paths to Search"); centerPanel.add(scrollPanel); // west scanCheck = new JCheckBox("Scan 1-Wire Paths for XML Tags", false); scanCheck.addActionListener(this); westPanel.add(scanCheck); // south portLabel = new JLabel("Adapter:"); southPanel.add(portLabel); statusLabel = new JLabel("Status:"); southPanel.add(statusLabel); // add to main mainPanel.add(northPanel, BorderLayout.NORTH); mainPanel.add(centerPanel, BorderLayout.CENTER); mainPanel.add(southPanel, BorderLayout.SOUTH); mainPanel.add(eastPanel, BorderLayout.EAST); mainPanel.add(westPanel, BorderLayout.WEST); // add to frame ContentPane.add(mainPanel); // pack the frame pack(); // resize the window and put in random location Dimension current_sz = Size; Size = new Dimension(current_sz.width * 5 / 4, current_sz.height); Toolkit tool = Toolkit.DefaultToolkit; Dimension mx = tool.ScreenSize; Dimension sz = Size; Random rand = new Random(); setLocation((mx.width - sz.width) / 2, (mx.height - sz.height) / 2); // clear out the listbox data listData.removeAllElements(); // make visible Visible = true; }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { addWindowListener(__parent); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); int y = 0; __downstreamIDJTextField = new JTextField(10); __downstreamIDJTextField.setEditable(false); __downstreamIDJTextField.setText(__ds.getCommonID()); __upstreamIDComboBox = new SimpleJComboBox(false); __upstreamIDComboBox.setPrototypeDisplayValue("[none] - Start a new TributaryXX"); __nodeNameJTextField = new JTextField(10); __nodeNameJTextField.addKeyListener(this); string[] usid = __ds.getUpstreamNodesIDs(); for (int i = 0; i < usid.Length; i++) { __upstreamIDComboBox.add(usid[i]); } __upstreamIDComboBox.add("[none] - Start a new Tributary"); __nodeTypeComboBox = new SimpleJComboBox(); __nodeTypeComboBox.add(__NODE_CONFLUENCE); __nodeTypeComboBox.add(__NODE_DIVERSION); __nodeTypeComboBox.add(__NODE_DIVERSION_AND_WELL); __nodeTypeComboBox.add(__NODE_INSTREAM_FLOW); __nodeTypeComboBox.add(__NODE_OTHER); __nodeTypeComboBox.add(__NODE_PLAN); __nodeTypeComboBox.add(__NODE_RESERVOIR); __nodeTypeComboBox.add(__NODE_STREAMFLOW); __nodeTypeComboBox.add(__NODE_WELL); __nodeTypeComboBox.add(__NODE_XCONFLUENCE); __nodeTypeComboBox.select(__NODE_STREAMFLOW); __nodeTypeComboBox.setMaximumRowCount(__nodeTypeComboBox.getItemCount()); __nodeTypeComboBox.addActionListener(this); __naturalFlowJCheckBox = new JCheckBox(); __naturalFlowJCheckBox.addActionListener(this); __importJCheckBox = new JCheckBox(); __importJCheckBox.addActionListener(this); JPanel top = new JPanel(); top.setLayout(new GridBagLayout()); top.setBorder(BorderFactory.createTitledBorder("Existing nodes")); JPanel bottom = new JPanel(); bottom.setLayout(new GridBagLayout()); bottom.setBorder(BorderFactory.createTitledBorder("New Node Data")); JGUIUtil.addComponent(panel, top, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, bottom, 0, 1, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.WEST); y = 0; JGUIUtil.addComponent(top, new JLabel("Downstream node: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __downstreamIDJTextField, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(top, new JLabel("Upstream node: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(top, __upstreamIDComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; y = 0; JGUIUtil.addComponent(bottom, new JLabel("Node ID: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(bottom, __nodeNameJTextField, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(bottom, new JLabel("Node type: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(bottom, __nodeTypeComboBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(bottom, new JLabel("Is natural flow?: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(bottom, __naturalFlowJCheckBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); y++; JGUIUtil.addComponent(bottom, new JLabel("Is import?: "), 0, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(bottom, __importJCheckBox, 1, y, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JPanel southPanel = new JPanel(); southPanel.setLayout(new GridBagLayout()); __okJButton = new JButton(__BUTTON_OK); __okJButton.addActionListener(this); __okJButton.setEnabled(false); JButton cancelButton = new JButton(__BUTTON_CANCEL); cancelButton.addActionListener(this); JGUIUtil.addComponent(southPanel, __okJButton, 0, 0, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(southPanel, cancelButton, 1, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); getContentPane().add(panel); getContentPane().add(southPanel, "South"); pack(); 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); } }
//-------- //-------- Constructors //-------- /// <summary> /// Constructor a frame to contain the device data. Provide /// the device and the log file name /// </summary> public DeviceFrame(TaggedDevice dev, string logFile) : base(dev.DeviceContainer.AddressAsString) { // construct the frame // init pollDelay = 0; readButtonClick = false; num_format = NumberFormat.Instance; num_format.MaximumFractionDigits = 2; num_format.MinimumFractionDigits = 0; num_format.MinimumIntegerDigits = 2; num_format.GroupingUsed = false; lastReading = "none"; // get ref to the tagged device and log file this.dev = dev; this.logFile = logFile; // set the look and feel to the system look and feel try { UIManager.LookAndFeel = UIManager.SystemLookAndFeelClassName; } catch (Exception e) { Debug.WriteLine(e.ToString()); Debug.Write(e.StackTrace); } // add an event listener to end the aplication when the frame is closed addWindowListener(new WindowAdapterAnonymousInnerClassHelper(this, e)); // create the main panel mainPanel = new JPanel(new GridLayout(3, 1)); // create the sub-panels topPanel = new JPanel(); topPanel.Layout = new BoxLayout(topPanel, BoxLayout.Y_AXIS); topPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); centerPanel = new JPanel(); centerPanel.Layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); centerPanel.Background = Color.white; bottomPanel = new JPanel(); bottomPanel.Layout = new BoxLayout(bottomPanel, BoxLayout.Y_AXIS); bottomPanel.Border = BorderFactory.createEmptyBorder(10, 10, 10, 10); // fill the panels // top clusterLabel = new JLabel("Cluster: " + dev.ClusterName); topPanel.add(clusterLabel); mainLabel = new JLabel(dev.Label); mainLabel.HorizontalAlignment = JLabel.CENTER; mainLabel.Font = new Font("SansSerif", Font.PLAIN, 20); topPanel.add(mainLabel); logCheck = new JCheckBox("Logging Enable", false); logCheck.addActionListener(this); topPanel.add(logCheck); // center timeLabel = new JLabel("Last Reading: none"); timeLabel.HorizontalAlignment = JLabel.CENTER; centerPanel.add(timeLabel); // bottom readButton = new JButton("Read Once"); readButton.AlignmentX = Component.LEFT_ALIGNMENT; readButton.addActionListener(this); bottomPanel.add(readButton); string[] selectionStrings = new string[] { "No Polling", "1 second", "30 seconds", "1 minute", "10 minutes", "1 hour" }; pollCombo = new JComboBox(selectionStrings); pollCombo.Editable = false; pollCombo.AlignmentX = Component.LEFT_ALIGNMENT; pollCombo.addActionListener(this); bottomPanel.add(pollCombo); pathLabel = new JLabel("Path: " + dev.OWPath.ToString()); pathLabel.AlignmentX = Component.LEFT_ALIGNMENT; bottomPanel.add(pathLabel); // add to main mainPanel.add(topPanel); mainPanel.add(centerPanel); mainPanel.add(bottomPanel); // add to frame ContentPane.add(mainPanel); // pack the frame pack(); // resize the window and put in random location Dimension current_sz = Size; Size = new Dimension(current_sz.width * 3 / 2, current_sz.height); Toolkit tool = Toolkit.DefaultToolkit; Dimension mx = tool.ScreenSize; Dimension sz = Size; Random rand = new Random(); setLocation(rand.Next((mx.width - sz.width) / 2), rand.Next((mx.height - sz.height) / 2)); // make visible Visible = 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); }
public DefaultNumberAxisEditor([In] NumberAxis obj0) : base((Axis) obj0) { DefaultNumberAxisEditor numberAxisEditor = this; this.autoRange = obj0.isAutoRange(); this.minimumValue = obj0.getLowerBound(); this.maximumValue = obj0.getUpperBound(); PaintSample.__\u003Cclinit\u003E(); this.gridPaintSample = new PaintSample((Paint) Color.blue); StrokeSample.__\u003Cclinit\u003E(); this.gridStrokeSample = new StrokeSample((Stroke) new BasicStroke(1f)); this.availableStrokeSamples = new StrokeSample[3]; StrokeSample[] strokeSampleArray1 = this.availableStrokeSamples; int index1 = 0; StrokeSample.__\u003Cclinit\u003E(); StrokeSample strokeSample1 = new StrokeSample((Stroke) new BasicStroke(1f)); strokeSampleArray1[index1] = strokeSample1; StrokeSample[] strokeSampleArray2 = this.availableStrokeSamples; int index2 = 1; StrokeSample.__\u003Cclinit\u003E(); StrokeSample strokeSample2 = new StrokeSample((Stroke) new BasicStroke(2f)); strokeSampleArray2[index2] = strokeSample2; StrokeSample[] strokeSampleArray3 = this.availableStrokeSamples; int index3 = 2; StrokeSample.__\u003Cclinit\u003E(); StrokeSample strokeSample3 = new StrokeSample((Stroke) new BasicStroke(3f)); strokeSampleArray3[index3] = strokeSample3; JTabbedPane otherTabs = this.getOtherTabs(); JPanel.__\u003Cclinit\u003E(); JPanel jpanel1 = new JPanel((LayoutManager) new LCBLayout(3)); ((JComponent) jpanel1).setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); ((Container) jpanel1).add((Component) new JPanel()); JCheckBox.__\u003Cclinit\u003E(); this.autoRangeCheckBox = new JCheckBox(DefaultNumberAxisEditor.localizationResources.getString("Auto-adjust_range"), this.autoRange); ((AbstractButton) this.autoRangeCheckBox).setActionCommand("AutoRangeOnOff"); ((AbstractButton) this.autoRangeCheckBox).addActionListener((ActionListener) this); ((Container) jpanel1).add((Component) this.autoRangeCheckBox); ((Container) jpanel1).add((Component) new JPanel()); JPanel jpanel2 = jpanel1; JLabel.__\u003Cclinit\u003E(); JLabel jlabel1 = new JLabel(DefaultNumberAxisEditor.localizationResources.getString("Minimum_range_value")); ((Container) jpanel2).add((Component) jlabel1); JTextField.__\u003Cclinit\u003E(); this.minimumRangeValue = new JTextField(Double.toString(this.minimumValue)); ((JComponent) this.minimumRangeValue).setEnabled(!this.autoRange); this.minimumRangeValue.setActionCommand("MinimumRange"); this.minimumRangeValue.addActionListener((ActionListener) this); ((Component) this.minimumRangeValue).addFocusListener((FocusListener) this); ((Container) jpanel1).add((Component) this.minimumRangeValue); ((Container) jpanel1).add((Component) new JPanel()); JPanel jpanel3 = jpanel1; JLabel.__\u003Cclinit\u003E(); JLabel jlabel2 = new JLabel(DefaultNumberAxisEditor.localizationResources.getString("Maximum_range_value")); ((Container) jpanel3).add((Component) jlabel2); JTextField.__\u003Cclinit\u003E(); this.maximumRangeValue = new JTextField(Double.toString(this.maximumValue)); ((JComponent) this.maximumRangeValue).setEnabled(!this.autoRange); this.maximumRangeValue.setActionCommand("MaximumRange"); this.maximumRangeValue.addActionListener((ActionListener) this); ((Component) this.maximumRangeValue).addFocusListener((FocusListener) this); ((Container) jpanel1).add((Component) this.maximumRangeValue); ((Container) jpanel1).add((Component) new JPanel()); otherTabs.add(DefaultNumberAxisEditor.localizationResources.getString("Range"), (Component) jpanel1); }
/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { string routine = "setupGUI"; addWindowListener(this); __addRowButton = new SimpleJButton(__BUTTON_ADD_ROW, this); __deleteRowButton = new SimpleJButton(__BUTTON_DELETE_ROW, this); __saveTemplateButton = new SimpleJButton(__BUTTON_SAVE_FILE, this); __clearWorksheetButton = new SimpleJButton(__BUTTON_CLEAR_LIST, this); __loadTemplateButton = new SimpleJButton(__BUTTON_LOAD_FILE, this); __helpButton = new SimpleJButton(__BUTTON_HELP, this); __helpButton.setEnabled(false); __closeButton = new SimpleJButton(__BUTTON_CLOSE, this); __useAllJCheckBox = new JCheckBox(__CHECKBOX_USE_ALL, false); __useAllJCheckBox.addActionListener(this); // Make a main panel to be the resizable body of the frame... JPanel main_JPanel = new JPanel(); GridBagLayout gb = new GridBagLayout(); main_JPanel.setLayout(gb); GridLayout gl = new GridLayout(2, 2, 2, 2); JPanel top_panel = new JPanel(); top_panel.setLayout(gl); JPanel radio_panel = new JPanel(); radio_panel.setLayout(gb); GridLayout gl2 = new GridLayout(1, 0, 2, 0); JPanel bottom_JPanel = new JPanel(); bottom_JPanel.setLayout(gl2); FlowLayout fl = new FlowLayout(FlowLayout.CENTER); JPanel final_button_JPanel = new JPanel(); final_button_JPanel.setLayout(fl); JPanel grid_JPanel = new JPanel(); grid_JPanel.setLayout(gb); // add add a row, delete selected rows, clear spreadsheet, // select template, save template buttons top_panel.add(__addRowButton); top_panel.add(__deleteRowButton); top_panel.add(__clearWorksheetButton); top_panel.add(__loadTemplateButton); int y = 0; JGUIUtil.addComponent(main_JPanel, top_panel, 0, y, 10, 3, 0, 0, 10, 10, 10, 10, GridBagConstraints.NONE, GridBagConstraints.NORTH); y += 3; JGUIUtil.addComponent(main_JPanel, __useAllJCheckBox, 0, ++y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); PropList p = new PropList("StateMod_OutputControl_JFrame.JWorksheet"); p.add("JWorksheet.ShowRowHeader=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.ShowPopupMenu=true"); int[] widths = null; JScrollWorksheet jsw = null; try { __tableModel = new StateMod_OutputControl_TableModel(this, new List <object>(), (System.Collections.IList)__riverNetworkComp.getData()); StateMod_OutputControl_CellRenderer cro = new StateMod_OutputControl_CellRenderer(__tableModel); jsw = new JScrollWorksheet(cro, __tableModel, p); __worksheet = jsw.getJWorksheet(); System.Collections.IList v = StateMod_Util.arrayToList(StateMod_GraphNode.node_types); v.Add("Other"); __worksheet.setColumnJComboBoxValues(0, v); __worksheet.setCellSpecificJComboBoxColumn(1, false); System.Collections.IList offOn = new List <object>(); offOn.Add("Off"); offOn.Add("On"); __worksheet.setColumnJComboBoxValues(2, offOn); __tableModel.setWorksheet(__worksheet); widths = cro.getColumnWidths(); } catch (Exception e) { Message.printWarning(1, routine, "Error building worksheet."); Message.printWarning(2, routine, e); jsw = new JScrollWorksheet(0, 0, p); __worksheet = jsw.getJWorksheet(); } __worksheet.setPreferredScrollableViewportSize(null); __worksheet.setHourglassJFrame(this); JGUIUtil.addComponent(grid_JPanel, jsw, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER); JGUIUtil.addComponent(main_JPanel, grid_JPanel, 0, ++y, 10, 12, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER); y += 11; // To account for grid height // Add bottom buttons - these are alphabetical so be // careful if you add more ... final_button_JPanel.add(__closeButton); // REVISIT SAM 2006-03-04 // Help is not currently enabled //final_button_JPanel.add(__helpButton); final_button_JPanel.add(__saveTemplateButton); // Add the final buttons on the bottom to the bottom panel... bottom_JPanel.add(final_button_JPanel); // Add the button panel to the frame... JGUIUtil.addComponent(main_JPanel, bottom_JPanel, 0, ++y, 10, 1, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.SOUTH); // Add the main panel as the resizable content... getContentPane().add("Center", main_JPanel); // Add JTextFields for messages... JPanel message_JPanel = new JPanel(); message_JPanel.setLayout(gb); __messageJTextField = new JTextField(); __messageJTextField.setEditable(false); __statusJTextField = new JTextField(" "); __statusJTextField.setEditable(false); JGUIUtil.addComponent(message_JPanel, __messageJTextField, 0, 0, 9, 1, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); JGUIUtil.addComponent(message_JPanel, __statusJTextField, 9, 0, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTH); getContentPane().add("South", message_JPanel); pack(); setSize(670, 500); JGUIUtil.center(this); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } }