setBounds((screenSize.width-400)/2, (screenSize.height-120)/2, 400, 120);
java.awt.Dimension dialogSize = getSize(); setLocation((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
    private void initComponents() {//GEN-BEGIN:initComponents        java.awt.GridBagConstraints gridBagConstraints;        jLabel2 = new javax.swing.JLabel();        httpProxyServerTextField = new javax.swing.JTextField();        jLabel5 = new javax.swing.JLabel();        httpProxyPortTextField = new javax.swing.JTextField();        jLabel4 = new javax.swing.JLabel();        httpsProxyServerTextField = new javax.swing.JTextField();        jLabel3 = new javax.swing.JLabel();        httpsProxyPortTextField = new javax.swing.JTextField();        jLabel1 = new javax.swing.JLabel();        jScrollPane1 = new javax.swing.JScrollPane();        noProxyTextArea = new javax.swing.JTextArea();        jPanel1 = new javax.swing.JPanel();        applyButton = new javax.swing.JButton();        cancelButton = new javax.swing.JButton();        getContentPane().setLayout(new java.awt.GridBagLayout());        setTitle("Config proxies");        addWindowListener(new java.awt.event.WindowAdapter() {            public void windowClosing(java.awt.event.WindowEvent evt) {                closeDialog(evt);            }        });        jLabel2.setText("HTTP  Proxy : ");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);        getContentPane().add(jLabel2, gridBagConstraints);        httpProxyServerTextField.setMinimumSize(new java.awt.Dimension(150, 20));        httpProxyServerTextField.setPreferredSize(new java.awt.Dimension(150, 20));        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 0;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        getContentPane().add(httpProxyServerTextField, gridBagConstraints);        jLabel5.setText("Port :");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 0;        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);        getContentPane().add(jLabel5, gridBagConstraints);        httpProxyPortTextField.setMinimumSize(new java.awt.Dimension(60, 20));        httpProxyPortTextField.setPreferredSize(new java.awt.Dimension(60, 20));        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 3;        gridBagConstraints.gridy = 0;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        getContentPane().add(httpProxyPortTextField, gridBagConstraints);        jLabel4.setText("HTTPS Proxy : ");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);        getContentPane().add(jLabel4, gridBagConstraints);        httpsProxyServerTextField.setMinimumSize(new java.awt.Dimension(150, 20));        httpsProxyServerTextField.setPreferredSize(new java.awt.Dimension(150, 20));        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 1;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        getContentPane().add(httpsProxyServerTextField, gridBagConstraints);        jLabel3.setText("Port :");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 1;        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);        getContentPane().add(jLabel3, gridBagConstraints);        httpsProxyPortTextField.setMinimumSize(new java.awt.Dimension(60, 20));        httpsProxyPortTextField.setPreferredSize(new java.awt.Dimension(60, 20));        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 3;        gridBagConstraints.gridy = 1;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        getContentPane().add(httpsProxyPortTextField, gridBagConstraints);        jLabel1.setText("No Proxy : ");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);        getContentPane().add(jLabel1, gridBagConstraints);        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);        jScrollPane1.setMinimumSize(new java.awt.Dimension(100, 48));        jScrollPane1.setPreferredSize(new java.awt.Dimension(103, 51));        noProxyTextArea.setLineWrap(true);        noProxyTextArea.setToolTipText("Enter a comma separated list of hosts that do not need to go through the proxy");        noProxyTextArea.setPreferredSize(null);        jScrollPane1.setViewportView(noProxyTextArea);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 2;        gridBagConstraints.gridwidth = 3;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        getContentPane().add(jScrollPane1, gridBagConstraints);        applyButton.setText("Apply");        applyButton.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                applyButtonActionPerformed(evt);            }        });        jPanel1.add(applyButton);        cancelButton.setText("Cancel");        cancelButton.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                cancelButtonActionPerformed(evt);            }        });        jPanel1.add(cancelButton);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 3;        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;        getContentPane().add(jPanel1, gridBagConstraints);        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();        setBounds((screenSize.width-400)/2, (screenSize.height-120)/2, 400, 120);    }//GEN-END:initComponents