Example usage for javax.swing.table TableColumn setPreferredWidth

List of usage examples for javax.swing.table TableColumn setPreferredWidth

Introduction

In this page you can find the example usage for javax.swing.table TableColumn setPreferredWidth.

Prototype

@BeanProperty(description = "The preferred width of the column.")
public void setPreferredWidth(int preferredWidth) 

Source Link

Document

Sets this column's preferred width to preferredWidth.

Usage

From source file:com.aw.swing.mvp.binding.component.BndSJTable.java

/**
 * Configure the grid columns based on the ColumnInfo information
 *//*  w w w . j a  v a2  s. co m*/
protected void configureColumns() {
    //jcv:2.0.1
    //        TableCellRenderer tableCellRenderer = createHeaderRenderer();
    JTableHeader jTableHeader = jTable.getTableHeader();
    TableCellRenderer tableCellRenderer = jTableHeader.getDefaultRenderer();
    for (int i = 0; i < columnsInfo.length; i++) {
        TableColumn col = jTable.getColumnModel().getColumn(i);
        if (columnsInfo[i] instanceof SelectorColumn) {
            final SelectorColumn selectorColumn = (SelectorColumn) columnsInfo[i];
            // Set special renderer for the column's header
            col.setHeaderRenderer(getSelectorHeaderRenderer(selectorColumn));
        } else {
            // Set special renderer for the column's header
            col.setHeaderRenderer(tableCellRenderer);
        }

        // set column width
        if (columnsInfo[i].getWidth() > 0) {
            col.setPreferredWidth(columnsInfo[i].getWidth());
        }
        if (columnsInfo[i].isEditable() || StringUtils.hasText(columnsInfo[i].getValidationRule())) {
            columnsInfo[i].initializeValidator();
        }
        // set column alignment if the cell is not editable
        if (!columnsInfo[i].isEditable() && !(columnsInfo[i] instanceof ButtonColumn)) {
            configureReadOnlyCell(col, columnsInfo[i]);
        } else {
            configureEditableCell(col, columnsInfo[i]);
        }
        columnsInfo[i].setIdx(i);
    }
    if (fixedColumns > 0) {
        fixedColumnTableMgr = FixedColumnTableDecorator.decorate(getJTable(), fixedColumns);
        JTable fixedTable = fixedColumnTableMgr.getFixedTable();
        JTableMouseProcessor jTableMouseProcessor = new JTableMouseProcessor(presenter, this, gridIndex);
        jTableMouseProcessor.setJTable(fixedTable);
        jTableMouseProcessor.setInFixedTable(true);
        fixedTable.addMouseListener(getJTableMouseListener(jTableMouseProcessor));
        fixedTable.getTableHeader().addMouseListener(getJTableHeaderMouseListener(jTableMouseProcessor));
    }
}

From source file:gov.noaa.ncdc.iosp.avhrr.util.AvhrrLevel1B2Netcdf.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*w ww  .  j a v  a  2 s .c  o m*/
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
    // Create a file chooser
    this.setTitle("NCDC sat2netcdf converter");

    aboutDialog = new javax.swing.JDialog();
    aboutButton = new javax.swing.JButton();
    aboutLabel = new javax.swing.JLabel();
    aboutDialog.setTitle("About");
    aboutDialog.setName("aboutDialog"); // NOI18N
    aboutDialog.setSize(250, 200);

    aboutButton.setText("OK");
    aboutButton.setName("aboutButton"); // NOI18N
    aboutButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            aboutDialog.hide();
        }
    });

    aboutLabel.setText(
            "<html>\nNCDC sat2netcdf Converter<br> </br>\nCopyright (c) 2008 Work of U.S. Government.<br></br>\nNCDC<br></br>\nContact: ncdc.satorder@noaa.gov\n</html>");

    fc = new JFileChooser();
    fc.setMultiSelectionEnabled(true);

    // output directory file chooser
    outFc = new JFileChooser();
    outFc.setMultiSelectionEnabled(false);
    outFc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    activityMonitor = new Timer(100, new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            convertMonitorActionPerformed(evt);
        }
    });

    menuBar = new JMenuBar();
    logMenu = new JMenu("Log");

    logMenuItem = new JMenuItem("View Log");
    logMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            logDialog.show();
        }
    });
    logMenu.add(logMenuItem);

    menuBar.add(logMenu);
    helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);

    helpMenuItem = new JMenuItem("Help");
    helpMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            helpMenuActionPerformed(evt);
        }
    });
    helpMenu.add(helpMenuItem);
    aboutMenuItem = new JMenuItem("About");
    aboutMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            aboutDialog.show();
        }
    });
    helpMenu.add(aboutMenuItem);

    this.setJMenuBar(menuBar);

    jButton4 = new javax.swing.JButton();
    openButton = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jLabel1 = new javax.swing.JLabel();
    outdirButton = new javax.swing.JButton();
    outdirText = new javax.swing.JTextField();
    jPanel1 = new javax.swing.JPanel();
    allChanCheckBox = new javax.swing.JCheckBox();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    chan1CheckBox = new javax.swing.JCheckBox();
    chan2CheckBox = new javax.swing.JCheckBox();
    chan3CheckBox = new javax.swing.JCheckBox();
    chan4CheckBox = new javax.swing.JCheckBox();
    chan5CheckBox = new javax.swing.JCheckBox();
    rawCheckBox = new javax.swing.JCheckBox();
    radCheckBox = new javax.swing.JCheckBox();
    tempCheckBox = new javax.swing.JCheckBox();
    allVarCheckBox = new javax.swing.JCheckBox();
    qualityCheckBox = new javax.swing.JCheckBox();
    calCheckBox = new javax.swing.JCheckBox();
    latlonCheckBox = new javax.swing.JCheckBox();
    metaCheckBox = new javax.swing.JCheckBox();
    jLabel2 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    convertButton = new javax.swing.JButton();
    exitButton = new javax.swing.JButton();

    jButton4.setText("jButton4");

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    openButton.setText("Select Files");
    openButton.setName("selectButton"); // NOI18N
    openButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            openButtonActionPerformed(evt);
        }
    });

    fm = new FileModel();
    jTable1 = new JTable(fm);
    jTable1.setName("table"); // NOI18N
    jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    setTableCellRenderer(jTable1, new ToolCellRenderer());
    // remove popup for table
    removeItem = new JMenuItem("Remove");
    removeItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            int[] selected = jTable1.getSelectedRows();
            for (int i : selected) {
                logTextArea.append("Removed File: " + fm.getFileAtRow(i).getName() + "\n");
            }
            fm.removeRows(selected);
        }
    });
    popup = new JPopupMenu();
    popup.add(removeItem);
    // Add listener to the jtable so the popup menu can come up.
    // MouseListener popupListener = new PopupListener(jTable1);
    // jTable1.addMouseListener(popupListener);

    jTable1.addMouseListener(new MouseListener() {
        public void mousePressed(MouseEvent e) {
            int button = e.getButton();
            int[] selected = jTable1.getSelectedRows();
            if (button != 1 && selected.length > 0) {
                popup.show(e.getComponent(), e.getX(), e.getY());
            }
        }

        public void mouseClicked(MouseEvent e) {
            int button = e.getButton();
            int column = jTable1.getSelectedColumn();
            if (0 == column && 1 == button) {
                updateOutputSize();
            }
        }

        public void mouseEntered(MouseEvent e) {

        }

        public void mouseExited(MouseEvent e) {

        }

        public void mouseReleased(MouseEvent e) {

        }
    });

    TableColumn col = jTable1.getColumnModel().getColumn(1);
    col.setPreferredWidth(250);
    col = jTable1.getColumnModel().getColumn(3);
    col.setPreferredWidth(100);

    jScrollPane1.setViewportView(jTable1);

    jLabel1.setText("Select output directory");

    outdirButton.setText("Browse");
    outdirButton.setName("outdirButton"); // NOI18N
    outdirButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            outdirButtonActionPerformed(evt);
        }
    });
    outdirText.setName("outdirText"); // NOI18N
    try {
        outdirText.setText(new File(".").getCanonicalPath());
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }

    jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
    jPanel1.setName("optionPanel"); // NOI18N

    allChanCheckBox.setText("All Channels");
    allChanCheckBox.setSelected(true);
    allChanCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("jCheckBox1", allChanCheckBox);
            updateFileSize();
        }
    });

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText("Channels");

    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel4.setText("Calibration");
    jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel5.setText("Additional Data");
    jLabel5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    chan1CheckBox.setText("Channel 1");
    chan1CheckBox.setSelected(true);
    chan1CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan1CheckBox", chan1CheckBox);
            updateFileSize();
        }
    });
    chan2CheckBox.setText("Channel 2");
    chan2CheckBox.setSelected(true);
    chan2CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan2CheckBox", chan2CheckBox);
            updateFileSize();
        }
    });

    chan3CheckBox.setText("Channel 3A/B");
    chan3CheckBox.setSelected(true);
    chan3CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan3CheckBox", chan3CheckBox);
            updateFileSize();
        }
    });

    chan4CheckBox.setLabel("Channel 4");
    chan4CheckBox.setSelected(true);
    chan4CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan4CheckBox", chan4CheckBox);
            updateFileSize();
        }
    });
    chan5CheckBox.setLabel("Channel 5");
    chan5CheckBox.setSelected(true);
    chan5CheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleChannelBoxes("chan5CheckBox", chan5CheckBox);
            updateFileSize();
        }
    });
    rawCheckBox.setText("Raw Data");
    rawCheckBox.setSelected(true);
    rawCheckBox.setToolTipText("Counts for each pixel");
    rawCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleCalibrationCheckBoxes(rawCheckBox);
            updateFileSize();
        }
    });
    radCheckBox.setText("Radiance");
    radCheckBox.setToolTipText("Radiance Values");
    radCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleCalibrationCheckBoxes(radCheckBox);
            updateFileSize();
        }
    });
    tempCheckBox.setText("Brightness Temperature");
    tempCheckBox.setToolTipText("Albedo for visible channels, Brightness Temperature for IR channels");
    tempCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleCalibrationCheckBoxes(tempCheckBox);
            updateFileSize();
        }
    });
    allVarCheckBox.setText("All Variables");
    allVarCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleAllVariablesCheckBox();
            updateFileSize();
        }
    });
    qualityCheckBox.setText("Quality Flags");
    qualityCheckBox.setToolTipText("Quality Variables");
    qualityCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleOtherCheckbox(qualityCheckBox);
            updateFileSize();
        }
    });

    calCheckBox.setText("Calibration Coefficients");
    calCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleOtherCheckbox(calCheckBox);
            updateFileSize();
        }
    });

    jLabel2.setText("Select output options");

    convertButton.setText("Convert");
    convertButton.setName("convertButton"); // NOI18N
    convertButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            convertButtonActionPerformed(evt);
        }
    });

    exitButton.setText("Exit");
    exitButton.setName("exitButton"); // NOI18N
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });

    // help dialog
    helpDialog = new javax.swing.JDialog();
    helpCloseButton = new javax.swing.JButton("Close");
    helpScrollPane = new javax.swing.JScrollPane();

    //      helpEditorPane = new javax.swing.JEditorPane("text/rtf", helpText);
    helpEditorPane = new javax.swing.JEditorPane();
    helpEditorPane.setContentType("text/html");
    InputStream stream = null;
    try {
        stream = AvhrrLevel1B2Netcdf.class.getResourceAsStream("/help.html");
        if (stream != null) {
            helpEditorPane.read(stream, "html");
        }
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    helpScrollPane.setViewportView(helpEditorPane);
    helpDialog.setSize(450, 500);
    helpCloseButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            helpDialog.dispose();
        }
    });

    // Log Dialog
    logDialog = new javax.swing.JDialog();
    logScrollPane = new javax.swing.JScrollPane();
    logTextArea = new javax.swing.JTextArea();
    logCloseButton = new javax.swing.JButton();
    clearButton = new javax.swing.JButton();

    logDialog.setTitle("Log");
    logDialog.setName("logDialog"); // NOI18N
    logDialog.setSize(450, 500);
    logScrollPane.setName("logScrollPane"); // NOI18N

    logTextArea.setColumns(20);
    logTextArea.setRows(5);
    logTextArea.setName("logTextArea"); // NOI18N
    logScrollPane.setViewportView(logTextArea);

    logCloseButton.setText("Close");
    logCloseButton.setName("logCloseButton"); // NOI18N
    logCloseButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            logDialog.hide();
        }
    });

    clearButton.setText("Clear");
    clearButton.setName("clearButton"); // NOI18N
    clearButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            logTextArea.setText("");
        }
    });

    latlonCheckBox.setText("Lat/Lon");
    latlonCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleLatLonCheckbox();
            updateFileSize();
        }
    });

    metaCheckBox.setText("Other metadata");
    metaCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handleMetadataCheckbox();
            updateFileSize();
        }
    });

    jLabel2.setText("Select output options");

    convertButton.setText("Convert");
    convertButton.setName("convertButton");

    exitButton.setText("Exit");
    exitButton.setName("exitButton");
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });

    jLabel2.setText("Select output options"); // NOI18N

    convertButton.setText("Convert"); // NOI18N
    convertButton.setName("convertButton"); // NOI18N

    exitButton.setText("Exit"); // NOI18N
    exitButton.setName("exitButton"); // NOI18N
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });

    jLabel6.setFont(new java.awt.Font("Dialog", 1, 11));
    jLabel6.setText("Estimated output size: ");

    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jPanel1Layout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(chan5CheckBox)
                    .add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout
                                    .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jPanel1Layout
                                            .createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING,
                                                    false)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel3,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, allChanCheckBox,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE))
                                    .add(chan1CheckBox).add(chan2CheckBox)).add(36, 36, 36)
                                    .add(jPanel1Layout
                                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                            .add(radCheckBox)
                                            .add(tempCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    163, Short.MAX_VALUE)
                                            .add(rawCheckBox).add(jLabel4,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE)))
                            .add(chan3CheckBox).add(chan4CheckBox))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(metaCheckBox).add(latlonCheckBox).add(allVarCheckBox)
                                    .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 113,
                                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(qualityCheckBox).add(calCheckBox))))
                    .add(67, 67, 67)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel3).add(jLabel5).add(jLabel4,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(allChanCheckBox).add(allVarCheckBox).add(rawCheckBox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(chan1CheckBox).add(qualityCheckBox).add(radCheckBox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(chan2CheckBox).add(calCheckBox).add(tempCheckBox,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(chan3CheckBox).add(latlonCheckBox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(chan4CheckBox).add(metaCheckBox))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(chan5CheckBox)
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    jLabel2.setText("Select output options"); // NOI18N

    convertButton.setText("Convert"); // NOI18N
    convertButton.setName("convertButton"); // NOI18N

    exitButton.setText("Exit"); // NOI18N
    exitButton.setName("exitButton"); // NOI18N
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });

    jLabel6.setFont(new java.awt.Font("Dialog", 1, 11));
    jLabel6.setText("Estimated output size: ");

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup().addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
                            .add(layout.createSequentialGroup().add(outdirButton)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(outdirText,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE))
                            .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
                            .add(openButton)
                            .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 291,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(layout.createSequentialGroup().add(convertButton)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel6,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE))
                            .add(exitButton).add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    531, Short.MAX_VALUE))
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout
            .createSequentialGroup().addContainerGap().add(openButton)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 173,
                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel1)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(outdirButton).add(
                    outdirText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 27,
                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15,
                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false).add(convertButton)
                    .add(jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(exitButton).add(12, 12, 12)));
    // log dialog layout
    org.jdesktop.layout.GroupLayout logDialogLayout = new org.jdesktop.layout.GroupLayout(
            logDialog.getContentPane());
    logDialog.getContentPane().setLayout(logDialogLayout);
    logDialogLayout.setHorizontalGroup(
            logDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
                    org.jdesktop.layout.GroupLayout.TRAILING,
                    logDialogLayout.createSequentialGroup().addContainerGap()
                            .add(logDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, logScrollPane,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
                                    .add(logDialogLayout.createSequentialGroup().add(clearButton)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                            .add(logCloseButton)))
                            .addContainerGap()));
    logDialogLayout.setVerticalGroup(logDialogLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, logDialogLayout.createSequentialGroup()
                    .addContainerGap()
                    .add(logScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                    .add(18, 18, 18)
                    .add(logDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(logCloseButton).add(clearButton))
                    .addContainerGap()));

    // help dialog layout
    org.jdesktop.layout.GroupLayout helpDialogLayout = new org.jdesktop.layout.GroupLayout(
            helpDialog.getContentPane());
    helpDialog.getContentPane().setLayout(helpDialogLayout);
    helpDialogLayout.setHorizontalGroup(
            helpDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
                    org.jdesktop.layout.GroupLayout.TRAILING,
                    helpDialogLayout.createSequentialGroup().addContainerGap()
                            .add(helpDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, helpScrollPane,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
                                    .add(helpDialogLayout.createSequentialGroup()
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                            .add(helpCloseButton)))
                            .addContainerGap()));
    helpDialogLayout.setVerticalGroup(helpDialogLayout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, helpDialogLayout.createSequentialGroup()
                    .addContainerGap()
                    .add(helpScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                    .add(18, 18, 18).add(helpDialogLayout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(helpCloseButton))
                    .addContainerGap()));

    // about dialog layout
    org.jdesktop.layout.GroupLayout aboutDialogLayout = new org.jdesktop.layout.GroupLayout(
            aboutDialog.getContentPane());
    aboutDialog.getContentPane().setLayout(aboutDialogLayout);
    aboutDialogLayout.setHorizontalGroup(
            aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
                    org.jdesktop.layout.GroupLayout.TRAILING,
                    aboutDialogLayout.createSequentialGroup().addContainerGap()
                            .add(aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, aboutLabel,
                                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
                                    .add(aboutButton))
                            .addContainerGap()));
    aboutDialogLayout.setVerticalGroup(
            aboutDialogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
                    org.jdesktop.layout.GroupLayout.TRAILING,
                    aboutDialogLayout.createSequentialGroup().addContainerGap()
                            .add(aboutLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 103,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 35, Short.MAX_VALUE)
                            .add(aboutButton).add(21, 21, 21)));

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    pack();

    JOptionPane.showMessageDialog(this,
            "Warning! \nThis program is untested.\nPlease read help file for\nsupported files, limitations and license.\n");
    //            + "Please view Help for more information.");
}

From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java

private void fixNameColumnWidth(int viewWidth) {
    TableColumn nameCol = detailsTable.getColumnModel().getColumn(COLUMN_FILENAME);
    int tableWidth = detailsTable.getPreferredSize().width;

    if (tableWidth < viewWidth) {
        nameCol.setPreferredWidth((nameCol.getPreferredWidth() + viewWidth) - tableWidth);
    }//from   w  w w .j  a v  a2s .  c  o  m
}

From source file:com.afrisoftech.hospinventory.LpoLsoAdministrationIntFr.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//  w w w . ja v  a  2  s .c  o  m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jPanel1 = new javax.swing.JPanel();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel2 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jPanel7 = new javax.swing.JPanel();
    jScrollPane3 = new javax.swing.JScrollPane();
    ApprovalTbl = new com.afrisoftech.dbadmin.JTable();
    orderTxt = new javax.swing.JTextField();
    jPanel5 = new javax.swing.JPanel();
    jLabel4 = new javax.swing.JLabel();
    jLabel111 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jLabel22 = new javax.swing.JLabel();
    reqDateTxt = new javax.swing.JTextField();
    reqDeptTxt = new javax.swing.JTextField();
    TransactionTypeTxt = new javax.swing.JTextField();
    datePicker2 = new com.afrisoftech.lib.DatePicker();
    jLabel112 = new javax.swing.JLabel();
    reqDateTxt1 = new javax.swing.JTextField();
    jLabel6 = new javax.swing.JLabel();
    UserTxt = new javax.swing.JTextField();
    jLabel10 = new javax.swing.JLabel();
    jTextField2 = new javax.swing.JTextField();
    jLabel11 = new javax.swing.JLabel();
    jTextField3 = new javax.swing.JTextField();
    jScrollPane1 = new javax.swing.JScrollPane();
    PurchaseItemsTbl = new com.afrisoftech.dbadmin.JTable();
    jPanel8 = new javax.swing.JPanel();
    Save = new javax.swing.JButton();
    cancelbtn = new javax.swing.JButton();
    exitbtn = new javax.swing.JButton();
    jPanel9 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    TotalPriceTxt = new javax.swing.JTextField();
    jPanel3 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jPanel10 = new javax.swing.JPanel();
    jPanel11 = new javax.swing.JPanel();
    jScrollPane4 = new javax.swing.JScrollPane();
    ApprovalTbl1 = new com.afrisoftech.dbadmin.JTable();
    orderTxt1 = new javax.swing.JTextField();
    jPanel12 = new javax.swing.JPanel();
    jLabel12 = new javax.swing.JLabel();
    jLabel115 = new javax.swing.JLabel();
    jLabel13 = new javax.swing.JLabel();
    jLabel24 = new javax.swing.JLabel();
    reqDateTxt4 = new javax.swing.JTextField();
    reqDeptTxt2 = new javax.swing.JTextField();
    TransactionTypeTxt2 = new javax.swing.JTextField();
    datePicker4 = new com.afrisoftech.lib.DatePicker();
    jLabel116 = new javax.swing.JLabel();
    reqDateTxt5 = new javax.swing.JTextField();
    jLabel14 = new javax.swing.JLabel();
    UserTxt2 = new javax.swing.JTextField();
    jLabel15 = new javax.swing.JLabel();
    jTextField4 = new javax.swing.JTextField();
    jLabel16 = new javax.swing.JLabel();
    Contract_noTxt = new javax.swing.JTextField();
    jScrollPane2 = new javax.swing.JScrollPane();
    PurchaseItemsTbl1 = new com.afrisoftech.dbadmin.JTable();
    jPanel13 = new javax.swing.JPanel();
    Save1 = new javax.swing.JButton();
    cancelbtn1 = new javax.swing.JButton();
    exitbtn1 = new javax.swing.JButton();
    jPanel14 = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    TotalPriceTxt1 = new javax.swing.JTextField();

    setClosable(true);
    setIconifiable(true);
    setMaximizable(true);
    setResizable(true);
    setPreferredSize(new java.awt.Dimension(1000, 500));
    getContentPane().setLayout(new java.awt.GridBagLayout());

    jPanel1.setLayout(new java.awt.GridBagLayout());

    jPanel2.setLayout(new java.awt.GridBagLayout());

    jPanel4.setLayout(new java.awt.GridBagLayout());

    jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "LPOs/LSOs",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 11),
            new java.awt.Color(0, 0, 204))); // NOI18N
    jPanel7.setMinimumSize(new java.awt.Dimension(100, 250));
    jPanel7.setPreferredSize(new java.awt.Dimension(100, 250));
    jPanel7.setLayout(new java.awt.GridBagLayout());

    jScrollPane3.setMinimumSize(new java.awt.Dimension(250, 100));
    jScrollPane3.setPreferredSize(new java.awt.Dimension(250, 100));

    ApprovalTbl.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB,
            "select distinct supplier,order_no from st_orders where order_no is not null and ordered=false and dispatch=false and miu_approval=true and approval_rejected is null"));
    ApprovalTbl.setMinimumSize(new java.awt.Dimension(90, 34));
    ApprovalTbl.setPreferredSize(new java.awt.Dimension(90, 750));
    ApprovalTbl.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            ApprovalTblMouseClicked(evt);
        }
    });
    jScrollPane3.setViewportView(ApprovalTbl);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel7.add(jScrollPane3, gridBagConstraints);

    orderTxt.setText("Search LPO...");
    orderTxt.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            orderTxtCaretUpdate(evt);
        }
    });
    orderTxt.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            orderTxtMouseClicked(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    jPanel7.add(orderTxt, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 3.0;
    gridBagConstraints.weighty = 1.0;
    jPanel4.add(jPanel7, gridBagConstraints);

    /*        javax.swing.SpinnerDateModel spinerDate = new javax.swing.SpinnerDateModel();
    dateSpinner = new javax.swing.JSpinner(spinerDate);
            
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 30);
    jPanel1.add(dateSpinner, gridBagConstraints);
            
    */
    jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    jPanel5.setLayout(new java.awt.GridBagLayout());

    jLabel4.setText("Ordered By");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel5.add(jLabel4, gridBagConstraints);

    jLabel111.setText("Date Sent");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel5.add(jLabel111, gridBagConstraints);

    jLabel5.setText("Due Date");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    jPanel5.add(jLabel5, gridBagConstraints);

    jLabel22.setText("Requisitioning Department");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel5.add(jLabel22, gridBagConstraints);

    reqDateTxt.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
    jPanel5.add(reqDateTxt, gridBagConstraints);

    reqDeptTxt.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel5.add(reqDeptTxt, gridBagConstraints);

    TransactionTypeTxt.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel5.add(TransactionTypeTxt, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 80);
    jPanel5.add(datePicker2, gridBagConstraints);

    jLabel112.setText("LPO/LSO");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel5.add(jLabel112, gridBagConstraints);

    reqDateTxt1.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel5.add(reqDateTxt1, gridBagConstraints);

    jLabel6.setText("Doc Type");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.weightx = 1.0;
    jPanel5.add(jLabel6, gridBagConstraints);

    UserTxt.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
    jPanel5.add(UserTxt, gridBagConstraints);

    jLabel10.setText("Supplier");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel5.add(jLabel10, gridBagConstraints);

    jTextField2.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel5.add(jTextField2, gridBagConstraints);

    jLabel11.setText("Tender/Quotation");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    jPanel5.add(jLabel11, gridBagConstraints);

    jTextField3.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
    jPanel5.add(jTextField3, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 9.0;
    gridBagConstraints.weighty = 2.0;
    jPanel4.add(jPanel5, gridBagConstraints);

    jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    PurchaseItemsTbl.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null } },
            new String[] { "Item Code", "Item Description", "Units", "Quantity", "Unit Price", "Value",
                    "Discount", "VAT", "Remarks" }) {
        Class[] types = new Class[] { java.lang.Object.class, java.lang.Object.class, java.lang.Object.class,
                java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Object.class,
                java.lang.Object.class, java.lang.Object.class };
        boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false, false, false };

        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    /*java.lang.Object[] strCmb = {"Normal","Urgent",""};
            
    javax.swing.JComboBox cmBox = new javax.swing.JComboBox(strCmb);
            
    javax.swing.table.TableColumn teditor = this.jTable1.getColumn("Status");
            
    teditor.setCellEditor(new javax.swing.DefaultCellEditor(cmBox));
    */

    /*javax.swing.table.TableColumn column = null;
    for (int i = 0; i < 4; i++) {
    column = PurchaseItemsTbl.getColumnModel().getColumn(i);
    if (i == 0) {
            
        column.setPreferredWidth(300); //sport column is bigger
    } else {
        if (i == 1) {
            column.setPreferredWidth(200);
        } else {
            //if (i == 2) {
                column.setPreferredWidth(200);
                // }  else
            //column.setPreferredWidth(50);
            
        }
    }
    }
    */
    PurchaseItemsTbl.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            PurchaseItemsTblMouseClicked(evt);
        }
    });
    jScrollPane1.setViewportView(PurchaseItemsTbl);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 9.0;
    gridBagConstraints.weighty = 9.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
    jPanel4.add(jScrollPane1, gridBagConstraints);

    jPanel8.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    jPanel8.setMinimumSize(new java.awt.Dimension(250, 27));
    jPanel8.setPreferredSize(new java.awt.Dimension(250, 27));
    jPanel8.setLayout(new java.awt.GridBagLayout());

    Save.setMnemonic('s');
    Save.setText("Save");
    Save.setEnabled(false);
    Save.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            SaveActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel8.add(Save, gridBagConstraints);

    cancelbtn.setMnemonic('l');
    cancelbtn.setText("Clear");
    cancelbtn.setEnabled(false);
    cancelbtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelbtnActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel8.add(cancelbtn, gridBagConstraints);

    exitbtn.setMnemonic('c');
    exitbtn.setText("Zoom Table");
    exitbtn.setEnabled(false);
    exitbtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitbtnActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel8.add(exitbtn, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel4.add(jPanel8, gridBagConstraints);

    jPanel9.setLayout(new java.awt.GridBagLayout());

    jLabel2.setForeground(new java.awt.Color(255, 51, 0));
    jLabel2.setText("Total Price");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.weightx = 7.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 100, 0, 0);
    jPanel9.add(jLabel2, gridBagConstraints);

    TotalPriceTxt.setEditable(false);
    TotalPriceTxt.setFont(new java.awt.Font("Garamond", 1, 14)); // NOI18N
    TotalPriceTxt.setForeground(new java.awt.Color(255, 0, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 7.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 50);
    jPanel9.add(TotalPriceTxt, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    jPanel4.add(jPanel9, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel2.add(jPanel4, gridBagConstraints);

    jTabbedPane1.addTab("View Sent LPOs/LSOs Awaiting Commitment", jPanel2);

    jPanel3.setLayout(new java.awt.GridBagLayout());

    jPanel6.setLayout(new java.awt.GridBagLayout());

    jPanel10.setLayout(new java.awt.GridBagLayout());

    jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "LPOs/LSOs",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 11),
            new java.awt.Color(0, 0, 204))); // NOI18N
    jPanel11.setMinimumSize(new java.awt.Dimension(100, 250));
    jPanel11.setPreferredSize(new java.awt.Dimension(100, 250));
    jPanel11.setLayout(new java.awt.GridBagLayout());

    jScrollPane4.setMinimumSize(new java.awt.Dimension(250, 100));
    jScrollPane4.setPreferredSize(new java.awt.Dimension(250, 100));

    ApprovalTbl1.setModel(com.afrisoftech.dbadmin.TableModel.createTableVectors(connectDB,
            "select distinct supplier,order_no from st_orders where ordered=true and dispatch=false  and order_no in (select order_no from ac_aie_commitment)"));
    ApprovalTbl1.setMinimumSize(new java.awt.Dimension(90, 34));
    ApprovalTbl1.setPreferredSize(new java.awt.Dimension(90, 750));
    ApprovalTbl1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            ApprovalTbl1MouseClicked(evt);
        }
    });
    jScrollPane4.setViewportView(ApprovalTbl1);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel11.add(jScrollPane4, gridBagConstraints);

    orderTxt1.setText("Search LPO...");
    orderTxt1.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            orderTxt1CaretUpdate(evt);
        }
    });
    orderTxt1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            orderTxt1MouseClicked(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    jPanel11.add(orderTxt1, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 3.0;
    gridBagConstraints.weighty = 1.0;
    jPanel10.add(jPanel11, gridBagConstraints);

    /*        javax.swing.SpinnerDateModel spinerDate = new javax.swing.SpinnerDateModel();
    dateSpinner = new javax.swing.JSpinner(spinerDate);
            
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 30);
    jPanel1.add(dateSpinner, gridBagConstraints);
            
    */
    jPanel12.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    jPanel12.setLayout(new java.awt.GridBagLayout());

    jLabel12.setText("Ordered By");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel12.add(jLabel12, gridBagConstraints);

    jLabel115.setText("Date Sent");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel12.add(jLabel115, gridBagConstraints);

    jLabel13.setText("Due Date");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    jPanel12.add(jLabel13, gridBagConstraints);

    jLabel24.setText("Requisitioning Department");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel12.add(jLabel24, gridBagConstraints);

    reqDateTxt4.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
    jPanel12.add(reqDateTxt4, gridBagConstraints);

    reqDeptTxt2.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel12.add(reqDeptTxt2, gridBagConstraints);

    TransactionTypeTxt2.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel12.add(TransactionTypeTxt2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 80);
    jPanel12.add(datePicker4, gridBagConstraints);

    jLabel116.setText("LPO/LSO");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel12.add(jLabel116, gridBagConstraints);

    reqDateTxt5.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel12.add(reqDateTxt5, gridBagConstraints);

    jLabel14.setText("Doc Type");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.weightx = 1.0;
    jPanel12.add(jLabel14, gridBagConstraints);

    UserTxt2.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
    jPanel12.add(UserTxt2, gridBagConstraints);

    jLabel15.setText("Supplier");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel12.add(jLabel15, gridBagConstraints);

    jTextField4.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel12.add(jTextField4, gridBagConstraints);

    jLabel16.setText("Tender/Quotation");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    jPanel12.add(jLabel16, gridBagConstraints);

    Contract_noTxt.setEditable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 20);
    jPanel12.add(Contract_noTxt, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 9.0;
    gridBagConstraints.weighty = 2.0;
    jPanel10.add(jPanel12, gridBagConstraints);

    jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    PurchaseItemsTbl1.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null },
                    { null, null, null, null, null, null, null, null, null } },
            new String[] { "Item Code", "Item Description", "Units", "Quantity", "Unit Price", "Value",
                    "Discount", "VAT", "Remarks" }) {
        Class[] types = new Class[] { java.lang.Object.class, java.lang.Object.class, java.lang.Object.class,
                java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Object.class,
                java.lang.Object.class, java.lang.Object.class };
        boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false, false, false };

        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    /*java.lang.Object[] strCmb = {"Normal","Urgent",""};
            
    javax.swing.JComboBox cmBox = new javax.swing.JComboBox(strCmb);
            
    javax.swing.table.TableColumn teditor = this.jTable1.getColumn("Status");
            
    teditor.setCellEditor(new javax.swing.DefaultCellEditor(cmBox));
    */

    javax.swing.table.TableColumn column = null;
    for (int i = 0; i < 4; i++) {
        column = PurchaseItemsTbl.getColumnModel().getColumn(i);
        if (i == 0) {

            column.setPreferredWidth(300); //sport column is bigger
        } else {
            if (i == 1) {
                column.setPreferredWidth(200);
            } else {
                //if (i == 2) {
                column.setPreferredWidth(200);
                // }  else
                //column.setPreferredWidth(50);

            }
        }
    }

    PurchaseItemsTbl1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            PurchaseItemsTbl1MouseClicked(evt);
        }
    });
    jScrollPane2.setViewportView(PurchaseItemsTbl1);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 9.0;
    gridBagConstraints.weighty = 9.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
    jPanel10.add(jScrollPane2, gridBagConstraints);

    jPanel13.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    jPanel13.setMinimumSize(new java.awt.Dimension(250, 27));
    jPanel13.setPreferredSize(new java.awt.Dimension(250, 27));
    jPanel13.setLayout(new java.awt.GridBagLayout());

    Save1.setMnemonic('s');
    Save1.setText("Generate LPO/LSO");
    Save1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            Save1ActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel13.add(Save1, gridBagConstraints);

    cancelbtn1.setMnemonic('l');
    cancelbtn1.setText("Clear");
    cancelbtn1.setEnabled(false);
    cancelbtn1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelbtn1ActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel13.add(cancelbtn1, gridBagConstraints);

    exitbtn1.setMnemonic('c');
    exitbtn1.setText("close");
    exitbtn1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitbtn1ActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel13.add(exitbtn1, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel10.add(jPanel13, gridBagConstraints);

    jPanel14.setLayout(new java.awt.GridBagLayout());

    jLabel3.setForeground(new java.awt.Color(255, 51, 0));
    jLabel3.setText("Total Price");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.weightx = 7.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 100, 0, 0);
    jPanel14.add(jLabel3, gridBagConstraints);

    TotalPriceTxt1.setEditable(false);
    TotalPriceTxt1.setFont(new java.awt.Font("Garamond", 1, 14)); // NOI18N
    TotalPriceTxt1.setForeground(new java.awt.Color(255, 0, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 7.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 50);
    jPanel14.add(TotalPriceTxt1, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    jPanel10.add(jPanel14, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel6.add(jPanel10, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel3.add(jPanel6, gridBagConstraints);

    jTabbedPane1.addTab("Generate LPOs/LSOs ", jPanel3);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel1.add(jTabbedPane1, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    getContentPane().add(jPanel1, gridBagConstraints);

    pack();
}

From source file:marytts.tools.redstart.AdminWindow.java

/** Programmatically set the column widths of the prompt set table */
private void setColumnWidths() {
    // only try to do this when we are visible
    if (!this.isVisible())
        return;/*from   w w w.j  av a 2s .c  om*/

    // Get columns from column model
    TableColumn recStatusColumn = jTable_PromptSet.getColumnModel().getColumn(0);
    TableColumn baseNameColumn = jTable_PromptSet.getColumnModel().getColumn(1);
    TableColumn promptColumn = jTable_PromptSet.getColumnModel().getColumn(2);

    // Get length of longest string in the column
    int widestBasename = LookAndFeel.getMaxColumnWidth(this.jTable_PromptSet, this.BASENAME_COLUMN);

    // These widths seem to be appropriate for the firs two columns - set them
    int recStatusColumnWidth = 50; // Leave hardcoded since only three possible values
    int baseNameColumnWidth = widestBasename + 10; // was 110 when hardcorded
    Test.output("Basename column width: " + widestBasename);
    recStatusColumn.setPreferredWidth(recStatusColumnWidth);
    baseNameColumn.setPreferredWidth(baseNameColumnWidth);

    // Now set prompt column to fill remaining width of the table
    int scrollbarBuffer = 3; // Buffer to avoid displaying a horizontal scrollbar
    int tableWidth = jScrollPane_PromptSet.getWidth();
    promptColumn.setPreferredWidth(tableWidth - (recStatusColumnWidth + baseNameColumnWidth + scrollbarBuffer));

}

From source file:CSSDFarm.UserInterface.java

/**
 * Updates the remove screen, gets the new selected FieldStation
 *//*from   w  w w . j  a v a 2s. c  o m*/
public void updateReport() {
    FieldStation fieldStation = (FieldStation) comboReportFieldStations.getSelectedItem();
    //If there is no FieldStation selected dont update report
    if (fieldStation != null) {
        String sensorType = (String) comboReportSensorType.getSelectedItem();
        DateFormat inputformatter = new SimpleDateFormat("dd/MM/yyyy");
        String newDate = inputformatter.format(dpReportCalendar.getDate());
        Date date = new Date();

        try {
            date = inputformatter.parse(newDate);
        } catch (ParseException ex) {

        }

        //Display the 
        EventList<SensorData> eventList = new BasicEventList<SensorData>();
        Report report = server.compileReport(fieldStation.getId());
        Vector<SensorData> sensorData = report.getDataByTypeAndDate(sensorType, date);

        eventList.clear();
        for (SensorData sensor : sensorData) {
            //sensor.collectData();
            eventList.add(sensor);
        }

        sensorsReportTable = new EventTableModel(eventList, new SensorDataTableFormat());

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                int indexFs = comboReportFieldStations.getSelectedIndex();
                SetOfSensors setOfSensors = server.getUserFieldStation().get(indexFs).getSetOfSensors();
                tblSensorData.setModel(sensorsReportTable);

                CustomTableRendererColour cellRenderer = null;
                try {
                    cellRenderer = new CustomTableRendererColour(indexFs, setOfSensors);
                } catch (Exception eX) {
                    //System.out.println(eX);
                }

                int lastRowIndex = tblSensorData.getModel().getRowCount() - 1;
                if (lastRowIndex >= 0) {
                    tblSensorData.setRowSelectionInterval(lastRowIndex, lastRowIndex);
                }
                TableColumn column = null;
                for (int i = 0; i < tblSensorData.getColumnModel().getColumnCount(); i++) {
                    column = tblSensorData.getColumnModel().getColumn(i);
                    if (i == 4) {
                        column.setPreferredWidth(250);
                    } else if (i == 3) {
                        column.setPreferredWidth(200);
                    } else {
                        column.setPreferredWidth(50);
                    }
                    if (i == 2) {
                        tblSensorData.getColumnModel().getColumn(i).setCellRenderer(cellRenderer);
                    }
                }
                //pass setOfSensors until a better way to get threshold value
                if (panelHeatmap.isVisible()) {
                    updateHeatmap(sensorData, setOfSensors);
                }
            }
        });

    }
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopAbstractTable.java

protected void adjustColumnHeaders() {
    List<TableColumn> notInited = new LinkedList<>();
    int summaryWidth = 0;
    int componentWidth = impl.getParent().getWidth();

    // take into account only visible columns
    Enumeration<TableColumn> columnEnumeration = impl.getColumnModel().getColumns();
    while (columnEnumeration.hasMoreElements()) {
        TableColumn tableColumn = columnEnumeration.nextElement();
        Column column = (Column) tableColumn.getIdentifier();

        Integer width = column.getWidth();
        if (width != null) {
            tableColumn.setPreferredWidth(width);
            tableColumn.setWidth(width);
            summaryWidth += width;//from   ww  w .  ja  v  a2s  .  com
        } else {
            notInited.add(tableColumn);
        }
    }

    if (notInited.size() != impl.getColumnCount()) {
        impl.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

        if (!notInited.isEmpty() && (componentWidth > summaryWidth)) {
            int defaultWidth = (componentWidth - summaryWidth) / notInited.size();
            for (TableColumn column : notInited) {
                column.setPreferredWidth(Math.max(defaultWidth, column.getWidth()));
            }
        }
    }
}

From source file:net.jradius.client.gui.JRadiusSimulator.java

/**
 * This method initializes attributesTable
 * /*w w w  .j  a v  a2  s.  c  o m*/
 * @return javax.swing.JTable
 */
private JTable getAttributesTable() {
    if (attributesTable == null) {
        attributesTable = new JTable(attributesTableModel);
        TableColumn col = attributesTable.getColumnModel().getColumn(7);
        col.setCellEditor(new ValueTableCellEditor());
        for (int i = 0; i < attributesTableModel.getColumnCount(); i++) {
            col = attributesTable.getColumnModel().getColumn(i);
            if (i == 0 || i == 7) {
                col.setPreferredWidth(120);
            } else {
                col.setPreferredWidth(40);
            }
        }
    }
    return attributesTable;
}

From source file:org.jets3t.apps.cockpit.Cockpit.java

/**
 * Lists the buckets in the user's S3 account and refreshes the GUI to display
 * these buckets. Any buckets or objects already listed in the GUI are cleared first.
 *///from   ww w .j a va 2s  .  c  om
private void listAllBuckets() {
    // Remove current bucket and object data from models.
    cachedBuckets.clear();
    bucketsTable.clearSelection();
    bucketTableModel.removeAllBuckets();
    objectTableModel.removeAllObjects();
    final Cockpit myself = this;

    // This is all very convoluted. This was necessary so we can display the status dialog box.
    runInBackgroundThread(new Runnable() {
        public void run() {
            if (!cloudFrontMembershipChecked) {
                // Check whether the user is signed-up for CloudFront.
                startProgressDialog("Checking for CloudFront account membership");
                try {
                    cloudFrontService = new CloudFrontService(s3ServiceMulti.getAWSCredentials(),
                            APPLICATION_DESCRIPTION, myself, null);
                    cloudFrontService.listDistributions();
                } catch (CloudFrontServiceException e) {
                    stopProgressDialog();

                    if ("OptInRequired".equals(e.getErrorCode())) {
                        log.debug("Your AWS account is not subscribed to the Amazon CloudFront service, "
                                + "you will not be able to manage distributions");
                    }
                    cloudFrontService = null;
                } finally {
                    stopProgressDialog();
                    cloudFrontMembershipChecked = true;

                    // Update the bucket table to show, or not show, distributions
                    bucketTableModel = new BucketTableModel(cloudFrontService != null);
                    bucketTableModelSorter = new TableSorter(bucketTableModel);
                    bucketsTable.setModel(bucketTableModelSorter);
                    bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader());

                    if (cloudFrontService != null) {
                        // Set column width for Cloud Front distributions indicator.
                        TableColumn distributionFlagColumn = bucketsTable.getColumnModel().getColumn(1);
                        int distributionFlagColumnWidth = 18;
                        distributionFlagColumn.setPreferredWidth(distributionFlagColumnWidth);
                        distributionFlagColumn.setMaxWidth(distributionFlagColumnWidth);
                        distributionFlagColumn.setMinWidth(0);
                    }

                    manageDistributionsMenuItem.setEnabled(cloudFrontService != null);
                }
            }

            startProgressDialog("Listing buckets for " + s3ServiceMulti.getAWSCredentials().getAccessKey());
            try {
                final S3Bucket[] buckets = s3ServiceMulti.getS3Service().listAllBuckets();

                // Lookup user's CloudFront distributions.
                Distribution[] distributions = new Distribution[] {};
                if (cloudFrontService != null) {
                    updateProgressDialog(
                            "Listing distributions for " + cloudFrontService.getAWSCredentials().getAccessKey(),
                            "", 0);
                    distributions = cloudFrontService.listDistributions();
                }
                final Distribution[] finalDistributions = distributions;

                runInDispatcherThreadImmediately(new Runnable() {
                    public void run() {
                        for (int i = 0; i < buckets.length; i++) {
                            // Determine whether each bucket has one or more CloudFront distributions.
                            boolean bucketHasDistribution = false;
                            for (int j = 0; j < finalDistributions.length; j++) {
                                if (finalDistributions[j].getOrigin()
                                        .equals(buckets[i].getName() + ".s3.amazonaws.com")) {
                                    bucketHasDistribution = true;
                                }
                            }

                            bucketTableModel.addBucket(buckets[i], bucketHasDistribution);

                            if (i == 0) {
                                ownerFrame.setTitle(
                                        APPLICATION_TITLE + " : " + buckets[i].getOwner().getDisplayName());
                            }
                        }
                    }
                });
            } catch (final Exception e) {
                stopProgressDialog();

                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        logoutEvent();

                        String message = "Unable to list your buckets in S3, please log in again";
                        log.error(message, e);
                        ErrorDialog.showDialog(ownerFrame, null, message, e);

                        loginEvent(null);
                    }
                });
            } finally {
                stopProgressDialog();
            }
        };
    });
}

From source file:de.main.sessioncreator.DesktopApplication1View.java

private void showReportPanel() {
    sessionWizardMenuItem.setEnabled(true);
    reviewVieMenuItem.setEnabled(true);/*from  ww w . java  2 s . co  m*/
    sessionReportMenuItem.setEnabled(false);
    viewReviewsPanel.setVisible(false);
    mainPanel.validate();
    wizardPanel.setVisible(false);
    mainPanel.validate();
    reportOverviewTable.setVisible(false);
    reportPanel.setVisible(true);
    mainPanel.validate();
    this.getFrame().setTitle("SessionCreator - Report");
    //Backgroundprozess to fill data to the reportPanel
    class ReportData extends SwingWorker<DefaultTableModel, Void> {

        @Override
        protected DefaultTableModel doInBackground() throws Exception {
            rh.addReport(reportChartPanel);
            reportScrollPOverviewTabel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            reportScrollPOverviewTabel.setToolTipText("Please wait...");
            reportlblSum.setText("Sums of Charters done: <counting>");
            progressBar.setIndeterminate(true);
            progressBar.setVisible(true);
            model = new DefaultTableModel();
            reportOverviewTable.removeAll();
            model = rh.getTableModel();
            reportOverviewTable.setModel(model);
            reportOverviewTable.setVisible(true);

            String count = rh.getAllSessionCount(model);
            reportlblSum.setText("Sums of Charters done: " + count);
            String[] text = rh.getAllBugsAndIssues();
            reportlblBug.setText(text[0]);
            reportlblIssue.setText(text[1]);

            return model;
        }

        @Override
        protected void done() {
            try {
                reportScrollPOverviewTabel.setCursor(Cursor.getDefaultCursor());
                reportScrollPOverviewTabel.setToolTipText("");
                progressBar.setIndeterminate(false);
                progressBar.setVisible(false);
                reportScrollPOverviewTabel.setEnabled(true);
                reportOverviewTable.setFillsViewportHeight(true);
                reportOverviewTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
                TableRowSorter<DefaultTableModel> rowSorter = new TableRowSorter<DefaultTableModel>(model);
                reportOverviewTable.setRowSorter(rowSorter);
                rowSorter.setComparator(1, new Comparator<Integer>() {

                    @Override
                    public int compare(Integer int1, Integer int2) {
                        return int1.intValue() - int2.intValue();
                    }
                });
                TableColumn column = null;

                for (int i = 0; i < 2; i++) {
                    column = reportOverviewTable.getColumnModel().getColumn(i);
                    if (i == 1) {
                        column.setPreferredWidth(10); //third column is bigger
                        DefaultTableCellRenderer myRenderer = new DefaultTableCellRenderer();
                        //Textalignment in second column right
                        myRenderer.setHorizontalAlignment(SwingConstants.RIGHT);
                        column.setCellRenderer(myRenderer);
                    } else {
                        column.setPreferredWidth(490);
                    }
                }

            } catch ( /* InterruptedException, ExecutionException */Exception e) {
            }
        }
    }
    new ReportData().execute();
}