コード例 #1
0
        private void CreateActionBar(Grid layout)
        {
            var row = new RowDefinition();

            row.Height = new GridLength(DisplayConstants.Dimensions.Forms.RdpSection.ActionBarHeight);

            layout.RowDefinitions.Add(row);

            var panel = new DockPanel();

            panel.Background = EasyColour.BrushFromHex(DisplayConstants.Colours.Forms.RdpSection.ActionBarBackgroundGrey);
            var thick = new Thickness(DisplayConstants.Dimensions.Forms.RdpSection.PaddingLeft, 0, DisplayConstants.Dimensions.Forms.RdpSection.PaddingRight, 0);

            panel.Margin = thick;

            Grid.SetRow(panel, 2);

            var border = BorderFactory.BevelFull(DisplayConstants.Colours.Borders.RdpSection.ActionBarBorder);

            border.Margin = thick;
            Grid.SetRow(border, 2);

            layout.Children.Add(panel);
            layout.Children.Add(border);
        }
コード例 #2
0
        private void CreateFormControlBar(Grid layout)
        {
            var borderTop = BorderFactory.BevelTop(DisplayConstants.Colours.Borders.BevelBorderLight);
            var borderBot = BorderFactory.BevelBottom(DisplayConstants.Colours.Borders.BevelBorderDark);

            var formActionBar = new DockPanel();

            formActionBar.Background = EasyColour.BrushFromHex(DisplayConstants.Colours.Forms.StandardBackgroundGrey);

            var row = new RowDefinition();

            row.Height = new GridLength(DisplayConstants.Dimensions.Forms.FormControlBarHeight);

            layout.RowDefinitions.Add(row);
            Grid.SetRow(formActionBar, 2);
            Grid.SetColumn(formActionBar, 0);
            Grid.SetColumnSpan(formActionBar, ColumnCount);

            layout.Children.Add(formActionBar);

            Grid.SetRow(borderBot, 2);
            Grid.SetColumn(borderBot, 0);
            Grid.SetColumnSpan(borderBot, ColumnCount);

            Grid.SetRow(borderTop, 2);
            Grid.SetColumn(borderTop, 0);
            Grid.SetColumnSpan(borderTop, ColumnCount);

            layout.Children.Add(borderTop);
            layout.Children.Add(borderBot);
        }
        /// <summary>
        /// Constructor. </summary>
        /// <param name="annotationDataList"> list of annotation data, if available (can pass null and reset the list
        /// later by calling setAnnotationData()). </param>
        /// <param name="hideIfEmpty"> if true, set the panel to not visible if the list is empty - this may be appropriate
        /// if UI real estate is in short supply and annotations should only be shown if used </param>
        public StateMod_Network_AnnotationDataListJPanel(IList <StateMod_Network_AnnotationData> annotationDataList, StateMod_Network_JComponent networkJComponent, bool hideIfEmpty) : base()
        {
            // Set up the layout manager
            this.setLayout(new GridBagLayout());
            this.setBorder(BorderFactory.createTitledBorder("Annotations"));
            int    y          = 0;
            Insets insetsTLBR = new Insets(0, 0, 0, 0);

            __annotationJList = new JList();
            if (annotationDataList != null)
            {
                setAnnotationData(annotationDataList);
            }
            JGUIUtil.addComponent(this, new JScrollPane(__annotationJList), 0, y, 1, 1, 1.0, 1.0, insetsTLBR, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);
            __hideIfEmpty       = hideIfEmpty;
            __networkJComponent = networkJComponent;

            // Add popup for actions on annotations

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final javax.swing.JPopupMenu popupMenu = new javax.swing.JPopupMenu();
            JPopupMenu popupMenu = new JPopupMenu();
            JMenuItem  removeAllAnnotationsJMenuItem = new JMenuItem(__RemoveAllAnnotationsString);

            removeAllAnnotationsJMenuItem.addActionListener(this);
            popupMenu.add(removeAllAnnotationsJMenuItem);
            __annotationJList.addMouseListener(new MouseAdapterAnonymousInnerClass(this, popupMenu));

            checkVisibility();
        }
コード例 #4
0
        private void CreateSectionSelectionPane(Grid layout)
        {
            var row = new RowDefinition();

            row.Height = GridLength.Auto;
            layout.RowDefinitions.Add(row);

            var border = BorderFactory.BevelRight(DisplayConstants.Colours.Borders.BevelBorderDark);

            Grid.SetRow(border, 3);
            Grid.SetColumn(border, 0);

            var selectionPane = new StackPanel();

            selectionPane.Background = EasyColour.BrushFromHex(DisplayConstants.Colours.Forms.StandardBackgroundGrey);
            selectionPane.Height     = 900;
            Grid.SetRow(selectionPane, 3);
            Grid.SetColumn(selectionPane, 0);

            for (int i = 0; i < 4; i++)
            {
                CreateSectionSelector(selectionPane);
            }

            layout.Children.Add(selectionPane);
            layout.Children.Add(border);
        }
コード例 #5
0
        public CostOSRibbonApplicationMenuPopupPanelSecondary(RibbonApplicationMenuEntryPrimary paramRibbonApplicationMenuEntryPrimary) : base(MENU_TILE_LEVEL_2)
        {
            MaxButtonColumns = 1;
            Border           = BorderFactory.createEmptyBorder();
            int i = paramRibbonApplicationMenuEntryPrimary.SecondaryGroupCount;

            for (sbyte b = 0; b < i; b++)
            {
                string str = paramRibbonApplicationMenuEntryPrimary.getSecondaryGroupTitleAt(b);
                addButtonGroup(str);
                foreach (RibbonApplicationMenuEntrySecondary ribbonApplicationMenuEntrySecondary in paramRibbonApplicationMenuEntryPrimary.getSecondaryGroupEntries(b))
                {
                    JCommandMenuButton jCommandMenuButton = new JCommandMenuButton(ribbonApplicationMenuEntrySecondary.Text, ribbonApplicationMenuEntrySecondary.Icon);
                    jCommandMenuButton.ExtraText         = ribbonApplicationMenuEntrySecondary.DescriptionText;
                    jCommandMenuButton.CommandButtonKind = ribbonApplicationMenuEntrySecondary.EntryKind;
                    jCommandMenuButton.addActionListener(ribbonApplicationMenuEntrySecondary.MainActionListener);
                    jCommandMenuButton.DisplayState         = MENU_TILE_LEVEL_2;
                    jCommandMenuButton.HorizontalAlignment  = 10;
                    jCommandMenuButton.PopupOrientationKind = JCommandButton.CommandButtonPopupOrientationKind.SIDEWARD;
                    jCommandMenuButton.Enabled       = ribbonApplicationMenuEntrySecondary.Enabled;
                    jCommandMenuButton.PopupCallback = ribbonApplicationMenuEntrySecondary.PopupCallback;
                    jCommandMenuButton.ActionKeyTip  = ribbonApplicationMenuEntrySecondary.ActionKeyTip;
                    jCommandMenuButton.PopupKeyTip   = ribbonApplicationMenuEntrySecondary.PopupKeyTip;
                    if (ribbonApplicationMenuEntrySecondary.DisabledIcon != null)
                    {
                        jCommandMenuButton.DisabledIcon = ribbonApplicationMenuEntrySecondary.DisabledIcon;
                    }
                    addButtonToLastGroup(jCommandMenuButton);
                }
            }
        }
コード例 #6
0
 public OfficeBandHostPopupPanel(Component param1Component, Dimension param1Dimension)
 {
     Layout = new BorderLayout();
     add(param1Component, "Center");
     PreferredSize = param1Dimension;
     Size          = param1Dimension;
     Border        = BorderFactory.createEmptyBorder();
 }
コード例 #7
0
        private void CreateTableHeader(Grid superGrid)
        {
            var rowDef = new RowDefinition();

            rowDef.Height = new GridLength(DisplayConstants.Dimensions.Forms.SuperGrid.TableHeaderHeight);
            superGrid.RowDefinitions.Add(rowDef);

            for (int i = 0; i <= 6; i++)
            {
                var dockPanel = new DockPanel();

                var brush = EasyColour.LinearGradientBrushFromHex(DisplayConstants.Colours.GridView.HeaderRowGradientStart,
                                                                  DisplayConstants.Colours.GridView.HeaderRowGradientEnd,
                                                                  90.0);
                dockPanel.Background = brush;

                Grid.SetRow(dockPanel, 0);
                Grid.SetColumn(dockPanel, i);

                var borderTop = BorderFactory.BevelTop(SuperGridColours.HeaderRowBorderTop);
                Grid.SetRow(borderTop, 0);
                Grid.SetColumn(borderTop, i);

                var borderBot = BorderFactory.BevelBottom(SuperGridColours.HeaderRowBorderBottom);
                Grid.SetRow(borderBot, 0);
                Grid.SetColumn(borderBot, i);

                var borderRight = BorderFactory.BevelRight(SuperGridColours.HeaderRowBorderBottom);
                Grid.SetRow(borderRight, 0);
                Grid.SetColumn(borderRight, i);

                var borderLeft = BorderFactory.BevelLeft(SuperGridColours.HeaderRowBorderLeft);
                Grid.SetRow(borderLeft, 0);
                Grid.SetColumn(borderLeft, i);



                superGrid.Children.Add(dockPanel);
                superGrid.Children.Add(borderTop);
                superGrid.Children.Add(borderBot);
                superGrid.Children.Add(borderRight);
                superGrid.Children.Add(borderLeft);



                var label = Labels.SuperGridTitle();
                EasyLayout.SetPosition(superGrid, label, 0, i);

                var split = new GridSplitter();
                split.HorizontalAlignment = HorizontalAlignment.Right;
                split.ResizeDirection     = GridResizeDirection.Columns;
                split.Background          = new SolidColorBrush(Colors.Transparent);
                split.Width = 5;

                EasyLayout.SetPosition(superGrid, split, 0, i);
            }
        }
コード例 #8
0
            public void menuEntryActivated(JPanel param1JPanel)
            {
                param1JPanel.removeAll();
                param1JPanel.Layout = new BorderLayout();
                CostOSRibbonApplicationMenuPopupPanelSecondary costOSRibbonApplicationMenuPopupPanelSecondary = new CostOSRibbonApplicationMenuPopupPanelSecondaryAnonymousInnerClass(this, menuEntry);
                JScrollPane jScrollPane = new JScrollPane(costOSRibbonApplicationMenuPopupPanelSecondary, 20, 31);

                jScrollPane.Border = BorderFactory.createEmptyBorder();
                jScrollPane.Viewport.Background = SECONDARY_MENU_COLOR;
                jScrollPane.Background          = SECONDARY_MENU_COLOR;
                Dimension dimension = costOSRibbonApplicationMenuPopupPanelSecondary.PreferredSize;

                costOSRibbonApplicationMenuPopupPanelSecondary.PreferredSize = new Dimension((param1JPanel.PreferredSize).width - (jScrollPane.VerticalScrollBar.PreferredSize).width, dimension.height);
                param1JPanel.Background = SECONDARY_MENU_COLOR;
                param1JPanel.add(jScrollPane, "Center");
                param1JPanel.revalidate();
            }
コード例 #9
0
        private void CreateSectionSelector(StackPanel stackPanel)
        {
            var fborder = BorderFactory.BevelTop(DisplayConstants.Colours.Borders.BevelBorderLight);

            stackPanel.Children.Add(fborder);

            var panel = new DockPanel();

            panel.Height = DisplayConstants.Dimensions.Forms.SectionSelectorHeight;


            stackPanel.Children.Add(panel);

            var border = BorderFactory.BevelBottom(DisplayConstants.Colours.Borders.BevelBorderDark);

            stackPanel.Children.Add(border);
        }
コード例 #10
0
        private void CreateRows(Grid superGrid)
        {
            for (int i = 1; i <= 25; i++)
            {
                var rowDef = new RowDefinition();
                rowDef.Height = new GridLength(DisplayConstants.Dimensions.Forms.SuperGrid.RowHeight);
                superGrid.RowDefinitions.Add(rowDef);

                for (int j = 0; j <= 6; j++)
                {
                    var dp = new DockPanel();

                    if (i <= 20)
                    {
                        if (i % 2 != 0)
                        {
                            dp.Background = EasyColour.BrushFromHex(SuperGridColours.EvenRowGrey);
                        }
                        else
                        {
                            dp.Background = EasyColour.BrushFromHex(SuperGridColours.OddRowGrey);
                        }
                    }

                    var border = BorderFactory.BevelTop(SuperGridColours.RowBorder);
                    Grid.SetColumn(dp, j);
                    Grid.SetRow(dp, i);

                    Grid.SetColumn(border, j);
                    Grid.SetRow(border, i);

                    superGrid.Children.Add(dp);
                    superGrid.Children.Add(border);

                    if (j != 6 && i <= 20)
                    {
                        var borderRight = BorderFactory.BevelRight(SuperGridColours.RowBorder);
                        Grid.SetColumn(borderRight, j);
                        Grid.SetRow(borderRight, i);

                        superGrid.Children.Add(borderRight);
                    }
                }
            }
        }
コード例 #11
0
        private void JbInit()
        {
            //pf = new PrintFile("out");
            this.AddWindowListener(new _WindowAdapter_110());
            //Set up the input/output fields and let them scroll.
            inputBox.SetLineWrap(true);
            inputBox.SetWrapStyleWord(true);
            outputBox.SetLineWrap(true);
            outputBox.SetWrapStyleWord(true);
            outputBox.SetEditable(false);
            JScrollPane scroll1 = new JScrollPane(inputBox);
            JScrollPane scroll2 = new JScrollPane(outputBox);

            scroll1.SetBorder(BorderFactory.CreateTitledBorder(BorderFactory.CreateEtchedBorder(), "Type a sentence to tag: "));
            scroll2.SetBorder(BorderFactory.CreateTitledBorder(BorderFactory.CreateEtchedBorder(), "Tagged sentence: "));
            //Set up the button for starting tagging
            JPanel buttonPanel = new JPanel();

            buttonPanel.SetBackground(Color.White);
            buttonPanel.ApplyComponentOrientation(ComponentOrientation.RightToLeft);
            FlowLayout fl = new FlowLayout();

            fl.SetAlignment(FlowLayout.Right);
            buttonPanel.SetLayout(fl);
            tagButton.SetText("Tag sentence!");
            tagButton.SetBackground(Color.White);
            buttonPanel.Add(tagButton);
            tagButton.AddActionListener(null);
            //Lay it all out
            this.SetLayout(new GridBagLayout());
            GridBagConstraints c = new GridBagConstraints();

            c.fill      = GridBagConstraints.Both;
            c.gridwidth = GridBagConstraints.Remainder;
            c.weightx   = 4.0;
            c.weighty   = 4.0;
            this.Add(scroll1, c);
            c.weighty = 1.0;
            this.Add(buttonPanel, c);
            c.weighty    = 4.0;
            c.gridheight = GridBagConstraints.Remainder;
            this.Add(scroll2, c);
        }
コード例 #12
0
        public UILabelPanel(Icon paramIcon, string paramString, JComponent paramJComponent) : base(new BorderLayout())
        {
            this.titleLabel           = new JLabel(paramString, paramIcon, 10);
            this.eastLabel            = new JLabel("", 4);
            this.titleLabel.Font      = new Font("SansSerif", 1, 11);
            this.eastLabel.Font       = new Font("SansSerif", 1, 11);
            this.eastLabel.Foreground = Color.BLACK;
            JPanel jPanel = buildHeader(this.titleLabel);

            this.o_topPanel.Border = BorderFactory.createEmptyBorder();
            this.o_topPanel.add(jPanel, "North");
            add(this.o_topPanel, "North");
            if (paramJComponent != null)
            {
                Content = paramJComponent;
            }
            Selected = true;
            updateHeader();
        }
コード例 #13
0
 protected internal virtual JPanel buildHeader(JLabel paramJLabel)
 {
     this.o_eastPanel        = new JPanel(new BorderLayout());
     this.gradientPanel      = createGradientPanel();
     paramJLabel.Opaque      = false;
     this.eastLabel.Opaque   = false;
     this.o_eastPanel.Opaque = false;
     this.o_eastPanel.add(this.eastLabel, "East");
     this.hasEastTextComponent = true;
     this.gradientPanel.add(paramJLabel, "West");
     this.gradientPanel.add(this.o_eastPanel, "East");
     this.gradientPanel.Border = BorderFactory.createEmptyBorder(3, 4, 3, 1);
     this.headerPanel          = new JPanel(new BorderLayout());
     this.headerPanel.add(this.gradientPanel, "Center");
     this.headerPanel.Border = new RaisedHeaderBorder();
     this.headerPanel.Opaque = false;
     this.gradientPanel.setComponentZOrder(paramJLabel, 1);
     this.gradientPanel.setComponentZOrder(this.o_eastPanel, 0);
     return(this.headerPanel);
 }
コード例 #14
0
        private void loadUI()
        {
            JPanel jPanel = new JPanel();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.text.DecimalFormat decimalFormat = (java.text.DecimalFormat)java.text.DecimalFormat.getInstance(java.util.Locale.ENGLISH).clone();
            DecimalFormat decimalFormat = (DecimalFormat)DecimalFormat.getInstance(Locale.ENGLISH).clone();

            decimalFormat.applyPattern("0");
            this.o_progressBar = new JProgressBar(0, this.o_totalTimes);
            this.o_progressBar.StringPainted = true;
            this.o_descriptionLabel          = new JLabel();
            this.o_progressBar.addChangeListener(new ChangeListenerAnonymousInnerClass(this, decimalFormat));
            jPanel.Border = BorderFactory.createEmptyBorder(10, 0, 0, 0);
            jPanel.Layout = new BoxLayout(jPanel, 1);
            jPanel.add(this.o_descriptionLabel);
            jPanel.add(Box.createVerticalStrut(5));
            jPanel.add(this.o_progressBar);
            jPanel.add(Box.createVerticalStrut(5));
            this.o_mainPanel.Border = BorderFactory.createEmptyBorder(8, 8, 8, 8);
            this.o_mainPanel.add(jPanel, "Center");
        }
コード例 #15
0
        private VfpuFrame()
        {
            DefaultCloseOperation = DISPOSE_ON_CLOSE;
            Title = java.util.ResourceBundle.getBundle("pspsharp/languages/pspsharp").getString("VfpuFrame.title");             // NOI18N

            for (int i = 0; i < 8; ++i)
            {
                for (int j = 0; j < 4; ++j)
                {
                    for (int k = 0; k < 4; ++k)
                    {
                        registers[i][j][k] = new JTextField();
                    }
                }
            }

            GroupLayout layout = new GroupLayout(ContentPane);

            ContentPane.Layout = layout;

            for (int i = 0; i < panels.Length; ++i)
            {
                JPanel panel = new JPanel();
                panels[i] = panel;

                GroupLayout l = new GroupLayout(panel);
                panel.Layout = l;
                panel.Border = BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Block " + i), null);

                l.HorizontalGroup = l.createSequentialGroup().addGroup(l.createParallelGroup().addComponent(registers[i][0][0]).addComponent(registers[i][1][0]).addComponent(registers[i][2][0]).addComponent(registers[i][3][0])).addGroup(l.createParallelGroup().addComponent(registers[i][0][1]).addComponent(registers[i][1][1]).addComponent(registers[i][2][1]).addComponent(registers[i][3][1])).addGroup(l.createParallelGroup().addComponent(registers[i][0][2]).addComponent(registers[i][1][2]).addComponent(registers[i][2][2]).addComponent(registers[i][3][2])).addGroup(l.createParallelGroup().addComponent(registers[i][0][3]).addComponent(registers[i][1][3]).addComponent(registers[i][2][3]).addComponent(registers[i][3][3]));
                l.VerticalGroup   = l.createSequentialGroup().addGroup(l.createParallelGroup().addComponent(registers[i][0][0]).addComponent(registers[i][0][1]).addComponent(registers[i][0][2]).addComponent(registers[i][0][3])).addGroup(l.createParallelGroup().addComponent(registers[i][1][0]).addComponent(registers[i][1][1]).addComponent(registers[i][1][2]).addComponent(registers[i][1][3])).addGroup(l.createParallelGroup().addComponent(registers[i][2][0]).addComponent(registers[i][2][1]).addComponent(registers[i][2][2]).addComponent(registers[i][2][3])).addGroup(l.createParallelGroup().addComponent(registers[i][3][0]).addComponent(registers[i][3][1]).addComponent(registers[i][3][2]).addComponent(registers[i][3][3]));
            }

            layout.HorizontalGroup = layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(panels[0]).addComponent(panels[1])).addGroup(layout.createSequentialGroup().addComponent(panels[2]).addComponent(panels[3])).addGroup(layout.createSequentialGroup().addComponent(panels[4]).addComponent(panels[5])).addGroup(layout.createSequentialGroup().addComponent(panels[6]).addComponent(panels[7]));
            layout.VerticalGroup   = layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(panels[0]).addComponent(panels[2]).addComponent(panels[4]).addComponent(panels[6])).addGroup(layout.createSequentialGroup().addComponent(panels[1]).addComponent(panels[3]).addComponent(panels[5]).addComponent(panels[7]));

            MinimumSize = new Dimension(450, 450);
            WindowPropSaver.loadWindowProperties(this);
        }
コード例 #16
0
        private void CreateMainActionBar(Grid layout)
        {
            var border = BorderFactory.BevelBottom(DisplayConstants.Colours.Borders.BevelBorderDark);

            var bar = new DockPanel();

            bar.Background = EasyColour.BrushFromHex(DisplayConstants.Colours.Forms.MainActionBarBackgroundGrey);

            var row = new RowDefinition();

            row.Height = new GridLength(DisplayConstants.Dimensions.Forms.MainActionBarHeight);

            Grid.SetRow(border, 1);
            Grid.SetColumn(border, 0);
            Grid.SetColumnSpan(border, ColumnCount);

            Grid.SetRow(bar, 1);
            Grid.SetColumn(bar, 0);
            Grid.SetColumnSpan(bar, ColumnCount);

            layout.RowDefinitions.Add(row);
            layout.Children.Add(bar);
            layout.Children.Add(border);
        }
コード例 #17
0
    //--------
    //-------- Constructor
    //--------

    /// <summary>
    /// Constructor a deviceFrame with additional features for the actuator
    /// </summary>
    public DeviceFrameActuator(TaggedDevice dev, string logFile) : base(dev, logFile)
    {
        // construct the super

        // create select panel
        selectPanel            = new JPanel();
        selectPanel.AlignmentX = Component.LEFT_ALIGNMENT;
        selectPanel.Border     = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Select Actuator State");

        // create combo box
        actuatorCombo = new JComboBox(((TaggedActuator)dev).Selections);
        Dimension actuatorComboDimension = new Dimension(170, 23);

        actuatorCombo.PreferredSize = actuatorComboDimension;
        actuatorCombo.Editable      = false;
        actuatorCombo.AlignmentX    = Component.LEFT_ALIGNMENT;
        actuatorCombo.addActionListener(this);

        // add combo box to select panel
        selectPanel.add(actuatorCombo);

        // add select panel to the center panel
        centerPanel.add(selectPanel);
    }
コード例 #18
0
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents()
        {
            canvas = new BufferedImage(320, 320, BufferedImage.TYPE_BYTE_GRAY);

            buttonGroup1 = new ButtonGroup();
            buttonGroup2 = new ButtonGroup();
            jPanel4      = new JPanel();
            jSlider2     = new JSlider();
            jLabel1      = new JLabel();
            jPanel2      = new JPanel(new GridBagLayout());
            JLabel canvasLabel = new JLabel(new ImageIcon(canvas));

            jPanel2.add(canvasLabel, null);

            jPanel3       = new JPanel();
            jRadioButton3 = new JRadioButton();
            jRadioButton4 = new JRadioButton();
            jRadioButton5 = new JRadioButton();
            jRadioButton6 = new JRadioButton();
            jRadioButton7 = new JRadioButton();
            jRadioButton8 = new JRadioButton();
            jButton1      = new JButton();

            DefaultCloseOperation = WindowConstants.EXIT_ON_CLOSE;
            Title = "FuNet1 --- powered by Neuroph";

            jPanel4.Border = BorderFactory.createTitledBorder("Line thickness");


            jSlider2.MajorTickSpacing = 10;
            jSlider2.Maximum          = 51;
            jSlider2.Minimum          = 1;
            jSlider2.MinorTickSpacing = 5;
            jSlider2.PaintTicks       = true;
            jSlider2.addChangeListener(new ChangeListenerAnonymousInnerClassHelper(this));

            //        jLabel1.setText("Stroke Size (Radius)");

            GroupLayout jPanel4Layout = new GroupLayout(jPanel4);

            jPanel4.Layout = jPanel4Layout;
            jPanel4Layout.HorizontalGroup = jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 51, short.MaxValue).addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(jLabel1).addComponent(jSlider2, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)).addContainerGap());

            label = new JLabel("");
            Font labelFont = label.Font;

            label.Font = new Font(labelFont.Name, Font.PLAIN, 30);


            jPanel4Layout.VerticalGroup = jPanel4Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(jSlider2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addGroup(jPanel4Layout.createSequentialGroup().addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(jLabel1)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)));

            jPanel2.Background = new Color(0, 0, 0);
            jPanel2.Border     = BorderFactory.createBevelBorder(BevelBorder.RAISED);
            // add the listeners to the label that contains the canvas buffered image
            canvasLabel.addMouseListener(new MouseAdapterAnonymousInnerClassHelper(this));
            canvasLabel.addMouseMotionListener(new MouseMotionAdapterAnonymousInnerClassHelper(this));


            jButton1.Text = "Clear";
            jButton1.addActionListener(new ActionListenerAnonymousInnerClassHelper(this));

            GroupLayout layout = new GroupLayout(ContentPane);

            ContentPane.Layout     = layout;
            layout.HorizontalGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jPanel2, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, short.MaxValue).addGroup(layout.createSequentialGroup().addComponent(jPanel4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jPanel3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jButton1, GroupLayout.DEFAULT_SIZE, 112, short.MaxValue).addComponent(label, GroupLayout.DEFAULT_SIZE, 112, short.MaxValue)))).addContainerGap());
            layout.VerticalGroup   = layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false).addGroup(layout.createSequentialGroup().addGap(4, 4, 4).addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE).addComponent(label, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)).addComponent(jPanel4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, short.MaxValue).addComponent(jPanel3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, short.MaxValue)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, short.MaxValue).addContainerGap());

            Graphics g = canvas.Graphics;

            g.Color = Color.WHITE;
            g.fillRect(0, 0, canvas.Width, canvas.Height);
            repaint();
            pack();
        }         // </editor-fold>
コード例 #19
0
        protected internal virtual object[] getColorSchemeBlueDefaults(UIDefaults paramUIDefaults)
        {
            ColorUIResource colorUIResource1 = new ColorUIResource(applicationBackground);
            ColorUIResource colorUIResource2 = new ColorUIResource(applicationBackground);

            return(new object[] { "OfficeLnF.name", "Office2013", "OfficeLnF.ComboBox.Arrow.Armed.Gradient1", new ColorUIResource(255, 244, 204), "OfficeLnF.ComboBox.Arrow.Armed.Gradient2", new ColorUIResource(255, 212, 151), "OfficeLnF.ComboBox.Arrow.Selected.Gradient1", new ColorUIResource(254, 145, 78), "OfficeLnF.ComboBox.Arrow.Selected.Gradient2", new ColorUIResource(255, 203, 135), "OfficeLnF.ComboBox.Arrow.Normal.Gradient1", new ColorUIResource(195, 218, 249), "OfficeLnF.ComboBox.Arrow.Normal.Gradient2", null, "Office2003LnF.CBMenuItemCheckBGColor", new ColorUIResource(255, 192, 111), "Office2003LnF.CBMenuItemCheckBGSelectedColor", new ColorUIResource(254, 128, 62), "OfficeLnF.HighlightBorderColor", new ColorUIResource(applicationBorderColor), "OfficeLnF.HighlightColor", new ColorUIResource(selectionColor), "Office2003LnF.ToolBarGripLightColor", new ColorUIResource(255, 255, 255), "Office2003LnF.ToolBarGripDarkColor", new ColorUIResource(applicationBorderColor), "Office2003LnF.MenuItemBeginGradientColor", new ColorUIResource(227, 239, 255), "Office2003LnF.MenuItemEndGradientColor", new ColorUIResource(135, 173, 228), "Office2003LnF.PanelGradientColor1", new ColorUIResource(158, 190, 245), "Office2003LnF.PanelGradientColor2", new ColorUIResource(195, 218, 249), "Office2003LnF.ToolBarBeginGradientColor", new ColorUIResource(applicationBackground), "Office2003LnF.ToolBarEndGradientColor", new ColorUIResource(applicationBackground), "Office2003LnF.ToolBarBottomBorderColor", new ColorUIResource(applicationBackground), "Office2003LnF.ToolBarBackgroundColor", new ColorUIResource(applicationBackground), "Office2003LnF.ToolBarButtonArmedBeginGradientColor", new ColorUIResource(selectionColor), "Office2003LnF.ToolBarButtonArmedEndGradientColor", new ColorUIResource(selectionColor), "Office2003LnF.ToolBarButtonSelectedBeginGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.ToolBarButtonSelectedEndGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.MenuBarItemArmedBeginGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.MenuBarItemArmedEndGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.MenuBarItemSelectedBeginGradientColor", new ColorUIResource(selectionDarkerColor), "Office2003LnF.MenuBarItemSelectedEndGradientColor", new ColorUIResource(selectionDarkerColor), "OfficeLnF.MenuBorderColor", new ColorUIResource(0, 45, 150), "UILabelPanel.gradientBegin", new ColorUIResource(gradientBegin), "UILabelPanel.gradientEnd", new ColorUIResource(gradientEnd), "UILabelPanel.noGradientFill", new ColorUIResource(applicationBackground), "MenuItem.background", new ColorUIResource(applicationBackground), "checkBoxMenuItemBackground", colorUIResource2, "OptionPane.background", colorUIResource2, "menuBackground", colorUIResource2, "menuBarBackground", colorUIResource1, "menuItemBackground", colorUIResource2, "radioButtonMenuItemBackground", colorUIResource2, "toolBarShadow", new ColorUIResource(applicationBorderColor), "toolBarHighlight", new ColorUIResource(applicationBorderColor), "separatorForeground", new ColorUIResource(textForegroundColor), "separatorBackground", colorUIResource2, "Table.selectionBackground", new ColorUIResource(tableSelectBackground), "Table.selectionForeground", new ColorUIResource(tableSelectForeground), "Tree.selectionBackground", new ColorUIResource(tableSelectBackground), "Tree.selectionForeground", new ColorUIResource(tableSelectForeground), "List.selectionBackground", new ColorUIResource(tableSelectBackground), "List.selectionForeground", new ColorUIResource(tableSelectForeground), "ComboBox.selectionBackground", new ColorUIResource(tableSelectBackground), "ComboBox.selectionForeground", new ColorUIResource(tableSelectForeground), "RadioButton.background", new ColorUIResource(applicationBackground), "RadioButton.border", new ColorUIResource(applicationBackground), "RadioButton.darkShadow", new ColorUIResource(applicationBackground), "ToolBar.border", BorderFactory.createEmptyBorder(), "Separator.background", applicationBorderColor, "Separator.shadow", colorUIResource2, "Office2003LnF.CBMenuItemCheckBGColor", selectionColor, "SidePane.selectedButtonBackground", selectionDarkerColor, "JideButton.selectedBackground", selectionDarkerColor, "Gripper.foreground", ribbonBackground, "OptionPane.bannerLt", new ColorUIResource(applicationBackground), "OptionPane.bannerDk", new ColorUIResource(applicationBackground), "CollapsiblePane.background", new ColorUIResource(ribbonBackground), "CollapsiblePanes.backgroundLt", new ColorUIResource(ribbonBackground), "CollapsiblePanes.backgroundDk", new ColorUIResource(ribbonBackground), "CollapsiblePane.emphasizedBackground", applicationButtonSelectedColor, "CollapsiblePaneTitlePane.backgroundLt.emphasized", new ColorUIResource(applicationButtonSelectedColor), "CollapsiblePaneTitlePane.backgroundDk.emphasized", new ColorUIResource(applicationButtonSelectedColor), "CollapsiblePane.emphasizedForeground", Color.white, "CollapsiblePaneTitlePane.foreground.emphasized", new ColorUIResource(Color.white), "CollapsiblePaneTitlePane.foreground.focus.emphasized", new ColorUIResource(Color.white.brighter()), "TextField.inactiveBackground", applicationBackground, "CheckBox.background", applicationBackground, "ComboBox.buttonBackground", applicationBackground, "control", applicationBackground, "JideTabbedPane.tabAreaBackground", new ColorUIResource(selectionDarkerColor), "JideTabbedPane.selectedTabBackground", new ColorUIResource(selectionDarkerColor), "JideTabbedPane.selectedTabBackgroundDk", ColorUtils.getDerivedColor(selectionDarkerColor, 0.6F), "JideTabbedPane.selectedTabBackgroundDk", ColorUtils.getDerivedColor(selectionDarkerColor, 0.4F), "selection.border", selectionColor, "selection.RolloverLt", ColorUtils.getDerivedColor(selectionColor, 0.6F), "selection.RolloverDk", ColorUtils.getDerivedColor(selectionColor, 0.4F), "selection.SelectedLt", ColorUtils.getDerivedColor(selectionDarkerColor, 0.6F), "selection.SelectedDk", ColorUtils.getDerivedColor(selectionDarkerColor, 0.4F), "selection.PressedLt", ColorUtils.getDerivedColor(selectionDarkerColor, 0.4F), "selection.PressedDk", ColorUtils.getDerivedColor(selectionDarkerColor, 0.6F) });
        }
コード例 #20
0
 public TaskbarPanel(CostOSRibbonUI outerInstance)
 {
     this.outerInstance = outerInstance;
     Opaque             = false;
     Border             = BorderFactory.createEmptyBorder(1, 0, 1, 0);
 }
コード例 #21
0
        /// <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);
        }
コード例 #22
0
        /// <summary>
        /// Sets up the GUI.
        /// </summary>
        public virtual void setupGUI()
        {
            string routine = "setupGUI";

            addWindowListener(this);

            __addPrecip     = new JButton(__BUTTON_ADD_PRECIPITATION_STATION);
            __addEvap       = new JButton(__BUTTON_ADD_EVAPORATION_STATION);
            __deleteStation = new JButton(__BUTTON_DELETE_PRECIPITATION_STATION);
            __deleteStation.setEnabled(false);
            __helpJButton = new JButton(__BUTTON_HELP);
            __helpJButton.setEnabled(false);
            __closeJButton = new JButton(__BUTTON_CLOSE);
            JButton cancelJButton = new JButton(__BUTTON_CANCEL);
            JButton applyJButton  = new JButton(__BUTTON_APPLY);

            GridBagLayout gb       = new GridBagLayout();
            JPanel        bigPanel = new JPanel();

            bigPanel.setLayout(gb);

            FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
            JPanel     p1 = new JPanel();

            p1.setLayout(fl);

            GridLayout gl         = new GridLayout(2, 2, 1, 1);
            JPanel     info_panel = new JPanel();

            info_panel.setLayout(gl);

            JPanel main_panel = new JPanel();

            main_panel.setLayout(new BorderLayout());

            info_panel.add(new JLabel("Reservoir:"));
            info_panel.add(new JLabel(__currentRes.getID()));
            info_panel.add(new JLabel("Reservoir name:"));
            info_panel.add(new JLabel(__currentRes.getName()));

            if (__editable)
            {
                p1.add(__addPrecip);
                p1.add(__addEvap);
                p1.add(__deleteStation);
            }
            p1.add(applyJButton);
            p1.add(cancelJButton);
            //	p1.add(__helpJButton);
            p1.add(__closeJButton);

            PropList p = new PropList("StateMod_Reservoir_Climate_JFrame.JWorksheet");

            p.add("JWorksheet.ShowPopupMenu=true");
            p.add("JWorksheet.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

            int[]            widthsP = null;
            JScrollWorksheet jswP    = null;
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<String> stations = StateMod_Util.createIdentifierListFromTS(combineData((java.util.List<RTi.TS.MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY).getData(), (java.util.List<RTi.TS.MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY).getData()), true, null);
            IList <string> stations = StateMod_Util.createIdentifierListFromTS(combineData((IList <MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY).getData(), (IList <MonthTS>)__dataset.getComponentForComponentType(StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY).getData()), true, null);

            try
            {
                IList <StateMod_ReservoirClimate> temp   = getPrecipitationStations(__currentRes.getClimates());
                IList <StateMod_ReservoirClimate> clones = new List <StateMod_ReservoirClimate>();
                StateMod_ReservoirClimate         r      = null;
                int size = temp.Count;
                for (int i = 0; i < size; i++)
                {
                    r = temp[i];
                    clones.Add((StateMod_ReservoirClimate)r.clone());
                }

                __tableModelP = new StateMod_ReservoirClimate_TableModel(clones, __editable, true);
                StateMod_ReservoirClimate_CellRenderer crr = new StateMod_ReservoirClimate_CellRenderer(__tableModelP);

                jswP         = new JScrollWorksheet(crr, __tableModelP, p);
                __worksheetP = jswP.getJWorksheet();

                __worksheetP.setColumnJComboBoxValues(StateMod_ReservoirClimate_TableModel.COL_STATION, stations, true);

                widthsP = crr.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(1, routine, "Error building worksheet.", this);
                Message.printWarning(2, routine, e);
                jswP         = new JScrollWorksheet(0, 0, p);
                __worksheetP = jswP.getJWorksheet();
            }
            __worksheetP.setPreferredScrollableViewportSize(null);

            __worksheetP.setHourglassJFrame(this);
            __worksheetP.addMouseListener(this);
            __worksheetP.addKeyListener(this);

            int[]            widthsE = null;
            JScrollWorksheet jswE    = null;

            try
            {
                IList <StateMod_ReservoirClimate> temp   = getEvaporationStations(__currentRes.getClimates());
                IList <StateMod_ReservoirClimate> clones = new List <StateMod_ReservoirClimate>();
                StateMod_ReservoirClimate         r      = null;
                int size = temp.Count;
                for (int i = 0; i < size; i++)
                {
                    r = temp[i];
                    clones.Add((StateMod_ReservoirClimate)r.clone());
                }

                __tableModelE = new StateMod_ReservoirClimate_TableModel(clones, __editable, true);
                StateMod_ReservoirClimate_CellRenderer crr = new StateMod_ReservoirClimate_CellRenderer(__tableModelE);

                jswE         = new JScrollWorksheet(crr, __tableModelE, p);
                __worksheetE = jswE.getJWorksheet();

                __worksheetE.setColumnJComboBoxValues(StateMod_ReservoirClimate_TableModel.COL_STATION, stations, true);
                widthsE = crr.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(1, routine, "Error building worksheet.", this);
                Message.printWarning(2, routine, e);
                jswE         = new JScrollWorksheet(0, 0, p);
                __worksheetE = jswE.getJWorksheet();
            }
            __worksheetE.setPreferredScrollableViewportSize(null);

            __worksheetE.setHourglassJFrame(this);
            __worksheetE.addMouseListener(this);
            __worksheetE.addKeyListener(this);

            JPanel worksheets = new JPanel();

            worksheets.setLayout(gb);

            JPanel panelP = new JPanel();

            panelP.setLayout(gb);
            panelP.setBorder(BorderFactory.createTitledBorder("Precipitation Stations"));
            JGUIUtil.addComponent(panelP, jswP, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            JPanel panelE = new JPanel();

            panelE.setLayout(gb);
            panelE.setBorder(BorderFactory.createTitledBorder("Evaporation Stations"));
            JGUIUtil.addComponent(panelE, jswE, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(worksheets, panelP, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
            JGUIUtil.addComponent(worksheets, panelE, 0, 1, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            main_panel.add(worksheets, "Center");
            main_panel.add(p1, "South");

            // assemble parts
            JGUIUtil.addComponent(bigPanel, info_panel, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            JGUIUtil.addComponent(bigPanel, main_panel, 0, 1, 10, 10, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.SOUTH);
            __addEvap.addActionListener(this);
            __addPrecip.addActionListener(this);
            __deleteStation.addActionListener(this);
            __helpJButton.addActionListener(this);
            __closeJButton.addActionListener(this);
            applyJButton.addActionListener(this);
            cancelJButton.addActionListener(this);

            getContentPane().add(bigPanel);

            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);

            pack();
            setSize(650, 400);
            JGUIUtil.center(this);
            setVisible(true);

            if (widthsP != null)
            {
                __worksheetP.setColumnWidths(widthsP);
            }
            if (widthsE != null)
            {
                __worksheetE.setColumnWidths(widthsE);
            }
        }
コード例 #23
0
        /// <summary>
        /// Sets up the GUI. </summary>
        /// <param name="index"> the index in the worksheet to first 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
            JPanel right_panel = new JPanel(); // everything else

            __cropIDJTextField            = new JTextField(12);
            __nameJTextField              = new JTextField(24);
            __plantMonthJTextField        = new JTextField(6);
            __plantDayJTextField          = new JTextField(6);
            __harvestMonthJTextField      = new JTextField(6);
            __harvestDayJTextField        = new JTextField(6);
            __daysToCoverJTextField       = new JTextField(6);
            __seasonLengthJTextField      = new JTextField(6);
            __earliestValueJTextField     = new JTextField(6);
            __latestValueJTextField       = new JTextField(6);
            __maxRootFeetJTextField       = new JTextField(6);
            __maxAppDepthJTextField       = new JTextField(6);
            __firstDaysBetweenJTextField  = new JTextField(6);
            __secondDaysBetweenJTextField = new JTextField(6);

            IList <string> v = new List <string>();

            v.Add(__0_MEAN_TEMP);
            v.Add(__1_28_DEG_FROST);
            v.Add(__2_32_DEG_FROST);
            v.Add(__999_NONE);
            __earliestFlagComboBox = new SimpleJComboBox(v);
            __latestFlagComboBox   = new SimpleJComboBox(v);

            __searchID   = new JTextField(10);
            __searchName = new JTextField(10);
            __searchName.setEditable(false);
            __findNextCrop           = 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);
            right_panel.setLayout(gb);
            left_panel.setLayout(gb);

            int y;

            PropList p = new PropList("StateCU_CropCharacteristics_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_CropCharacteristics_TableModel   tmw = new StateCU_CropCharacteristics_TableModel(__cropsVector);
                StateCU_CropCharacteristics_CellRenderer crw = new StateCU_CropCharacteristics_CellRenderer(tmw);

                __worksheet = new JWorksheet(crw, tmw, p);

                __worksheet.removeColumn(3);
                __worksheet.removeColumn(4);
                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, 14, 1, 1, 0, 0, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER);

            y = 0;
            JGUIUtil.addComponent(p3, new JLabel("Crop ID:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __cropIDJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __cropIDJTextField.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, 3, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Planting Month and Day:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __plantMonthJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, __plantDayJTextField, 2, y, 2, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Harvest Month and Day:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __harvestMonthJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, __harvestDayJTextField, 2, y, 2, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Days to Full Cover:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __daysToCoverJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Length of Season (days):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __seasonLengthJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Earliest Moisture Use:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __earliestFlagComboBox, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, new JLabel("Value (F Deg.):"), 2, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, __earliestValueJTextField, 3, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Latest Moisture Use:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __latestFlagComboBox, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, new JLabel("Value (F Deg.):"), 2, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p3, __latestValueJTextField, 3, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Maximum Root Zone (feet):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __maxRootFeetJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Maximum Application Depth (inches):"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __maxAppDepthJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Days between 1st and 2nd cuttings:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __firstDaysBetweenJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            y++;
            JGUIUtil.addComponent(p3, new JLabel("Days between 2nd and 3rd cuttings:"), 0, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p3, __secondDaysBetweenJTextField, 1, y, 1, 1, 1, 1, 1, 0, 0, 1, GridBagConstraints.NONE, GridBagConstraints.WEST);

            // two top panels of info
            JGUIUtil.addComponent(right_panel, p3, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);

            int[] widths2 = null;
            try
            {
                __blaneyModel = new StateCU_CropCharacteristics_TableModel(__cropsVector);
                StateCU_CropCharacteristics_CellRenderer crw = new StateCU_CropCharacteristics_CellRenderer(__blaneyModel);

                __coeffWorksheet = new JWorksheet(crw, __blaneyModel, p);

                __coeffWorksheet.removeColumn(1);
                __coeffWorksheet.removeColumn(2);
                widths2 = crw.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(2, routine, e);
                __coeffWorksheet = new JWorksheet(0, 0, p);
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
            __coeffWorksheet.setPreferredScrollableViewportSize(null);
            __coeffWorksheet.setHourglassJFrame(this);

            JScrollPane jsp = new JScrollPane(__coeffWorksheet);

            jsp.setBorder(BorderFactory.createTitledBorder(jsp.getBorder(), "Blaney-Criddle Crop Coefficients"));
            JGUIUtil.addComponent(right_panel, jsp, 0, y, 4, 4, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

            // add search areas
            y = 14;
            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, __findNextCrop, 0, y2, 4, 1, 0, 0, 20, 10, 20, 10, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __findNextCrop.addActionListener(this);
            // add buttons which lead to crop
            // direct flow demand, and return flow information
            FlowLayout fl = new FlowLayout(FlowLayout.CENTER);

            // add help and close buttons
            y++;
            JPanel p6 = new JPanel();

            p6.setLayout(fl);
            if (__editable)
            {
                p6.add(applyJButton);
                p6.add(cancelJButton);
            }
            p6.add(helpJButton);
            p6.add(closeJButton);
            JGUIUtil.addComponent(right_panel, p6, GridBagConstraints.RELATIVE, y, 4, 1, 1, 0, 30, 0, 0, 0, GridBagConstraints.BOTH, 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);
            JGUIUtil.addComponent(mainJPanel, right_panel, GridBagConstraints.RELATIVE, 0, 4, 10, 0, 1, 10, 10, 10, 10, GridBagConstraints.BOTH, GridBagConstraints.EAST);

            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(850, 620);
            selectTableIndex(index);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }
            if (widths2 != null)
            {
                __coeffWorksheet.setColumnWidths(widths2);
            }
        }
コード例 #24
0
    //--------
    //-------- 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;
    }
コード例 #25
0
        public CostOSRibbonApplicationMenuPopupPanel(JRibbonApplicationMenuButton paramJRibbonApplicationMenuButton, RibbonApplicationMenu paramRibbonApplicationMenu)
        {
            Layout = new BorderLayout();
            Border = BorderFactory.createEmptyBorder();
            if (paramRibbonApplicationMenu.DefaultCallback == null)
            {
                this.defaultPrimaryCallback = new PrimaryRolloverCallbackAnonymousInnerClass(this);
            }
            else
            {
                this.defaultPrimaryCallback = paramRibbonApplicationMenu.DefaultCallback;
            }
            CostOSApplicationMenuContainerPanel costOSApplicationMenuContainerPanel = new CostOSApplicationMenuContainerPanel(new BorderLayout());

            costOSApplicationMenuContainerPanel.Background = SECONDARY_MENU_COLOR;
            JFrame jFrame = CostOSRootPaneUI.Resolver.MainFrame;

            costOSApplicationMenuContainerPanel.MinimumSize   = new Dimension(jFrame.Width - 2, jFrame.Height - 55);
            costOSApplicationMenuContainerPanel.PreferredSize = new Dimension(jFrame.Width - 2, jFrame.Height - 55);
            costOSApplicationMenuContainerPanel.MaximumSize   = new Dimension(jFrame.Width - 2, jFrame.Height - 55);
            this.panelLevel1            = new JPanel();
            this.panelLevel1.Layout     = new LayoutManagerAnonymousInnerClass(this);
            this.panelLevel1.Background = PRIMARY_MENU_COLOR;
            this.panelLevel1.Border     = BorderFactory.createEmptyBorder();
            if (paramRibbonApplicationMenu != null)
            {
                System.Collections.IList list = paramRibbonApplicationMenu.PrimaryEntries;
                if (list != null && list.Count > 0)
                {
                    EmptyResizableIcon emptyResizableIcon = new EmptyResizableIcon(16);
                    for (sbyte b = 0; b < list.Count; b++)
                    {
                        System.Collections.IList list1 = (System.Collections.IList)list[b];
                        foreach (RibbonApplicationMenuEntryPrimary ribbonApplicationMenuEntryPrimary in list1)
                        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final JCommandAppMenuButton commandButton = new JCommandAppMenuButton(ribbonApplicationMenuEntryPrimary.getText(), emptyResizableIcon);
                            JCommandAppMenuButton commandButton = new JCommandAppMenuButton(ribbonApplicationMenuEntryPrimary.Text, emptyResizableIcon);
                            jCommandAppMenuButton.CommandButtonKind = ribbonApplicationMenuEntryPrimary.EntryKind;
                            jCommandAppMenuButton.addActionListener(ribbonApplicationMenuEntryPrimary.MainActionListener);
                            if (ribbonApplicationMenuEntryPrimary.RolloverCallback != null)
                            {
                                jCommandAppMenuButton.addRolloverActionListener(new RolloverActionListenerAnonymousInnerClass(this));
                            }
                            else if (ribbonApplicationMenuEntryPrimary.SecondaryGroupCount == 0)
                            {
                                jCommandAppMenuButton.addRolloverActionListener(new RolloverActionListenerAnonymousInnerClass2(this));
                            }
                            else
                            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback coreCallback = new org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback()
                                RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback coreCallback = new PrimaryRolloverCallbackAnonymousInnerClass2(this, commandButton);
                                jCommandAppMenuButton.addRolloverActionListener(new RolloverActionListenerAnonymousInnerClass3(this, commandButton, coreCallback));
                            }
                            jCommandAppMenuButton.DisplayState         = MENU_TILE_LEVEL_1;
                            jCommandAppMenuButton.HorizontalAlignment  = 10;
                            jCommandAppMenuButton.PopupOrientationKind = JCommandButton.CommandButtonPopupOrientationKind.SIDEWARD;
                            jCommandAppMenuButton.Enabled    = ribbonApplicationMenuEntryPrimary.Enabled;
                            jCommandAppMenuButton.Foreground = CostOSWindowsLookAndFeel.ribbonAppMenuButtonForegroundColor;
                            this.panelLevel1.add(jCommandAppMenuButton);
                        }
                        if (b < list.Count - 1)
                        {
                            JPopupMenu.Separator separator = new SeparatorAnonymousInnerClass(this);
                            this.panelLevel1.add(separator);
                        }
                    }
                }
            }
            costOSApplicationMenuContainerPanel.add(this.panelLevel1, "West");
            this.panelLevel2               = new JPanel();
            this.panelLevel2.Background    = SECONDARY_MENU_COLOR;
            this.panelLevel2.Border        = new BorderAnonymousInnerClass(this);
            this.panelLevel2.PreferredSize = new Dimension(30 * FlamingoUtilities.getFont(this.panelLevel1, new string[] { "Ribbon.font", "Button.font", "Panel.font" }).Size - 30, 10);
            this.defaultPrimaryCallback.menuEntryActivated(this.panelLevel2);
            costOSApplicationMenuContainerPanel.add(this.panelLevel2, "Center");
            add(costOSApplicationMenuContainerPanel, "Center");
            this.panelLevel1.doLayout();
            firstLevelMenuWidth = (int)this.panelLevel1.PreferredSize.Width;
        }
コード例 #26
0
 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();
     }
 }
コード例 #27
0
	/// <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);
		}
	}
コード例 #28
0
        /// <summary>
        /// Sets up the GUI. </summary>
        /// <param name="index"> the index of the network node to preselect. </param>
        private void setupGUI(int index)
        {
            string routine = "StateMod_RiverNetworkNode_JFrame.setupGUI";

            addWindowListener(this);

            JPanel p1 = new JPanel();     // entire top half

            __searchID             = new JTextField(10);
            __searchName           = new JTextField(10);
            __findNext             = new JButton(__BUTTON_FIND_NEXT);
            __searchCriteriaGroup  = new ButtonGroup();
            __searchIDJRadioButton = new JRadioButton("ID", true);
            __searchIDJRadioButton.addActionListener(this);
            __searchCriteriaGroup.add(__searchIDJRadioButton);
            __searchNameJRadioButton = new JRadioButton("Name", false);
            __searchNameJRadioButton.addActionListener(this);
            __searchCriteriaGroup.add(__searchNameJRadioButton);

            __idJTextField = new JTextField(12);
            __idJTextField.setEditable(false);
            __nameJTextField = new JTextField(24);
            __nameJTextField.setEditable(false);
            __nodeJTextField    = new JTextField(12);
            __commentJTextField = new JTextField(24);

            __showOnMap_JButton = new SimpleJButton(__BUTTON_SHOW_ON_MAP, this);
            __showOnMap_JButton.setToolTipText("Annotate map with location (button is disabled if layer does not have matching ID)");
            __showOnNetwork_JButton = new SimpleJButton(__BUTTON_SHOW_ON_NETWORK, this);
            __showOnNetwork_JButton.setToolTipText("Annotate network with location");
            __applyJButton  = new JButton(__BUTTON_APPLY);
            __cancelJButton = new JButton(__BUTTON_CANCEL);
            __helpJButton   = new JButton(__BUTTON_HELP);
            __closeJButton  = new JButton(__BUTTON_CLOSE);

            GridBagLayout gb = new GridBagLayout();

            p1.setLayout(gb);

            int y = 0;

            PropList p = new PropList("StateMod_RiverNetworkNode_JFrame.JWorksheet");

            p.add("JWorksheet.ShowPopupMenu=true");
            p.add("JWorksheet.AllowCopy=true");
            p.add("JWorksheet.SelectionMode=SingleRowSelection");

            int[]            widths = null;
            JScrollWorksheet jsw    = null;

            try
            {
                StateMod_RiverNetworkNode_TableModel   tmr = new StateMod_RiverNetworkNode_TableModel(__riverNetworkNodesVector);
                StateMod_RiverNetworkNode_CellRenderer crr = new StateMod_RiverNetworkNode_CellRenderer(tmr);

                jsw         = new JScrollWorksheet(crr, tmr, p);
                __worksheet = jsw.getJWorksheet();

                widths = crr.getColumnWidths();
            }
            catch (Exception e)
            {
                Message.printWarning(2, routine, e);
                jsw         = new JScrollWorksheet(0, 0, p);
                __worksheet = jsw.getJWorksheet();
            }
            __worksheet.setPreferredScrollableViewportSize(null);
            __worksheet.setHourglassJFrame(this);
            __worksheet.addMouseListener(this);
            __worksheet.addKeyListener(this);
            JGUIUtil.addComponent(p1, jsw, 0, y, 4, 9, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST);

            JGUIUtil.addComponent(p1, new JLabel("ID:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p1, __idJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p1, new JLabel("Name:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p1, __nameJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p1, new JLabel("Downstream Node:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p1, __nodeJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(p1, new JLabel("Comment:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
            JGUIUtil.addComponent(p1, __commentJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);


            //
            // add search areas
            //

            y = 10;

            JPanel searchPanel = new JPanel();

            searchPanel.setLayout(gb);
            searchPanel.setBorder(BorderFactory.createTitledBorder("Search list for:     "));
            JGUIUtil.addComponent(p1, searchPanel, 0, y, 1, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(searchPanel, __searchIDJRadioButton, 0, ++y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            JGUIUtil.addComponent(searchPanel, __searchID, 1, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);
            __searchID.addActionListener(this);
            JGUIUtil.addComponent(searchPanel, __searchNameJRadioButton, 0, ++y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __searchName.setEditable(false);
            JGUIUtil.addComponent(searchPanel, __searchName, 1, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);
            __searchName.addActionListener(this);
            JGUIUtil.addComponent(searchPanel, __findNext, 0, ++y, 4, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
            __findNext.addActionListener(this);

            //
            // add close and help buttons
            //
            JPanel     pfinal = new JPanel();
            FlowLayout fl     = new FlowLayout(FlowLayout.RIGHT);

            pfinal.setLayout(fl);
            __helpJButton.setEnabled(false);
            pfinal.add(__showOnMap_JButton);
            pfinal.add(__showOnNetwork_JButton);
            if (__editable)
            {
                pfinal.add(__applyJButton);
                pfinal.add(__cancelJButton);
            }
            pfinal.add(__closeJButton);
            //	pfinal.add(__helpJButton);
            __applyJButton.addActionListener(this);
            __cancelJButton.addActionListener(this);
            __helpJButton.addActionListener(this);
            __closeJButton.addActionListener(this);
            getContentPane().add("Center", p1);
            getContentPane().add("South", pfinal);

            initializeDisables();

            selectTableIndex(index);

            if (__dataset_wm != null)
            {
                __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK, this);
            }

            pack();
            setSize(690, 400);
            JGUIUtil.center(this);
            setVisible(true);

            if (widths != null)
            {
                __worksheet.setColumnWidths(widths);
            }

            __worksheet.addSortListener(this);
        }
コード例 #29
0
 public CostOSRibbonApplicationMenuPopupPanelDefault() : base(MENU_TILE_LEVEL_2)
 {
     MaxButtonColumns = 1;
     Border           = BorderFactory.createEmptyBorder();
 }
コード例 #30
0
    //--------
    //-------- 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;
    }