예제 #1
0
        /// <summary>
        /// Sets up the GUI. </summary>
        /// <exception cref="Exception"> if there is an error setting up the worksheet. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void setupGUI() throws Exception
        private void setupGUI()
        {
            addWindowListener(this);

            JPanel panel = new JPanel();

            panel.setLayout(new GridBagLayout());

            // buildJScrollWorksheet is defined in the derived classes (it is
            // abstract in this class).  It creates a JScrollWorksheet and returns it.
            __scrollWorksheet = buildJScrollWorksheet();
            _worksheet        = __scrollWorksheet.getJWorksheet();

            JGUIUtil.addComponent(panel, __scrollWorksheet, 0, 0, 1, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER);

            getContentPane().add("Center", panel);

            SimpleJButton exportButton = new SimpleJButton(_BUTTON_EXPORT, this);
            SimpleJButton printButton  = new SimpleJButton(_BUTTON_PRINT, this);
            SimpleJButton okButton     = new SimpleJButton(_BUTTON_OK, this);

            SimpleJButton applyButton  = null;
            SimpleJButton cancelButton = null;

            if (_editable)
            {
                applyButton  = new SimpleJButton(_BUTTON_APPLY, this);
                cancelButton = new SimpleJButton(_BUTTON_CANCEL, this);
            }

            JPanel bottomPanel = new JPanel();

            bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
            bottomPanel.add(exportButton);
            bottomPanel.add(printButton);
            bottomPanel.add(okButton);

            if (_editable)
            {
                bottomPanel.add(applyButton);
                bottomPanel.add(cancelButton);
            }

            getContentPane().add("South", bottomPanel);

            JGUIUtil.setIcon(this, JGUIUtil.getIconImage());

            setTitle(_titleString);
            pack();

            setSize(800, 400);
            JGUIUtil.center(this);

            setVisible(true);

            JWorksheet_DefaultTableCellRenderer renderer = _worksheet.getCellRenderer();

            int[] widths = renderer.getColumnWidths();
            if (widths != null)
            {
                _worksheet.setColumnWidths(widths);
            }
        }