Example usage for java.awt GridBagConstraints WEST

List of usage examples for java.awt GridBagConstraints WEST

Introduction

In this page you can find the example usage for java.awt GridBagConstraints WEST.

Prototype

int WEST

To view the source code for java.awt GridBagConstraints WEST.

Click Source Link

Document

Put the component on the left side of its display area, centered vertically.

Usage

From source file:ffx.ui.KeywordPanel.java

private void loadKeywordGroup() {
    synchronized (this) {
        editPanel.removeAll();/*from  w  w w .  j  a va 2  s  . co m*/
        String selectedGroup = (String) groupComboBox.getSelectedItem();
        if (currentKeys == null) {
            editPanel.setLayout(flowLayout);
            editPanel.add(noSystemLabel);
            int temp = splitPane.getDividerLocation();
            splitPane.setBottomComponent(noKeywordPanel);
            splitPane.setDividerLocation(temp);
        } else if (selectedGroup.equalsIgnoreCase("Flat File View")) {
            editPanel.setLayout(borderLayout);
            publishKeywords();
            editPanel.add(flatfileTextArea, BorderLayout.CENTER);
            int temp = splitPane.getDividerLocation();
            splitPane.setBottomComponent(noKeywordPanel);
            splitPane.setDividerLocation(temp);
        } else if (selectedGroup.equalsIgnoreCase("Active Keywords")) {
            gridPanel.removeAll();
            gridBagConstraints.gridy = 0;
            gridBagConstraints.anchor = GridBagConstraints.WEST;
            gridBagConstraints.gridheight = 1;
            gridBagConstraints.gridwidth = 1;
            gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
            for (KeywordComponent keywordComponent : keywordHashMap.values()) {
                if (keywordComponent.isActive() == true) {
                    JPanel jptemp = keywordComponent.getKeywordGUI();
                    gridBagLayout.setConstraints(jptemp, gridBagConstraints);
                    gridPanel.add(jptemp);
                    gridBagConstraints.gridy++;
                }
            }
            KeywordComponent.fillPanel(gridPanel, gridBagLayout, gridBagConstraints);
            editPanel.setLayout(flowLayout);
            editPanel.add(gridPanel);
            int temp = splitPane.getDividerLocation();
            splitPane.setBottomComponent(descriptScrollPane);
            splitPane.setDividerLocation(temp);
        } else {
            gridPanel.removeAll();
            gridBagConstraints.gridy = 0;
            gridBagConstraints.gridx = 0;
            gridBagConstraints.anchor = GridBagConstraints.WEST;
            gridBagConstraints.gridheight = 1;
            gridBagConstraints.gridwidth = 1;
            gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
            for (KeywordComponent keywordComponent : keywordHashMap.values()) {
                if (keywordComponent.getKeywordGroup().equalsIgnoreCase(selectedGroup)) {
                    JPanel jptemp = keywordComponent.getKeywordGUI();
                    gridBagLayout.setConstraints(jptemp, gridBagConstraints);
                    gridPanel.add(jptemp);
                    gridBagConstraints.gridy++;
                }
            }
            KeywordComponent.fillPanel(gridPanel, gridBagLayout, gridBagConstraints);
            editPanel.setLayout(flowLayout);
            editPanel.add(gridPanel);
            int temp = splitPane.getDividerLocation();
            splitPane.setBottomComponent(descriptScrollPane);
            splitPane.setDividerLocation(temp);
        }
        if (currentKeyFile != null) {
            statusLabel.setText("  " + currentKeyFile.toString());
        } else {
            statusLabel.setText("  ");
        }
        editScrollPane.validate();
        editScrollPane.repaint();
    }
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

private void createBottomOrgPanel() {
    JLabel locationLbl = new JLabel(translate("Location:"));
    locationLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel dateLbl = new JLabel(translate("Date:"));
    dateLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel beginLbl = new JLabel(translate("Period of time:"));
    beginLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel tillLabel = new JLabel(translate("to"));
    tillLabel.setFont(UI.VERY_LARGE_FONT_BOLD);

    clockLabel.setFont(UI.VERY_LARGE_FONT_BOLD);

    dateTxtFld = new ObservingTextField();
    dateTxtFld.setFont(UI.VERY_LARGE_FONT);

    dateTxtFld.setFocusable(false);// w w  w .j  av a 2 s  .c o  m
    dateTxtFld.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dateTxtFld.setPreferredSize(new Dimension(190, (int) dateTxtFld.getPreferredSize().getHeight()));
    dateTxtFld.setMinimumSize(dateTxtFld.getPreferredSize());
    dateTxtFld.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            // instantiate the DatePicker
            DatePicker dp = new DatePicker(UI.getInstance().getProtocolFrame(),
                    UI.getInstance().getProtocolFrame().getDateTxtFld());

            // previously selected date
            Date selectedDate = dp.parseDate(UI.getInstance().getProtocolFrame().getDateTxtFld().getText());
            dp.setSelectedDate(selectedDate);
            dp.start(UI.getInstance().getProtocolFrame().getDateTxtFld());
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    dateTxtFld.addKeyListener(updateListener);

    /*
     * creating spinner panel
     */
    beginMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1));
    beginHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1));

    endMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1));
    endHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1));

    beginMSpinner.setFont(UI.VERY_LARGE_FONT);
    beginHSpinner.setFont(UI.VERY_LARGE_FONT);
    endHSpinner.setFont(UI.VERY_LARGE_FONT);
    endMSpinner.setFont(UI.VERY_LARGE_FONT);

    beginMSpinner.addChangeListener(spinnerChangeListener);
    beginHSpinner.addChangeListener(spinnerChangeListener);
    endHSpinner.addChangeListener(spinnerChangeListener);
    endMSpinner.addChangeListener(spinnerChangeListener);

    locationTxtFld = new JTextField();
    locationTxtFld.setFont(UI.VERY_LARGE_FONT);

    /*
     * Hide border if the application runs on Mac OS X
     */
    boolean hideBorder = UI.getInstance().getPlatform() == UI.Platform.MAC;

    GUITools.formatSpinner(endHSpinner, hideBorder);
    GUITools.formatSpinner(endMSpinner, hideBorder);
    GUITools.formatSpinner(beginHSpinner, hideBorder);
    GUITools.formatSpinner(beginMSpinner, hideBorder);

    // TODO: In some cases 'currentProt.getDate()' returns null.
    dateF.setTimeZone(currentProt.getDate().getTimeZone());
    dateTxtFld.setText(dateF.format(currentProt.getDate().getTime()));

    int beginHours = currentProt.getStart().get(Calendar.HOUR_OF_DAY);
    beginMSpinner.setValue(currentProt.getStart().get(Calendar.MINUTE));
    beginHSpinner.setValue(beginHours);

    int endHours = currentProt.getEnd().get(Calendar.HOUR_OF_DAY);
    endMSpinner.setValue(currentProt.getEnd().get(Calendar.MINUTE));
    endHSpinner.setValue(endHours);

    /*
     * Correct the leading zero's
     */
    if ((Integer) beginMSpinner.getValue() == 0) {
        ((NumberEditor) beginMSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) beginHSpinner.getValue() == 0) {
        ((NumberEditor) beginHSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) endMSpinner.getValue() == 0) {
        ((NumberEditor) endMSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) endHSpinner.getValue() == 0) {
        ((NumberEditor) endHSpinner.getEditor()).getTextField().setText("00");
    }

    locationTxtFld.setText(currentProt.getLocation().trim());

    JPanel spinnerPanel = new JPanel(gbl);
    spinnerPanel.setOpaque(false);

    JLabel labelDoubleDot1 = new JLabel(":");
    labelDoubleDot1.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel labelDoubleDot2 = new JLabel(":");
    labelDoubleDot2.setFont(UI.VERY_LARGE_FONT_BOLD);

    GUITools.addComponent(spinnerPanel, gbl, beginHSpinner, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot1, 1, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, beginMSpinner, 2, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(spinnerPanel, gbl, tillLabel, 3, 0, 1, 1, 1.0, 0, 0, 10, 0, 10,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, endHSpinner, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST);
    GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot2, 5, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, endMSpinner, 6, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST);

    /*
     * adding created components to orgpanel
     */
    GUITools.addComponent(bottomOrgPanel, gbl, dateLbl, 2, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.WEST);
    GUITools.addComponent(bottomOrgPanel, gbl, dateTxtFld, 3, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);

    GUITools.addComponent(bottomOrgPanel, gbl, locationLbl, 0, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.WEST);
    GUITools.addComponent(bottomOrgPanel, gbl, locationTxtFld, 1, 0, 1, 1, 1.0, 1.0, 10, 5, 0, 10,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);

    GUITools.addComponent(bottomOrgPanel, gbl, beginLbl, 5, 0, 1, 1, 0.0, 1.0, 10, 30, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.EAST);
    GUITools.addComponent(bottomOrgPanel, gbl, spinnerPanel, 6, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 25,
            GridBagConstraints.VERTICAL, GridBagConstraints.WEST);

    updateAttButtons();
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java

/** 
 * Builds the UI component hosting the UI component used to modify 
 * the password./*w w  w  .j a v  a 2  s . c  o  m*/
 * 
 * @return See above.
 */
private JPanel buildPasswordPanel() {
    JPanel content = new JPanel();
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    Registry reg = MetadataViewerAgent.getRegistry();
    String ldap = (String) reg.lookup(LookupNames.USER_AUTHENTICATION);
    if (ldap != null && ldap.length() > 0) {
        content.setBorder(BorderFactory.createTitledBorder("LDAP Authentication"));
        content.setLayout(new FlowLayout(FlowLayout.LEFT));
        content.add(new JLabel(ldap));
        return content;
    }
    content.setBorder(BorderFactory.createTitledBorder("Change Password"));

    content.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    if (MetadataViewerAgent.isAdministrator()) {
        content.add(UIUtilities.setTextFont(PASSWORD_NEW), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(passwordNew, c);
    } else {
        content.add(UIUtilities.setTextFont(PASSWORD_OLD), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(oldPassword, c);
        c.gridy++;
        c.gridx = 0;
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0.0;
        content.add(UIUtilities.setTextFont(PASSWORD_NEW), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(passwordNew, c);
        c.gridy++;
        c.gridx = 0;
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0.0;
        content.add(UIUtilities.setTextFont(PASSWORD_CONFIRMATION), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(passwordConfirm, c);
        c.gridy++;
        c.gridx = 0;
    }

    JPanel p = new JPanel();
    p.setBackground(UIUtilities.BACKGROUND_COLOR);
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(content);
    JPanel buttonPanel = UIUtilities.buildComponentPanel(passwordButton);
    buttonPanel.setBackground(UIUtilities.BACKGROUND_COLOR);
    p.add(buttonPanel);
    return p;
}

From source file:uk.ac.ucl.chem.ccs.clinicalgui.DisplayJobPanel.java

private void initGUI() {
    if (ajo == null) {
        try {//from  ww  w. ja v  a2  s .com
            setPreferredSize(new Dimension(400, 300));
        } catch (Exception e) {
            e.printStackTrace();
        }
        //JLabel l = new JLabel("No simulation running");
        //this.add(l);
        //this.setEnabled(false);
        return;
    }
    System.out.println("I am not null: drawing the display job panel");
    try {
        TableLayout thisLayout = new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED,
                TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.FILL } });
        thisLayout.setHGap(5);
        thisLayout.setVGap(5);
        this.setLayout(thisLayout);

        {
            jPanel1 = new JPanel();
            TableLayout jPanel1Layout = new TableLayout(new double[][] {
                    { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED,
                            TableLayout.PREFERRED },
                    { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                            TableLayout.FILL } });

            jPanel1Layout.setHGap(5);
            jPanel1Layout.setVGap(5);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1.setLayout(jPanel1Layout);

            jPanel1.setBorder(BorderFactory.createEtchedBorder());
            this.add(jPanel1, "0, 0, 0, 2");
            jPanel1.setPreferredSize(new java.awt.Dimension(630, 305));
            jPanel1.setSize(630, 305);
            {
                dtails = new JPanel();
                GridLayout dtailsLayout = new GridLayout(1, 1);
                dtailsLayout.setColumns(1);
                dtailsLayout.setHgap(5);
                dtailsLayout.setVgap(5);
                dtails.setBorder(BorderFactory.createTitledBorder("Job Details"));
                jPanel1.add(dtails, "0,  0,  2,  4");
                dtails.setLayout(dtailsLayout);
                {
                    jobDetailsSP = new JScrollPane();
                    dtails.add(jobDetailsSP);
                    {
                        jPanel3 = new JPanel();
                        TableLayout jPanel3Layout = new TableLayout(
                                new double[][] { { TableLayout.PREFERRED, TableLayout.FILL },
                                        { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                        jPanel3Layout.setHGap(5);
                        jPanel3Layout.setVGap(5);
                        jPanel3.setLayout(jPanel3Layout);
                        jobDetailsSP.setViewportView(jPanel3);
                        jPanel3.setBackground(new java.awt.Color(156, 199, 219));
                        {
                            jLabel2 = new JLabel();
                            jPanel3.add(jLabel2, "0, 0");
                            jLabel2.setText("Job Start Time");
                        }
                        {
                            jLabel3 = new JLabel();
                            jPanel3.add(jLabel3, "0, 1");
                            jLabel3.setText("Resource ID");
                        }
                        {
                            jLabel4 = new JLabel();
                            jPanel3.add(jLabel4, "0, 2");
                            jLabel4.setText("Job Type");
                        }
                        {
                            jLabel5 = new JLabel();
                            jPanel3.add(jLabel5, "0, 3");
                            jLabel5.setText("Status");
                        }
                        {
                            jLabel6 = new JLabel();
                            jPanel3.add(jLabel6, "0, 4");
                            jLabel6.setText("Machine");
                        }
                        {
                            jLabel7 = new JLabel();
                            jPanel3.add(jLabel7, "0, 5");
                            jLabel7.setText("CPUs Requested");
                        }
                        {
                            jLabel8 = new JLabel();
                            jPanel3.add(jLabel8, "0, 6");
                            jLabel8.setText("Configuration File");
                        }
                        {
                            jLabel9 = new JLabel();
                            jPanel3.add(jLabel9, "0, 7");
                            jLabel9.setText("Job Arguments");
                        }
                        {
                            jLabel10 = new JLabel();
                            jPanel3.add(jLabel10, "0, 8");
                            jLabel10.setText("Job Stdout");
                        }
                        {
                            jLabel11 = new JLabel();
                            jPanel3.add(jLabel11, "0, 9");
                            jLabel11.setText("Job Stderr");
                        }
                        {
                            jLabel12 = new JLabel();
                            jPanel3.add(jLabel12, "0, 10");
                            jLabel12.setText("Job Stdin");
                        }
                        {
                            jLabel13 = new JLabel();
                            jPanel3.add(jLabel13, "0, 11");
                            jLabel13.setText("Resource Endpoint");
                        }
                        {
                            jobName = new JTextField();
                            jPanel3.add(jobName, "1, 0");
                            jobName.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobName.setOpaque(true);
                            jobName.setBackground(new java.awt.Color(255, 255, 255));
                            jobName.setEditable(false);

                        }
                        {
                            resourceID = new JTextField();
                            jPanel3.add(resourceID, "1, 1");
                            resourceID.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            resourceID.setOpaque(true);
                            resourceID.setBackground(new java.awt.Color(255, 255, 255));
                            resourceID.setEditable(false);

                        }
                        {
                            jobType = new JTextField();
                            jPanel3.add(jobType, "1, 2");
                            jobType.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobType.setBackground(new java.awt.Color(255, 255, 255));
                            jobType.setOpaque(true);
                            jobType.setEditable(false);

                        }
                        {
                            jobStatus = new JLabel();
                            jPanel3.add(jobStatus, "1, 3");
                            jobStatus.setOpaque(true);
                            jobStatus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStatus.setBackground(new java.awt.Color(255, 255, 255));
                        }
                        {
                            rm = new JTextField();
                            jPanel3.add(rm, "1, 4");
                            rm.setBackground(new java.awt.Color(255, 255, 255));
                            rm.setOpaque(true);
                            rm.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            rm.setEditable(false);

                        }
                        {
                            jobCpus = new JTextField();
                            jPanel3.add(jobCpus, "1, 5");
                            jobCpus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobCpus.setOpaque(true);
                            jobCpus.setBackground(new java.awt.Color(255, 255, 255));
                            jobCpus.setEditable(false);

                        }
                        {
                            jobConf = new JTextField();
                            jPanel3.add(jobConf, "1, 6");
                            jobConf.setBackground(new java.awt.Color(255, 255, 255));
                            jobConf.setOpaque(true);
                            jobConf.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobConf.setEditable(false);

                        }
                        {
                            jobArgs = new JTextField();
                            jPanel3.add(jobArgs, "1, 7");
                            jobArgs.setBackground(new java.awt.Color(255, 255, 255));
                            jobArgs.setOpaque(true);
                            jobArgs.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobArgs.setEditable(false);

                        }
                        {
                            jobSdtout = new JTextField();
                            jPanel3.add(jobSdtout, "1, 8");
                            jobSdtout.setBackground(new java.awt.Color(255, 255, 255));
                            jobSdtout.setOpaque(true);
                            jobSdtout.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobSdtout.setEditable(false);

                        }
                        {
                            jobStderr = new JTextField();
                            jPanel3.add(jobStderr, "1, 9");
                            jobStderr.setBackground(new java.awt.Color(255, 255, 255));
                            jobStderr.setOpaque(true);
                            jobStderr.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStderr.setEditable(false);

                        }
                        {
                            jobStdin = new JTextField();
                            jPanel3.add(jobStdin, "1, 10");
                            jobStdin.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStdin.setBackground(new java.awt.Color(255, 255, 255));
                            jobStdin.setOpaque(true);
                            jobStdin.setEditable(false);

                        }
                        {
                            jobEPR = new JTextField();
                            jPanel3.add(jobEPR, "1, 11");
                            jobEPR.setOpaque(true);
                            jobEPR.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobEPR.setBackground(new java.awt.Color(255, 255, 255));
                            jobEPR.setEditable(false);

                        }
                    }

                }
            }
            {
                controls = new JPanel();
                TableLayout controlsLayout = new TableLayout(new double[][] { { TableLayout.FILL },
                        { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                controlsLayout.setHGap(5);
                controlsLayout.setVGap(5);
                controls.setLayout(controlsLayout);
                controls.setBorder(BorderFactory.createTitledBorder("Operations"));
                jPanel1.add(controls, "3,  0,  4,  2");
                {
                    updateStatus = new JButton();
                    controls.add(updateStatus, "0, 0");
                    updateStatus.setText("Update Job Status");
                    updateStatus.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            if (updateStatus.getText().equals("Start Job")) {
                                StartCall sc = new StartCall(ajo,
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-lifetime"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-port"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-dn"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-server"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-pw"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-un"));
                                ajo = sc.makeCall();
                                updatePanel();
                            } else {
                                pollJobState();
                            }
                        }
                    });
                }
                {
                    teminateJob = new JButton();
                    controls.add(teminateJob, "0, 1");
                    teminateJob.setText("Terminate Job");
                    teminateJob.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            TerminateSimCall tsc = new TerminateSimCall(ajo.getEndPoint());
                            DisplayJobPanel.this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
                            boolean tcsstatus = tsc.makeCall();
                            DisplayJobPanel.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                            if (tcsstatus) {
                                ajo.setState(AHEJobObject.GRIDSAM_TERMINATING);
                                updateState();
                            } else {
                                ErrorMessage em = new ErrorMessage(DisplayJobPanel.this,
                                        "Error terminating job. Check log for details");
                                ;
                            }
                        }
                    });
                }
                {
                    vizButton = new JButton();
                    controls.add(vizButton, "0, 2");
                    vizButton.setText("Visualize");

                    vizButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            String h = "localhost";
                            int p = 65250;
                            int w = 1024 * 1024;

                            VizSteererWindow vs = new VizSteererWindow(h, p, w,
                                    (JFrame) DisplayJobPanel.this.getTopLevelAncestor());
                        }
                    });
                }

                {
                    deleteFiles = new JCheckBox();
                    controls.add(deleteFiles, "0, 3");
                    deleteFiles.setText("Delete staged files when destroying job");
                    deleteFiles.setFont(new java.awt.Font("Sansserif", 0, 11));
                    deleteFiles.setSelected(true);
                }
            }
            {
                polling = new JPanel();
                GridBagLayout pollingLayout = new GridBagLayout();
                pollingLayout.rowWeights = new double[] { 0.1, 0.1, 0.1, 0.1 };
                pollingLayout.rowHeights = new int[] { 7, 7, 7, 7 };
                pollingLayout.columnWeights = new double[] { 0.0, 0.1 };
                pollingLayout.columnWidths = new int[] { 109, 7 };
                polling.setBorder(BorderFactory.createTitledBorder("Status Polling"));
                jPanel1.add(polling, "3,  3,  4,  4");
                polling.setLayout(pollingLayout);
                {
                    jLabel1 = new JLabel();
                    polling.add(jLabel1,
                            new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
                                    GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                    jLabel1.setText("Set the polling interval ");
                    jLabel1.setFont(new java.awt.Font("Sansserif", 0, 11));
                }
                {
                    jSlider1 = new JSlider();
                    polling.add(jSlider1,
                            new GridBagConstraints(0, 1, 2, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST,
                                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
                    jSlider1.setMaximum(60);
                    jSlider1.setValue(0);
                    //jSlider1.setMinorTickSpacing(1);
                    //jSlider1.createStandardLabels(5);
                    Hashtable lab = new Hashtable();
                    lab.put(new Integer(0), new JLabel("0"));
                    lab.put(new Integer(20), new JLabel("10"));
                    lab.put(new Integer(40), new JLabel("20"));
                    lab.put(new Integer(60), new JLabel("30"));
                    jSlider1.setLabelTable(lab);

                    jSlider1.setPaintTicks(true);
                    jSlider1.setPaintLabels(true);
                    jSlider1.setSnapToTicks(false);
                    jSlider1.setMajorTickSpacing(2);
                    jSlider1.setFont(new java.awt.Font("Sansserif", 0, 11));
                    jSlider1.addChangeListener(new ChangeListener() {
                        public void stateChanged(ChangeEvent e) {
                            if (jSlider1.getValue() != 0) {
                                Integer i = new Integer(jSlider1.getValue());
                                time1.setText(Float.toString(i.floatValue() / 2));
                                if (pollingButton.getText().equals("Stop Polling")) {
                                    pollTimer.stop();

                                    pollTimer.setInitialDelay(jSlider1.getValue() * 30000);
                                    pollTimer.setDelay(jSlider1.getValue() * 30000);
                                    pollTimer.start();
                                }
                            } else {
                                if (pollingButton.getText().equals("Stop Polling")) {
                                    pollTimer.stop();
                                    pollingButton.setText("Start Polling");
                                }
                                time1.setText("0.0");
                            }
                        }
                    });
                }
                {
                    pollingButton = new JButton();
                    polling.add(pollingButton,
                            new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST,
                                    GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    pollingButton.setText("Start Polling");
                    pollingButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            if (jSlider1.getValue() > 0) {
                                if (pollingButton.getText().equals("Start Polling")) {
                                    pollTimer = new Timer(jSlider1.getValue() * 30000, new ActionListener() {
                                        public void actionPerformed(ActionEvent evt) {
                                            pollJobState();
                                        }
                                    });
                                    pollTimer.setInitialDelay(1);
                                    pollTimer.start();
                                    pollingButton.setText("Stop Polling");
                                } else {
                                    pollTimer.stop();
                                    pollingButton.setText("Start Polling");
                                }
                            }
                        }
                    });

                }
                {
                    time = new JLabel();
                    polling.add(time, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    time.setBackground(new java.awt.Color(255, 255, 255));
                    time.setText("Every");
                }
                {
                    jLabel14 = new JLabel();
                    polling.add(jLabel14, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    jLabel14.setText("mins");
                }
                {
                    time1 = new JLabel();
                    polling.add(time1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    time1.setText("0.0");
                    ;
                }
            }
        }
        {
            jPanel2 = new JPanel();
            GridLayout jPanel2Layout = new GridLayout(1, 1);
            jPanel2Layout.setColumns(1);
            jPanel2Layout.setHgap(5);
            jPanel2Layout.setVgap(5);
            jPanel2.setLayout(jPanel2Layout);
            TitledBorder title2;
            title2 = BorderFactory.createTitledBorder("Job Output");
            jPanel2.setBorder(title2);
            this.add(jPanel2, "0, 3, 0, 4");
            jPanel2.setPreferredSize(new java.awt.Dimension(630, 254));
            {
                jTabbedPane1 = new JTabbedPane();
                jPanel2.add(jTabbedPane1);

                {
                    gridsamStatus = new JPanel();
                    GridLayout gridsamStatusLayout = new GridLayout(1, 1);
                    gridsamStatusLayout.setColumns(1);
                    gridsamStatusLayout.setHgap(5);
                    gridsamStatusLayout.setVgap(5);
                    gridsamStatus.setLayout(gridsamStatusLayout);
                    jTabbedPane1.addTab("AHE Job Status", null, gridsamStatus, null);
                    {
                        jScrollPane1 = new JScrollPane();
                        gridsamStatus.add(jScrollPane1);
                        {
                            gridsamStatusResults = new JTextArea();
                            jScrollPane1.setViewportView(gridsamStatusResults);
                            gridsamStatusResults.setFont(new java.awt.Font("Monospaced", 0, 12));
                        }
                    }
                }
                {
                    stagedFiles = new JPanel();
                    TableLayout stagedFilesLayout = new TableLayout(new double[][] {
                            { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                    TableLayout.PREFERRED, TableLayout.PREFERRED },
                            { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                    TableLayout.FILL, TableLayout.PREFERRED } });
                    stagedFilesLayout.setHGap(5);
                    stagedFilesLayout.setVGap(5);
                    stagedFiles.setLayout(stagedFilesLayout);
                    jTabbedPane1.addTab("Staged Files", null, stagedFiles, null);
                    {
                        filesScrollPane = new JScrollPane();
                        stagedFiles.add(filesScrollPane, "0, 0, 5, 4");
                        {

                            outputFilesTable = new JTable();

                            int col1 = 0, col2 = 0;
                            int fsize = outputFilesTable.getFont().getSize() - 5;
                            Object data[][] = new Object[ajo.getOutfiles().size() + ajo.getInfiles().size()][3];

                            int i = 0;
                            if (ajo.getOutfiles() != null) {
                                Iterator it = ajo.getOutfiles().iterator();
                                while (it.hasNext()) {
                                    JobFileElement je = (JobFileElement) it.next();
                                    data[i][0] = new Boolean(true);
                                    data[i][1] = je.getName();
                                    if (je.getName().length() > col1) {
                                        col1 = je.getName().length();
                                    }
                                    String url = Tools.getUrlNoUP(je.getRemotepath());
                                    data[i][2] = url;
                                    if (url.length() > col2) {
                                        col2 = url.length();
                                    }
                                    i++;
                                }
                            }

                            if (ajo.getInfiles() != null) {
                                Iterator it = ajo.getInfiles().iterator();
                                while (it.hasNext()) {
                                    JobFileElement je = (JobFileElement) it.next();
                                    data[i][0] = new Boolean(false);
                                    data[i][1] = je.getName();
                                    if (je.getName().length() > col1) {
                                        col1 = je.getName().length();
                                    }
                                    String url = Tools.getUrlNoUP(je.getRemotepath());
                                    data[i][2] = url;
                                    if (url.length() > col2) {
                                        col2 = url.length();
                                    }
                                    i++;
                                }
                            }

                            String colNames[] = { "Download", "File Name", "File Location" };

                            TableModel outputFilesTableModel = new MyTableModel(data, colNames);
                            outputFilesTable.setIntercellSpacing(new Dimension(3, 3));
                            outputFilesTable.setModel(outputFilesTableModel);
                            outputFilesTable.getColumnModel().getColumn(0).setPreferredWidth(70);
                            outputFilesTable.getColumnModel().getColumn(1).setPreferredWidth(col1 * fsize);
                            outputFilesTable.getColumnModel().getColumn(2).setPreferredWidth(col2 * fsize);
                            outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                            filesScrollPane.setViewportView(outputFilesTable);
                            this.addComponentListener(new ComponentAdapter() {
                                public void componentResized(ComponentEvent e) {
                                    if (outputFilesTable.getWidth() < filesScrollPane.getWidth()) {
                                        outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
                                    } else {
                                        outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                                    }
                                }
                            });

                        }

                    }
                    {
                        downloadButton = new JButton();
                        stagedFiles.add(downloadButton, "5, 5");
                        downloadButton.setText("Download");
                        downloadButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                int outFileSize = ajo.getOutfiles().size();
                                for (int row = 0; row < outputFilesTable.getRowCount(); row++) {
                                    if (((Boolean) outputFilesTable.getValueAt(row, 0))
                                            .booleanValue() == true) {

                                        if (row < outFileSize) {
                                            JobFileElement je = (JobFileElement) ajo.getOutfiles()
                                                    .elementAt(row);

                                            if (fileLocation != null) {
                                                je.setLocalpath(Tools.checkURL(fileLocation) + je.getName());
                                            }

                                            downloadFiles.add(je);
                                        } else {
                                            JobFileElement je = (JobFileElement) ajo.getInfiles()
                                                    .elementAt(row - outFileSize);

                                            if (fileLocation != null) {
                                                je.setLocalpath(Tools.checkURL(fileLocation) + je.getName());
                                            }

                                            downloadFiles.add(je);
                                        }
                                    }

                                }

                                StageFilesIn task = new StageFilesIn(
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavserver"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavuser"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavpasswd"));
                                task.init(downloadFiles);

                                ProgressMonitor progressMonitor = new ProgressMonitor(DisplayJobPanel.this,
                                        "Downloading Files", null, 0, task.getLength());
                                //progressMonitor.setMillisToDecideToPopup(1);
                                progressMonitor.setMillisToPopup(100);
                                //jProgressBar1.setMaximum(task.getLength());
                                //jProgressBar1.setValue(0);

                                while (task.filesToStage()) {
                                    if (task.stageNext()) {
                                        progressMonitor.setProgress(task.getCurrent());
                                    } else {
                                        cat.error(task.getError());

                                    }

                                }

                            }
                        });

                    }
                    {
                        changeLocationButton = new JButton();
                        stagedFiles.add(changeLocationButton, "4, 5");
                        changeLocationButton.setText("Local Dir");
                        changeLocationButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                JFileChooser fc = new JFileChooser();
                                fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                                int returnVal = fc.showOpenDialog(DisplayJobPanel.this);

                                if (returnVal == JFileChooser.APPROVE_OPTION) {
                                    File file = fc.getSelectedFile();
                                    fileLocation = file.getAbsolutePath();
                                    //System.out.println(fileLocation);
                                }
                            }
                        });

                    }
                }
                {
                    if (ajo.getReGSWSEPR() != null) {

                        regSteering = new JPanel();

                        TableLayout steerLayout = new TableLayout(
                                new double[][] { { TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL,
                                        TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                        regSteering.setLayout(steerLayout);
                        steeredApp = true;
                        jTabbedPane1.addTab("ReG Steering", null, regSteering, null);
                        {
                            JLabel look = new JLabel("Steering address");
                            steerERP = new JTextField();
                            steer = new JButton("Start Steerer");
                            steer.setEnabled(false);
                            steer.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent evt) {
                                    vs = new VizSteererWindow(h, p, w,
                                            DisplayJobPanel.this.getTopLevelAncestor());
                                }
                            });

                            regSteering.add(look, "0,1");
                            regSteering.add(steerERP, "0,2");
                            regSteering.add(steer, "0,3");

                        }

                    }
                }

            }
        }
        updatePanel();
        this.setPreferredSize(new java.awt.Dimension(630, 605));
        this.setSize(630, 605);
        this.setOpaque(false);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.pentaho.reporting.ui.datasources.kettle.KettleDataSourceDialog.java

protected JPanel createDatasourcePanel() {
    JPanel panel = new JPanel(new GridBagLayout());

    final BrowseAction browseAction = new BrowseAction();
    queryNameList.addListSelectionListener(browseAction);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;/* w w w  . j  a  va  2  s  . c  om*/
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(0, 0, 0, 13);
    panel.add(new JLabel(Messages.getString("KettleDataSourceDialog.FileName")), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    panel.add(fileTextField, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(new JButton(browseAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(0, 0, 5, 0);
    panel.add(new JLabel(Messages.getString("KettleDataSourceDialog.Steps")), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.gridwidth = 3;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(new JScrollPane(stepsList), gbc);

    return panel;

}

From source file:org.freeplane.view.swing.features.time.mindmapmode.NodeList.java

public void startup() {
    if (dialog != null) {
        dialog.toFront();//from w w w .  j  a v  a  2s.c o m
        return;
    }
    NodeList.COLUMN_MODIFIED = TextUtils.getText(PLUGINS_TIME_LIST_XML_MODIFIED);
    NodeList.COLUMN_CREATED = TextUtils.getText(PLUGINS_TIME_LIST_XML_CREATED);
    NodeList.COLUMN_ICONS = TextUtils.getText(PLUGINS_TIME_LIST_XML_ICONS);
    NodeList.COLUMN_TEXT = TextUtils.getText(PLUGINS_TIME_LIST_XML_TEXT);
    NodeList.COLUMN_DATE = TextUtils.getText(PLUGINS_TIME_LIST_XML_DATE);
    NodeList.COLUMN_NOTES = TextUtils.getText(PLUGINS_TIME_LIST_XML_NOTES);
    dialog = new JDialog(Controller.getCurrentController().getViewController().getFrame(), modal /* modal */);
    String windowTitle;
    if (showAllNodes) {
        windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE_ALL_NODES;
    } else {
        windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE;
    }
    dialog.setTitle(TextUtils.getText(windowTitle));
    dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    final WindowAdapter windowListener = new WindowAdapter() {

        @Override
        public void windowGainedFocus(WindowEvent e) {
            mFilterTextSearchField.getEditor().selectAll();
        }

        @Override
        public void windowClosing(final WindowEvent event) {
            disposeDialog();
        }
    };
    dialog.addWindowListener(windowListener);
    dialog.addWindowFocusListener(windowListener);
    UITools.addEscapeActionToDialog(dialog, new AbstractAction() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            disposeDialog();
        }
    });
    final Container contentPane = dialog.getContentPane();
    final GridBagLayout gbl = new GridBagLayout();
    contentPane.setLayout(gbl);
    final GridBagConstraints layoutConstraints = new GridBagConstraints();
    layoutConstraints.gridx = 0;
    layoutConstraints.gridy = 0;
    layoutConstraints.gridwidth = 1;
    layoutConstraints.gridheight = 1;
    layoutConstraints.weightx = 0.0;
    layoutConstraints.weighty = 0.0;
    layoutConstraints.anchor = GridBagConstraints.WEST;
    layoutConstraints.fill = GridBagConstraints.HORIZONTAL;
    contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_FIND)), layoutConstraints);
    layoutConstraints.gridwidth = 1;
    layoutConstraints.gridx++;
    contentPane.add(Box.createHorizontalStrut(40), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(new JLabel(TextUtils.getText("filter_match_case")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(matchCase, layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(Box.createHorizontalStrut(40), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(useRegexInFind, layoutConstraints);
    layoutConstraints.gridx = 0;
    layoutConstraints.weightx = 1.0;
    layoutConstraints.gridwidth = GridBagConstraints.REMAINDER;
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(mFilterTextSearchField), layoutConstraints);
    layoutConstraints.gridy++;
    layoutConstraints.weightx = 0.0;
    layoutConstraints.gridwidth = 1;
    contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_REPLACE)), layoutConstraints);
    layoutConstraints.gridx = 5;
    contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(useRegexInReplace, layoutConstraints);
    layoutConstraints.gridx = 0;
    layoutConstraints.weightx = 1.0;
    layoutConstraints.gridwidth = GridBagConstraints.REMAINDER;
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(mFilterTextReplaceField), layoutConstraints);
    dateRenderer = new DateRenderer();
    nodeRenderer = new NodeRenderer();
    notesRenderer = new NotesRenderer();
    iconsRenderer = new IconsRenderer();
    timeTable = new FlatNodeTable();
    timeTable.addKeyListener(new FlatNodeTableKeyListener());
    timeTable.addMouseListener(new FlatNodeTableMouseAdapter());
    timeTable.getTableHeader().setReorderingAllowed(false);
    timeTableModel = updateModel();
    mFlatNodeTableFilterModel = new FlatNodeTableFilterModel(timeTableModel, NodeList.NODE_TEXT_COLUMN);
    sorter = new TableSorter(mFlatNodeTableFilterModel);
    timeTable.setModel(sorter);
    sorter.setTableHeader(timeTable.getTableHeader());
    sorter.setColumnComparator(Date.class, TableSorter.COMPARABLE_COMPARATOR);
    sorter.setColumnComparator(NodeModel.class, TableSorter.LEXICAL_COMPARATOR);
    sorter.setColumnComparator(IconsHolder.class, TableSorter.COMPARABLE_COMPARATOR);
    sorter.setSortingStatus(NodeList.DATE_COLUMN, TableSorter.ASCENDING);
    final JScrollPane pane = new JScrollPane(timeTable);
    UITools.setScrollbarIncrement(pane);
    layoutConstraints.gridy++;
    GridBagConstraints tableConstraints = (GridBagConstraints) layoutConstraints.clone();
    tableConstraints.weightx = 1;
    tableConstraints.weighty = 10;
    tableConstraints.fill = GridBagConstraints.BOTH;
    contentPane.add(pane, tableConstraints);
    mTreeLabel = new JLabel();
    layoutConstraints.gridy++;
    GridBagConstraints treeConstraints = (GridBagConstraints) layoutConstraints.clone();
    treeConstraints.fill = GridBagConstraints.BOTH;
    @SuppressWarnings("serial")
    JScrollPane scrollPane = new JScrollPane(mTreeLabel) {
        @Override
        public boolean isValidateRoot() {
            return false;
        }
    };
    contentPane.add(scrollPane, treeConstraints);
    final AbstractAction exportAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Export")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            exportSelectedRowsAndClose();
        }
    };
    final JButton exportButton = new JButton(exportAction);
    final AbstractAction replaceAllAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Replace_All")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            replace(new ReplaceAllInfo());
        }
    };
    final JButton replaceAllButton = new JButton(replaceAllAction);
    final AbstractAction replaceSelectedAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Replace_Selected")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            replace(new ReplaceSelectedInfo());
        }
    };
    final JButton replaceSelectedButton = new JButton(replaceSelectedAction);
    final AbstractAction gotoAction = new AbstractAction(TextUtils.getText("plugins/TimeManagement.xml_Goto")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            selectSelectedRows();
        }
    };
    final JButton gotoButton = new JButton(gotoAction);
    final AbstractAction disposeAction = new AbstractAction(
            TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_CLOSE)) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            disposeDialog();
        }
    };
    final JButton cancelButton = new JButton(disposeAction);
    /* Initial State */
    gotoAction.setEnabled(false);
    exportAction.setEnabled(false);
    replaceSelectedAction.setEnabled(false);
    final Box bar = Box.createHorizontalBox();
    bar.add(Box.createHorizontalGlue());
    bar.add(cancelButton);
    bar.add(exportButton);
    bar.add(replaceAllButton);
    bar.add(replaceSelectedButton);
    bar.add(gotoButton);
    bar.add(Box.createHorizontalGlue());
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(bar), layoutConstraints);
    final JMenuBar menuBar = new JMenuBar();
    final JMenu menu = new JMenu(TextUtils.getText("plugins/TimeManagement.xml_menu_actions"));
    final AbstractAction[] actionList = new AbstractAction[] { gotoAction, replaceSelectedAction,
            replaceAllAction, exportAction, disposeAction };
    for (int i = 0; i < actionList.length; i++) {
        final AbstractAction action = actionList[i];
        final JMenuItem item = menu.add(action);
        item.setIcon(new BlindIcon(UIBuilder.ICON_SIZE));
    }
    menuBar.add(menu);
    dialog.setJMenuBar(menuBar);
    final ListSelectionModel rowSM = timeTable.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(final ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            final ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            final boolean enable = !(lsm.isSelectionEmpty());
            replaceSelectedAction.setEnabled(enable);
            gotoAction.setEnabled(enable);
            exportAction.setEnabled(enable);
        }
    });
    rowSM.addListSelectionListener(new ListSelectionListener() {
        String getNodeText(final NodeModel node) {
            return TextController.getController().getShortText(node)
                    + ((node.isRoot()) ? "" : (" <- " + getNodeText(node.getParentNode())));
        }

        public void valueChanged(final ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            final ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            if (lsm.isSelectionEmpty()) {
                mTreeLabel.setText("");
                return;
            }
            final int selectedRow = lsm.getLeadSelectionIndex();
            final NodeModel mindMapNode = getMindMapNode(selectedRow);
            mTreeLabel.setText(getNodeText(mindMapNode));
        }
    });
    final String marshalled = ResourceController.getResourceController()
            .getProperty(NodeList.WINDOW_PREFERENCE_STORAGE_PROPERTY);
    final WindowConfigurationStorage result = TimeWindowConfigurationStorage.decorateDialog(marshalled, dialog);
    final WindowConfigurationStorage storage = result;
    if (storage != null) {
        timeTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        int column = 0;
        for (final TimeWindowColumnSetting setting : ((TimeWindowConfigurationStorage) storage)
                .getListTimeWindowColumnSettingList()) {
            timeTable.getColumnModel().getColumn(column).setPreferredWidth(setting.getColumnWidth());
            sorter.setSortingStatus(column, setting.getColumnSorting());
            column++;
        }
    }
    mFlatNodeTableFilterModel.setFilter((String) mFilterTextSearchField.getSelectedItem(),
            matchCase.isSelected(), useRegexInFind.isSelected());
    dialog.setVisible(true);
}

From source file:be.agiv.security.demo.Main.java

private void ipStsIssueToken() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    JPanel contentPanel = new JPanel(gridBagLayout);

    JLabel urlLabel = new JLabel("URL:");
    gridBagConstraints.gridx = 0;//from w w w .  j  a  v  a  2s.  c o  m
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.WEST;
    gridBagConstraints.ipadx = 5;
    gridBagLayout.setConstraints(urlLabel, gridBagConstraints);
    contentPanel.add(urlLabel);

    JTextField urlTextField = new JTextField(
            "https://auth.beta.agiv.be/ipsts/Services/DaliSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(urlTextField, gridBagConstraints);
    contentPanel.add(urlTextField);

    JLabel realmLabel = new JLabel("Realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(realmLabel, gridBagConstraints);
    contentPanel.add(realmLabel);

    JTextField realmTextField = new JTextField(AGIVSecurity.BETA_REALM, 30);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(realmTextField, gridBagConstraints);
    contentPanel.add(realmTextField);

    CredentialPanel credentialPanel = new CredentialPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(credentialPanel, gridBagConstraints);
    contentPanel.add(credentialPanel);

    int result = JOptionPane.showConfirmDialog(this, contentPanel, "IP-STS Issue Token",
            JOptionPane.OK_CANCEL_OPTION);
    if (result == JOptionPane.CANCEL_OPTION) {
        return;
    }

    String location = urlTextField.getText();
    String username = credentialPanel.getUsername();
    String password = credentialPanel.getPassword();
    File pkcs12File = credentialPanel.getPKCS12File();
    String realm = realmTextField.getText();

    IPSTSClient ipStsClient = new IPSTSClient(location, realm);
    try {
        if (null != username) {
            this.ipStsSecurityToken = ipStsClient.getSecurityToken(username, password);
        } else {
            KeyStore keyStore = KeyStore.getInstance("PKCS12");
            keyStore.load(new FileInputStream(pkcs12File), password.toCharArray());
            String alias = keyStore.aliases().nextElement();
            X509Certificate certificate = (X509Certificate) keyStore.getCertificate(alias);
            PrivateKey privateKey = (PrivateKey) keyStore.getKey(alias, password.toCharArray());
            this.ipStsSecurityToken = ipStsClient.getSecuritytoken(certificate, privateKey);
        }
        this.ipStsViewMenuItem.setEnabled(true);
        this.rStsIssueMenuItem.setEnabled(true);
        ipStsViewToken();
    } catch (Exception e) {
        showException(e);
    }
}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanProjectAnalysisSetting.java

/**
 * This method initializes jPanel1   /*from   ww w . j  a va 2s.  com*/
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelProjectSplit() {
    if (jPanelProjectSplit == null) {
        jPanelProjectSplit = new JPanel();
        jPanelProjectSplit.setLayout(new GridBagLayout());
        jPanelProjectSplit.setBorder(BorderFactory.createTitledBorder(null, "Project Split",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));

        GridBagConstraints gridBagConstraintsLabelFileCountLimit = new GridBagConstraints();
        gridBagConstraintsLabelFileCountLimit.gridx = 0;
        gridBagConstraintsLabelFileCountLimit.ipadx = 0;
        gridBagConstraintsLabelFileCountLimit.insets = new Insets(0, 5, 0, 0);
        gridBagConstraintsLabelFileCountLimit.gridwidth = 2;
        gridBagConstraintsLabelFileCountLimit.gridy = 1;
        jLabelPojectSplitFileCountLimit = new JLabel();
        jLabelPojectSplitFileCountLimit.setText("Max Number of Files for a project :");
        GridBagConstraints gridBagConstraintsTextFieldSplit = new GridBagConstraints();
        gridBagConstraintsTextFieldSplit.fill = GridBagConstraints.VERTICAL;
        gridBagConstraintsTextFieldSplit.gridy = 1;
        gridBagConstraintsTextFieldSplit.weightx = 0.0;
        gridBagConstraintsTextFieldSplit.insets = new Insets(0, 5, 0, 0);
        gridBagConstraintsTextFieldSplit.anchor = GridBagConstraints.WEST;
        gridBagConstraintsTextFieldSplit.gridx = 2;
        GridBagConstraints gridBagConstraintsLabelSplitRange = new GridBagConstraints();
        gridBagConstraintsLabelSplitRange.gridx = 3;
        gridBagConstraintsLabelSplitRange.insets = new Insets(0, 5, 0, 0);
        gridBagConstraintsLabelSplitRange.weightx = 1.0;
        gridBagConstraintsLabelSplitRange.anchor = GridBagConstraints.WEST;
        gridBagConstraintsLabelSplitRange.gridy = 1;
        jLabel = new JLabel();
        jLabel.setText("( " + Property.getInstance().getMinNumOfFilesUpperLimit() + " ~ "
                + Property.getInstance().getMaxNumOfFilesUpperLimit() + " )");
        jPanelProjectSplit.add(jLabelPojectSplitFileCountLimit, gridBagConstraintsLabelFileCountLimit);

        jPanelProjectSplit.add(getJTextFieldProjectSplitFileCountLimit(), gridBagConstraintsTextFieldSplit);
        jPanelProjectSplit.add(jLabel, gridBagConstraintsLabelSplitRange);
    }
    return jPanelProjectSplit;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.pdf.PdfExportDialog.java

/**
 * Creates a panel for the security settings.
 *
 * @return The panel.//w  ww.ja v a  2s .c  om
 */
private JPanel createAdvancedPanel() {
    final JLabel lblEncoding = new JLabel(getResources().getString("pdfsavedialog.encoding")); //$NON-NLS-1$
    final JPanel encodingPanel = new JPanel();
    encodingPanel.setBorder(
            BorderFactory.createTitledBorder(getResources().getString("pdfsavedialog.export-options")));
    encodingPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets = new Insets(1, 1, 1, 1);
    encodingPanel.add(lblEncoding, gbc);

    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.ipadx = 80;
    gbc.insets = new Insets(1, 1, 1, 1);
    encodingPanel.add(cbEncoding, gbc);

    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.ipadx = 80;
    gbc.insets = new Insets(1, 1, 1, 1);
    encodingPanel.add(cxEmbedded, gbc);

    final JPanel securityPanel = new JPanel();
    securityPanel.setLayout(new GridBagLayout());
    securityPanel
            .setBorder(BorderFactory.createTitledBorder(getResources().getString("pdfsavedialog.security")));

    final JLabel lblUserPass = new JLabel(getResources().getString("pdfsavedialog.userpassword")); //$NON-NLS-1$
    final JLabel lblUserPassConfirm = new JLabel(getResources().getString("pdfsavedialog.userpasswordconfirm")); //$NON-NLS-1$
    final JLabel lblOwnerPass = new JLabel(getResources().getString("pdfsavedialog.ownerpassword")); //$NON-NLS-1$
    final JLabel lblOwnerPassConfirm = new JLabel(
            getResources().getString("pdfsavedialog.ownerpasswordconfirm")); //$NON-NLS-1$
    final JLabel lbAllowPrinting = new JLabel(getResources().getString("pdfsavedialog.allowPrinting")); //$NON-NLS-1$

    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridx = 0;
    gbc.gridwidth = 4;
    gbc.gridy = 1;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(createSecurityConfigPanel(), gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(lblUserPass, gbc);

    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.ipadx = 120;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(txUserPassword, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(lblOwnerPass, gbc);

    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.ipadx = 80;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(txOwnerPassword, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(lblUserPassConfirm, gbc);

    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridx = 3;
    gbc.gridy = 2;
    gbc.ipadx = 80;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(txConfUserPassword, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 2;
    gbc.gridy = 3;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(lblOwnerPassConfirm, gbc);

    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridx = 3;
    gbc.gridy = 3;
    gbc.ipadx = 80;
    gbc.insets = new Insets(5, 5, 5, 5);
    securityPanel.add(txConfOwnerPassword, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridwidth = 2;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.WEST;
    securityPanel.add(cxAllowCopy, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridwidth = 2;
    gbc.gridy = 5;
    gbc.anchor = GridBagConstraints.WEST;
    securityPanel.add(cxAllowScreenReaders, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridwidth = 2;
    gbc.gridy = 6;
    gbc.anchor = GridBagConstraints.WEST;
    securityPanel.add(cxAllowFillIn, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridwidth = 2;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.WEST;
    securityPanel.add(cxAllowAssembly, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridwidth = 2;
    gbc.gridy = 5;
    gbc.anchor = GridBagConstraints.WEST;
    securityPanel.add(cxAllowModifyContents, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridwidth = 2;
    gbc.gridy = 6;
    gbc.anchor = GridBagConstraints.WEST;
    securityPanel.add(cxAllowModifyAnnotations, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridwidth = 1;
    gbc.gridy = 7;
    gbc.anchor = GridBagConstraints.WEST;
    securityPanel.add(lbAllowPrinting, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridwidth = 3;
    gbc.gridy = 7;
    gbc.anchor = GridBagConstraints.WEST;
    securityPanel.add(cbAllowPrinting, gbc);

    final JPanel advancedCarrier2 = new JPanel();
    advancedCarrier2.setLayout(new GridBagLayout());

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = 1;
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(1, 1, 5, 1);
    advancedCarrier2.add(encodingPanel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = 1;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(1, 1, 1, 1);
    advancedCarrier2.add(securityPanel, gbc);

    final JPanel advancedPaneCarrier = new JPanel();
    advancedPaneCarrier.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    advancedPaneCarrier.setLayout(new BorderLayout());
    advancedPaneCarrier.add(advancedCarrier2, BorderLayout.NORTH);
    return advancedPaneCarrier;
}

From source file:zsk.JFCMainClient.java

/**
 * @param pane// w  w w  .j a  v a2s.co  m
 * @param downloadDir 
 */
public void addComponentsToPane(final Container pane, String downloadDir) {
    this.panel = new JPanel();

    this.panel.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.anchor = GridBagConstraints.WEST;

    JFCMainClient.dlm = new DefaultListModel<String>();
    this.urllist = new JList<String>(JFCMainClient.dlm);
    // TODO maybe we add a button to remove added URLs from list?
    //      this.userlist.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
    this.urllist.setFocusable(false);
    this.textarea = new JTextArea(2, 2);
    this.textarea.setEditable(true);
    this.textarea.setFocusable(false);

    JScrollPane leftscrollpane = new JScrollPane(this.urllist);
    JScrollPane rightscrollpane = new JScrollPane(this.textarea);
    this.middlepane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftscrollpane, rightscrollpane);
    this.middlepane.setOneTouchExpandable(true);
    this.middlepane.setDividerLocation(150);

    Dimension minimumSize = new Dimension(25, 25);
    leftscrollpane.setMinimumSize(minimumSize);
    rightscrollpane.setMinimumSize(minimumSize);

    this.directorybutton = new JButton("", createImageIcon("images/open.png", ""));
    gbc.gridx = 0;
    gbc.gridy = 0;
    this.directorybutton.addActionListener(this);
    this.panel.add(this.directorybutton, gbc);

    this.saveconfigcheckbox = new JCheckBox(isgerman() ? "Konfig. speichern" : "Save config");
    this.saveconfigcheckbox.setSelected(false);

    this.saveconfigcheckbox.addItemListener(this);
    this.panel.add(this.saveconfigcheckbox);

    this.saveconfigcheckbox.setEnabled(false);

    // TODO check if initial download directory exists
    // assume that at least the users homedir exists
    //if (System.getProperty("user.home").equals("/home/knoedel")) shomedir = "/home/knoedel/YouTube Downloads/";
    debugoutput("user.home: ".concat(System.getProperty("user.home")).concat("  shomedir: ".concat(shomedir)));
    debugoutput("os.name: ".concat(System.getProperty("os.name")));
    debugoutput("os.arch: ".concat(System.getProperty("os.arch")));
    debugoutput("os.version: ".concat(System.getProperty("os.version")));
    debugoutput("Locale.getDefault: ".concat(Locale.getDefault().toString()));

    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    this.directorytextfield = new JTextField(downloadDir, 20 + (JFCMainClient.getbDEBUG() ? 48 : 0));
    //this.directorytextfield = new JTextField( shomedir, 20+(JFCMainClient.getbDEBUG()?48:0) );
    this.directorytextfield.setEnabled(false);
    this.directorytextfield.setFocusable(true);
    this.directorytextfield.addActionListener(this);
    this.panel.add(this.directorytextfield, gbc);

    JLabel dirhint = new JLabel(isgerman() ? "Speichern im Ordner:" : "Download to folder:");

    gbc.gridx = 0;
    gbc.gridy = 1;
    this.panel.add(dirhint, gbc);

    debugoutput(String.format("heigth x width: %d x %d", Toolkit.getDefaultToolkit().getScreenSize().width,
            Toolkit.getDefaultToolkit().getScreenSize().height));

    this.middlepane.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width / 3,
            Toolkit.getDefaultToolkit().getScreenSize().height / 4 + (JFCMainClient.getbDEBUG() ? 200 : 0)));

    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 2;
    gbc.weightx = 2;
    gbc.gridwidth = 2;
    this.panel.add(this.middlepane, gbc);

    // radio buttons for resolution to download
    JFCMainClient.frame.hdbutton = new JRadioButton("HD");
    JFCMainClient.frame.hdbutton.setActionCommand("hd");
    JFCMainClient.frame.hdbutton.addActionListener(this);
    JFCMainClient.frame.hdbutton.setToolTipText("1080p/720p");
    JFCMainClient.frame.stdbutton = new JRadioButton("Std");
    JFCMainClient.frame.stdbutton.setActionCommand("std");
    JFCMainClient.frame.stdbutton.addActionListener(this);
    JFCMainClient.frame.stdbutton.setToolTipText("480p/360p");
    JFCMainClient.frame.ldbutton = new JRadioButton("LD");
    JFCMainClient.frame.ldbutton.setActionCommand("ld");
    JFCMainClient.frame.ldbutton.addActionListener(this);
    JFCMainClient.frame.ldbutton.setToolTipText("< 360p");

    JFCMainClient.frame.stdbutton.setSelected(true);
    JFCMainClient.frame.hdbutton.setEnabled(true);
    JFCMainClient.frame.ldbutton.setEnabled(true);

    ButtonGroup bgroup = new ButtonGroup();
    bgroup.add(JFCMainClient.frame.hdbutton);
    bgroup.add(JFCMainClient.frame.stdbutton);
    bgroup.add(JFCMainClient.frame.ldbutton);

    JPanel radiopanel = new JPanel(new GridLayout(1, 0));
    radiopanel.add(JFCMainClient.frame.hdbutton);
    radiopanel.add(JFCMainClient.frame.stdbutton);
    radiopanel.add(JFCMainClient.frame.ldbutton);

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridheight = 0;
    gbc.gridwidth = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.NORTHEAST;
    this.panel.add(radiopanel, gbc);

    // radio buttons for video format to download
    JFCMainClient.frame.mpgbutton = new JRadioButton("MPEG");
    JFCMainClient.frame.mpgbutton.setActionCommand("mpg");
    JFCMainClient.frame.mpgbutton.addActionListener(this);
    JFCMainClient.frame.mpgbutton.setToolTipText("Codec: H.264 MPEG-4");
    JFCMainClient.frame.webmbutton = new JRadioButton("WEBM");
    JFCMainClient.frame.webmbutton.setActionCommand("webm");
    JFCMainClient.frame.webmbutton.addActionListener(this);
    JFCMainClient.frame.webmbutton.setToolTipText("Codec: Google/On2's VP8 or Googles WebM");
    JFCMainClient.frame.flvbutton = new JRadioButton("FLV");
    JFCMainClient.frame.flvbutton.setActionCommand("flv");
    JFCMainClient.frame.flvbutton.addActionListener(this);
    JFCMainClient.frame.flvbutton.setToolTipText("Codec: Flash Video (FLV1)");

    bgroup = new ButtonGroup();
    bgroup.add(JFCMainClient.frame.mpgbutton);
    bgroup.add(JFCMainClient.frame.webmbutton);
    bgroup.add(JFCMainClient.frame.flvbutton);

    JFCMainClient.frame.mpgbutton.setSelected(true);
    JFCMainClient.frame.mpgbutton.setEnabled(true);
    JFCMainClient.frame.webmbutton.setEnabled(true);
    JFCMainClient.frame.flvbutton.setEnabled(true);

    JFCMainClient.frame.save3dcheckbox = new JCheckBox("3D");
    JFCMainClient.frame.save3dcheckbox.setToolTipText("stereoscopic video");
    JFCMainClient.frame.save3dcheckbox.setSelected(false);
    JFCMainClient.frame.save3dcheckbox.setEnabled(true);
    JFCMainClient.frame.save3dcheckbox.addItemListener(this);

    radiopanel = new JPanel(new GridLayout(1, 0));
    radiopanel.add(JFCMainClient.frame.save3dcheckbox);
    radiopanel.add(JFCMainClient.frame.mpgbutton);
    radiopanel.add(JFCMainClient.frame.webmbutton);
    radiopanel.add(JFCMainClient.frame.flvbutton);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridheight = 0;
    gbc.gridwidth = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.NORTHEAST;
    this.panel.add(radiopanel, gbc);

    JLabel hint = new JLabel(
            isgerman() ? "eingeben, reinkopieren, reinziehen von YT-Webadressen oder YT-Videobilder:"
                    : "Type, paste or drag'n drop a YouTube video address:");

    gbc.fill = 0;
    gbc.gridwidth = 0;
    gbc.gridheight = 1;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.WEST;
    this.panel.add(hint, gbc);

    this.textinputfield = new JTextField(20);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 2;
    this.textinputfield.setEnabled(true);
    this.textinputfield.setFocusable(true);
    this.textinputfield.addActionListener(this);
    this.textinputfield.getDocument().addDocumentListener(this);
    this.panel.add(this.textinputfield, gbc);

    this.quitbutton = new JButton("", createImageIcon("images/exit.png", ""));
    gbc.gridx = 2;
    gbc.gridy = 5;
    gbc.gridwidth = 0;
    this.quitbutton.addActionListener(this);
    this.quitbutton.setActionCommand("quit");
    this.quitbutton.setToolTipText("Exit.");

    this.panel.add(this.quitbutton, gbc);

    pane.add(this.panel);
    addWindowListener(this);

    JFCMainClient.frame.setDropTarget(new DropTarget(this, this));
    JFCMainClient.frame.textarea.setTransferHandler(null); // otherwise the dropped text would be inserted

}