Example usage for javax.swing SwingConstants CENTER

List of usage examples for javax.swing SwingConstants CENTER

Introduction

In this page you can find the example usage for javax.swing SwingConstants CENTER.

Prototype

int CENTER

To view the source code for javax.swing SwingConstants CENTER.

Click Source Link

Document

The central position in an area.

Usage

From source file:com.floreantpos.ui.forms.CustomerForm.java

private void createCustomerForm() {
    setOpaque(true);//  ww w.j  a  v a2  s .c o  m
    setLayout(new MigLayout("", "[][][grow][][grow]", "[][][][][][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    picturePanel = new JPanel(new MigLayout());

    lblPicture = new JLabel(""); //$NON-NLS-1$
    lblPicture.setIconTextGap(0);
    lblPicture.setHorizontalAlignment(SwingConstants.CENTER);
    picturePanel.setBorder(new TitledBorder(null, Messages.getString("CustomerForm.10"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    picturePanel.add(lblPicture, "wrap,center"); //$NON-NLS-1$

    btnSelectImage = new PosSmallButton();
    btnSelectImage.setText(Messages.getString("CustomerForm.44")); //$NON-NLS-1$
    picturePanel.add(btnSelectImage, "split 2"); //$NON-NLS-1$

    btnClearImage = new PosSmallButton();
    btnClearImage.setText(Messages.getString("CustomerForm.45")); //$NON-NLS-1$
    picturePanel.add(btnClearImage);

    add(picturePanel, "cell 0 0 0 8"); //$NON-NLS-1$

    JLabel lblSalutation = new JLabel(Messages.getString("CustomerForm.0")); //$NON-NLS-1$
    add(lblSalutation, "cell 1 0,right"); //$NON-NLS-1$

    cbSalutation = new JComboBox();
    cbSalutation.addItem(Messages.getString("CustomerForm.2")); //$NON-NLS-1$
    cbSalutation.addItem(Messages.getString("CustomerForm.4")); //$NON-NLS-1$
    cbSalutation.addItem(Messages.getString("CustomerForm.5")); //$NON-NLS-1$
    cbSalutation.addItem(Messages.getString("CustomerForm.6")); //$NON-NLS-1$

    cbSalutation.setPreferredSize(new Dimension(100, 0));

    add(cbSalutation, "cell 2 0,grow"); //$NON-NLS-1$

    JLabel lblFirstName = new JLabel(Messages.getString("CustomerForm.3")); //$NON-NLS-1$

    add(lblFirstName, "cell 1 1,right "); //$NON-NLS-1$

    tfFirstName = new FixedLengthTextField(30);
    add(tfFirstName, "cell 2 1,grow"); //$NON-NLS-1$
    //tfFirstName.setFocusTraversalPolicy(policy)

    JLabel lblLastName = new JLabel(Messages.getString("CustomerForm.11")); //$NON-NLS-1$
    add(lblLastName, "cell 1 2,right"); //$NON-NLS-1$

    tfLastName = new FixedLengthTextField();
    add(tfLastName, "cell 2 2,grow"); //$NON-NLS-1$

    lblDob = new JLabel("DoB (MM-DD-YYYY)"); //$NON-NLS-1$
    add(lblDob, "cell 1 3,right"); //$NON-NLS-1$

    tfDoB = new FixedLengthTextField();
    add(tfDoB, "cell 2 3,grow"); //$NON-NLS-1$

    JLabel lblAddress = new JLabel(Messages.getString("CustomerForm.18")); //$NON-NLS-1$
    add(lblAddress, "cell 1 4,right"); //$NON-NLS-1$

    tfAddress = new JTextField();
    add(tfAddress, "cell 2 4,grow"); //$NON-NLS-1$

    JLabel lblZip = new JLabel(Messages.getString("CustomerForm.21")); //$NON-NLS-1$
    add(lblZip, "cell 1 5,right"); //$NON-NLS-1$

    tfZip = new FixedLengthTextField();
    add(tfZip, "cell 2 5,grow"); //$NON-NLS-1$

    lblSocialSecurityNumber = new JLabel(Messages.getString("CustomerForm.22")); //$NON-NLS-1$
    add(lblSocialSecurityNumber, "cell 3 0,right"); //$NON-NLS-1$

    tfSocialSecurityNumber = new FixedLengthTextField();
    add(tfSocialSecurityNumber, "cell 4 0,grow"); //$NON-NLS-1$

    JLabel lblCitytown = new JLabel(Messages.getString("CustomerForm.24")); //$NON-NLS-1$
    add(lblCitytown, "cell 3 1,right"); //$NON-NLS-1$
    //
    tfCity = new FixedLengthTextField();
    add(tfCity, "cell 4 1,grow"); //$NON-NLS-1$

    JLabel lblCountry = new JLabel(Messages.getString("CustomerForm.27")); //$NON-NLS-1$
    add(lblCountry, "cell 3 2,right"); //$NON-NLS-1$

    tfCountry = new FixedLengthTextField();
    tfCountry.setText(Messages.getString("CustomerForm.29")); //$NON-NLS-1$
    add(tfCountry, "cell 4 2,grow"); //$NON-NLS-1$

    lblMobile = new JLabel(Messages.getString("CustomerForm.32")); //$NON-NLS-1$
    add(lblMobile, "cell 3 3 ,right"); //$NON-NLS-1$

    tfMobile = new IntegerTextField(10);
    add(tfMobile, "cell 4 3,grow"); //$NON-NLS-1$

    lblHomePhone = new JLabel("Home Phone");//$NON-NLS-1$
    add(lblHomePhone, "cell 3 4,right"); //$NON-NLS-1$

    tfHomePhone = new FixedLengthTextField();
    add(tfHomePhone, "cell 4 4,grow"); //$NON-NLS-1$

    lblWorkPhone = new JLabel(Messages.getString("CustomerForm.39")); //$NON-NLS-1$
    add(lblWorkPhone, "cell 3 5,right"); //$NON-NLS-1$

    tfWorkPhone = new FixedLengthTextField();
    add(tfWorkPhone, "cell 4 5,grow"); //$NON-NLS-1$

    JLabel lblEmail = new JLabel(Messages.getString("CustomerForm.15")); //$NON-NLS-1$
    add(lblEmail, "cell 3 6 ,right"); //$NON-NLS-1$

    tfEmail = new FixedLengthTextField();
    add(tfEmail, "cell 4 6,grow"); //$NON-NLS-1$

    lblLoyaltyPoint = new JLabel(Messages.getString("CustomerForm.34")); //$NON-NLS-1$
    add(lblLoyaltyPoint, "cell 3 7,right"); //$NON-NLS-1$

    tfLoyaltyPoint = new IntegerTextField();
    add(tfLoyaltyPoint, "cell 4 7,grow"); //$NON-NLS-1$

    cbVip = new JCheckBox(Messages.getString("CustomerForm.41")); //$NON-NLS-1$
    cbVip.setFocusable(false);
    add(cbVip, "cell 4 8,wrap"); //$NON-NLS-1$

    JLabel lblLoyaltyNo = new JLabel(Messages.getString("CustomerForm.31")); //$NON-NLS-1$
    add(lblLoyaltyNo, "cell 1 6,right"); //$NON-NLS-1$

    tfLoyaltyNo = new FixedLengthTextField();
    tfLoyaltyNo.setLength(8);
    add(tfLoyaltyNo, "cell 2 6,grow"); //$NON-NLS-1$

    JLabel lblCreditLimit = new JLabel(Messages.getString("CustomerForm.37")); //$NON-NLS-1$
    add(lblCreditLimit, "cell 1 7,right"); //$NON-NLS-1$

    tfCreditLimit = new DoubleTextField();
    tfCreditLimit.setText("500.00"); //$NON-NLS-1$
    add(tfCreditLimit, "cell 2 7,grow"); //$NON-NLS-1$

    qwertyKeyPad = new QwertyKeyPad();

    if (isKeypad) {
        add(qwertyKeyPad, "cell 0 10 5 5,grow"); //$NON-NLS-1$
    }

    btnSelectImage.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                BufferedImage tmpImage;
                tmpImage = PosGuiUtil.selectImageFile();
                if (tmpImage != null) {
                    image = tmpImage;
                }
                if (image == null) {
                    return;
                }
                ImageIcon imageIcon = new ImageIcon(image);
                lblPicture.setIcon(imageIcon);
            } catch (Exception e1) {
                PosLog.error(getClass(), e1);
            }
        }
    });
    btnClearImage.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setDefaultCustomerPicture();
        }
    });

    setDefaultCustomerPicture();
    enableCustomerFields(false);
    callOrderController();
}

From source file:davmail.ui.SettingsFrame.java

protected void addSettingComponent(JPanel panel, String label, JComponent component, String toolTipText) {
    JLabel fieldLabel = new JLabel(label);
    fieldLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    fieldLabel.setVerticalAlignment(SwingConstants.CENTER);
    panel.add(fieldLabel);/*from   w  w w.  j a  v  a  2s .  c o m*/
    component.setMaximumSize(component.getPreferredSize());
    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS));
    innerPanel.add(component);
    panel.add(innerPanel);
    if (toolTipText != null) {
        fieldLabel.setToolTipText(toolTipText);
        component.setToolTipText(toolTipText);
    }
}

From source file:io.github.jeremgamer.editor.ManagerFrame.java

public ManagerFrame(String projectName, final JFrame parent) {
    dialog = this;

    ArrayList<BufferedImage> icons = new ArrayList<BufferedImage>();
    try {/*  ww  w.j  a v  a 2  s .c  o  m*/
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon16.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon32.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon64.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon128.png")));
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    this.setIconImages((List<? extends Image>) icons);

    this.setTitle("Grer les projets");
    this.setSize(300, 200);
    this.setModal(true);
    this.setLocationRelativeTo(parent);
    this.setResizable(false);

    final JScrollPane scroll = new JScrollPane(content);
    scroll.getVerticalScrollBar().setUnitIncrement(Editor.SCROLL_SPEED);
    content.setBorder(BorderFactory.createTitledBorder(""));
    content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
    for (File project : new File("projects").listFiles()) {
        if (project.getName().equals(Editor.getProjectName())) {
            content.add(new ProjectPanel(project.getName(), true, parent, this));
        } else {
            content.add(new ProjectPanel(project.getName(), false, parent, this));
        }
    }
    try {
        final JButton add = new JButton("Crer un nouveau projet",
                new ImageIcon(ImageIO.read(ImageGetter.class.getResource("add.png"))));
        newProjectPanel.add(newProjectName);
        newProjectPanel.add(validate);

        this.setLayout(new BorderLayout());
        scroll.setBorder(null);
        this.add(scroll, BorderLayout.CENTER);
        this.add(add, BorderLayout.SOUTH);

        add.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                validate.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        dispose();
                        parent.dispose();
                        new Thread(new Runnable() {
                            public void run() {
                                window.getContentPane()
                                        .add(new JLabel("",
                                                new ImageIcon(ImageGetter.class.getResource("splash.gif")),
                                                SwingConstants.CENTER));
                                window.setBackground(new Color(0, 0, 0, 0));
                                window.setSize(300, 300);
                                window.setLocationRelativeTo(null);
                                window.setVisible(true);
                            }
                        }).start();

                        new Thread(new Runnable() {
                            public void run() {
                                new Editor(newProjectName.getText());
                                window.setVisible(false);
                            }
                        }).start();
                    }
                });
                CaretListener caretUpdate = new CaretListener() {
                    public void caretUpdate(javax.swing.event.CaretEvent e) {
                        JTextField text = (JTextField) e.getSource();
                        for (File dir : new File("projects").listFiles()) {
                            if (dir.isDirectory() && text.getText().equals(dir.getName())) {
                                validate.setEnabled(false);
                                validate.setText("Existe dj");
                                break;
                            } else {
                                validate.setEnabled(true);
                                validate.setText("Crer!");
                            }
                        }
                    }
                };
                JButton cancel = null;
                try {
                    cancel = new JButton(
                            new ImageIcon(ImageIO.read(ImageGetter.class.getResource("cancel.png"))));
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
                newProjectName.addCaretListener(caretUpdate);
                remove(add);
                addPanel.setLayout(new BorderLayout());
                addPanel.add(newProjectPanel, BorderLayout.CENTER);
                addPanel.add(cancel, BorderLayout.EAST);
                add(addPanel, BorderLayout.SOUTH);
                revalidate();
                repaint();
                cancel.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent event) {
                        newProjectName.setText("");
                        remove(addPanel);
                        add(add, BorderLayout.SOUTH);
                        revalidate();
                        repaint();
                    }

                });
                newProjectName.requestFocusInWindow();
                newProjectName.requestFocus();
            }

        });
        this.setVisible(true);
    } catch (IOException e) {
        e.printStackTrace();
    }

}

From source file:com.funambol.json.admin.NoteSyncSourceAdminPanel.java

/**
 * Create the panel/*  w ww .  ja v  a 2 s . c  om*/
 * @throws Exception if error occures during creation of the panel
 */
private void init() {
    // set layout
    this.setLayout(null);
    // set properties of label, position and border
    //  referred to the title of the panel
    titledBorder = new TitledBorder("");
    panelName.setFont(titlePanelFont);
    panelName.setText(getPanelName());
    panelName.setBounds(new Rectangle(14, 5, 316, 28));
    panelName.setAlignmentX(SwingConstants.CENTER);
    panelName.setBorder(titledBorder);

    final int LABEL_X = 14;
    final int VALUE_X = 170;
    int y = 60;
    final int GAP_X = 150;
    final int GAP_Y = 30;

    sourceUriLabel.setText("Source URI: ");
    sourceUriLabel.setFont(defaultFont);
    sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    sourceUriValue.setFont(defaultFont);
    sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    y += GAP_Y; // New line

    nameLabel.setText("Name: ");
    nameLabel.setFont(defaultFont);
    nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    nameValue.setFont(defaultFont);
    nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));
    y += GAP_Y; // New line

    typeLabel.setText("Client Type: ");
    typeLabel.setFont(defaultFont);
    typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    typeCombo.setFont(defaultFont);
    typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    y += GAP_Y; // New line
    int x = LABEL_X;

    confirmButton.setFont(defaultFont);
    confirmButton.setText("Add");
    confirmButton.setBounds(VALUE_X, y, 70, 25);

    // What happens when the confirmButton is pressed?
    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                if (getState() == STATE_INSERT) {
                    NoteSyncSourceAdminPanel.this.actionPerformed(new ActionEvent(NoteSyncSourceAdminPanel.this,
                            ACTION_EVENT_INSERT, event.getActionCommand()));
                } else {
                    NoteSyncSourceAdminPanel.this.actionPerformed(new ActionEvent(NoteSyncSourceAdminPanel.this,
                            ACTION_EVENT_UPDATE, event.getActionCommand()));
                }
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage(), e));
            }
        }
    });

    // Adds all components to the panel
    this.add(panelName, null);
    this.add(nameLabel, null);
    this.add(sourceUriLabel, null);
    this.add(sourceUriValue, null);
    this.add(nameValue, null);
    this.add(typeLabel, null);
    this.add(typeCombo, null);
    this.add(confirmButton, null);

}

From source file:com.floreantpos.ui.views.LoginView.java

private JPanel createCenterPanel() {

    lblTerminalId = new JLabel(Messages.getString("LoginView.0")); //$NON-NLS-1$
    lblTerminalId.setForeground(Color.BLACK);
    lblTerminalId.setFont(new Font("Dialog", Font.BOLD, PosUIManager.getFontSize(18))); //$NON-NLS-1$
    lblTerminalId.setHorizontalAlignment(SwingConstants.CENTER);

    mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(lblTerminalId, BorderLayout.NORTH);

    btnSwitchBoard = new PosButton(POSConstants.ORDERS);
    btnKitchenDisplay = new PosButton(POSConstants.KITCHEN_DISPLAY_BUTTON_TEXT);
    btnDriverView = new PosButton("DRIVER VIEW");
    btnConfigureDatabase = new PosButton(POSConstants.CONFIGURE_DATABASE);
    btnBackOffice = new PosButton(POSConstants.BACK_OFFICE_BUTTON_TEXT);

    btnShutdown = new PosButton(POSConstants.SHUTDOWN);
    btnClockOUt = new PosButton(new ClockInOutAction(false, true));

    btnBackOffice.setVisible(false);//from  w  w  w  .  j av  a 2 s .  c  o  m
    btnSwitchBoard.setVisible(false);
    btnKitchenDisplay.setVisible(false);
    btnClockOUt.setVisible(false);

    JPanel panel3 = new JPanel(new GridLayout(1, 0, 5, 5));
    JPanel panel4 = new JPanel(new MigLayout("fill, ins 0, hidemode 3", "sg, fill", ""));

    centerPanel.add(panel1, "cell 0 0, wrap, w " + width + "px, h " + height + "px, grow");

    panel3.add(btnSwitchBoard);
    panel3.add(btnBackOffice);
    panel3.add(btnKitchenDisplay);
    OrderServiceExtension orderService = (OrderServiceExtension) ExtensionManager
            .getPlugin(OrderServiceExtension.class);
    if (orderService != null) {
        panel3.add(btnDriverView);
        btnDriverView.setVisible(false);
    }
    centerPanel.add(panel3, "cell 0 2, wrap, w " + width + "px, h " + height + "px, grow");

    panel4.add(btnClockOUt, "grow"); //$NON-NLS-1$
    panel4.add(btnConfigureDatabase, "grow"); //$NON-NLS-1$
    panel4.add(btnShutdown, "grow"); //$NON-NLS-1$

    centerPanel.add(panel4, "cell 0 3, wrap, w " + width + "px, h " + height + "px, grow");

    if (TerminalConfig.isFullscreenMode()) {
        if (btnConfigureDatabase != null) {
            btnConfigureDatabase.setVisible(false);
        }
        if (btnShutdown != null) {
            btnShutdown.setVisible(false);
        }
    } else {
        if (!TerminalConfig.isShowDbConfigureButton()) {
            btnConfigureDatabase.setVisible(false);
        }
    }

    initActionHandlers();

    mainPanel.add(centerPanel, BorderLayout.CENTER);
    return mainPanel;
}

From source file:com.litt.core.security.license.gui.ValidatePanel.java

/**
 * Create the panel.//  ww  w . ja v  a  2  s.  c o  m
 */
public ValidatePanel() {
    GridBagLayout gbl_validatePanel = new GridBagLayout();
    gbl_validatePanel.columnWidths = new int[] { 0, 0, 0 };
    gbl_validatePanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    gbl_validatePanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_validatePanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    this.setLayout(gbl_validatePanel);

    JLabel label_10 = new JLabel("");
    GridBagConstraints gbc_label_10 = new GridBagConstraints();
    gbc_label_10.insets = new Insets(0, 0, 5, 5);
    gbc_label_10.anchor = GridBagConstraints.EAST;
    gbc_label_10.gridx = 0;
    gbc_label_10.gridy = 0;
    this.add(label_10, gbc_label_10);

    field_pubKeyFilePath = new JTextField();
    field_pubKeyFilePath.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            JFileChooser fileChooser = new JFileChooser();
            //fileChooser.setVisible(true);
            LicenseFileFilter fileFilter = new LicenseFileFilter(new String[] { "key" });
            fileChooser.setFileFilter(fileFilter);
            fileChooser.addChoosableFileFilter(fileFilter);
            fileChooser.showOpenDialog(e.getComponent());
            File pubKeyFile = fileChooser.getSelectedFile();

            field_pubKeyFilePath.setText(pubKeyFile.getAbsolutePath());

        }
    });
    GridBagConstraints gbc_field_pubKeyFilePath = new GridBagConstraints();
    gbc_field_pubKeyFilePath.insets = new Insets(0, 0, 5, 0);
    gbc_field_pubKeyFilePath.fill = GridBagConstraints.HORIZONTAL;
    gbc_field_pubKeyFilePath.gridx = 1;
    gbc_field_pubKeyFilePath.gridy = 0;
    this.add(field_pubKeyFilePath, gbc_field_pubKeyFilePath);
    field_pubKeyFilePath.setColumns(10);

    JLabel label_19 = new JLabel("?");
    GridBagConstraints gbc_label_19 = new GridBagConstraints();
    gbc_label_19.anchor = GridBagConstraints.EAST;
    gbc_label_19.insets = new Insets(0, 0, 5, 5);
    gbc_label_19.gridx = 0;
    gbc_label_19.gridy = 1;
    this.add(label_19, gbc_label_19);

    field_licenseFilePath = new JTextField();
    field_licenseFilePath.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            JFileChooser fileChooser = new JFileChooser();
            //fileChooser.setVisible(true);
            LicenseFileFilter fileFilter = new LicenseFileFilter(new String[] { "xml" });
            fileChooser.setFileFilter(fileFilter);
            fileChooser.addChoosableFileFilter(fileFilter);
            fileChooser.showOpenDialog(e.getComponent());
            File licenseFile = fileChooser.getSelectedFile();

            field_licenseFilePath.setText(licenseFile.getAbsolutePath());
        }
    });
    GridBagConstraints gbc_textField1 = new GridBagConstraints();
    gbc_textField1.insets = new Insets(0, 0, 5, 0);
    gbc_textField1.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField1.gridx = 1;
    gbc_textField1.gridy = 1;
    this.add(field_licenseFilePath, gbc_textField1);
    field_licenseFilePath.setColumns(10);

    JLabel lblid = new JLabel("?ID");
    lblid.setHorizontalAlignment(SwingConstants.CENTER);
    GridBagConstraints gbc_lblid = new GridBagConstraints();
    gbc_lblid.insets = new Insets(0, 0, 5, 5);
    gbc_lblid.gridx = 0;
    gbc_lblid.gridy = 2;
    this.add(lblid, gbc_lblid);

    label_licenseId = new JLabel("");
    label_licenseId.setHorizontalAlignment(SwingConstants.CENTER);
    GridBagConstraints gbc_label_licenseId = new GridBagConstraints();
    gbc_label_licenseId.insets = new Insets(0, 0, 5, 0);
    gbc_label_licenseId.gridx = 1;
    gbc_label_licenseId.gridy = 2;
    this.add(label_licenseId, gbc_label_licenseId);

    JLabel label_12 = new JLabel("?");
    GridBagConstraints gbc_label_12 = new GridBagConstraints();
    gbc_label_12.insets = new Insets(0, 0, 5, 5);
    gbc_label_12.gridx = 0;
    gbc_label_12.gridy = 3;
    this.add(label_12, gbc_label_12);

    label_licenseType = new JLabel("");
    GridBagConstraints gbc_label_licenseType = new GridBagConstraints();
    gbc_label_licenseType.insets = new Insets(0, 0, 5, 0);
    gbc_label_licenseType.gridx = 1;
    gbc_label_licenseType.gridy = 3;
    this.add(label_licenseType, gbc_label_licenseType);

    JLabel label_13 = new JLabel("???");
    GridBagConstraints gbc_label_13 = new GridBagConstraints();
    gbc_label_13.insets = new Insets(0, 0, 5, 5);
    gbc_label_13.gridx = 0;
    gbc_label_13.gridy = 4;
    this.add(label_13, gbc_label_13);

    label_productName = new JLabel("");
    GridBagConstraints gbc_label_productName = new GridBagConstraints();
    gbc_label_productName.insets = new Insets(0, 0, 5, 0);
    gbc_label_productName.gridx = 1;
    gbc_label_productName.gridy = 4;
    this.add(label_productName, gbc_label_productName);

    JLabel label_14 = new JLabel("???");
    GridBagConstraints gbc_label_14 = new GridBagConstraints();
    gbc_label_14.insets = new Insets(0, 0, 5, 5);
    gbc_label_14.gridx = 0;
    gbc_label_14.gridy = 5;
    this.add(label_14, gbc_label_14);

    label_companyName = new JLabel("");
    GridBagConstraints gbc_label_companyName = new GridBagConstraints();
    gbc_label_companyName.insets = new Insets(0, 0, 5, 0);
    gbc_label_companyName.gridx = 1;
    gbc_label_companyName.gridy = 5;
    this.add(label_companyName, gbc_label_companyName);

    JLabel label_15 = new JLabel("??");
    GridBagConstraints gbc_label_15 = new GridBagConstraints();
    gbc_label_15.insets = new Insets(0, 0, 5, 5);
    gbc_label_15.gridx = 0;
    gbc_label_15.gridy = 6;
    this.add(label_15, gbc_label_15);

    label_customerName = new JLabel("");
    GridBagConstraints gbc_label_customerName = new GridBagConstraints();
    gbc_label_customerName.insets = new Insets(0, 0, 5, 0);
    gbc_label_customerName.gridx = 1;
    gbc_label_customerName.gridy = 6;
    this.add(label_customerName, gbc_label_customerName);

    JLabel label_16 = new JLabel("");
    GridBagConstraints gbc_label_16 = new GridBagConstraints();
    gbc_label_16.insets = new Insets(0, 0, 5, 5);
    gbc_label_16.gridx = 0;
    gbc_label_16.gridy = 7;
    this.add(label_16, gbc_label_16);

    label_version = new JLabel("");
    GridBagConstraints gbc_label_version = new GridBagConstraints();
    gbc_label_version.insets = new Insets(0, 0, 5, 0);
    gbc_label_version.gridx = 1;
    gbc_label_version.gridy = 7;
    this.add(label_version, gbc_label_version);

    JLabel label_11 = new JLabel("");
    GridBagConstraints gbc_label_11 = new GridBagConstraints();
    gbc_label_11.insets = new Insets(0, 0, 5, 5);
    gbc_label_11.gridx = 0;
    gbc_label_11.gridy = 8;
    this.add(label_11, gbc_label_11);

    label_createDate = new JLabel("");
    GridBagConstraints gbc_label_createDate = new GridBagConstraints();
    gbc_label_createDate.insets = new Insets(0, 0, 5, 0);
    gbc_label_createDate.gridx = 1;
    gbc_label_createDate.gridy = 8;
    this.add(label_createDate, gbc_label_createDate);

    JLabel label_17 = new JLabel("");
    GridBagConstraints gbc_label_17 = new GridBagConstraints();
    gbc_label_17.insets = new Insets(0, 0, 5, 5);
    gbc_label_17.gridx = 0;
    gbc_label_17.gridy = 9;
    this.add(label_17, gbc_label_17);

    label_expiredDate = new JLabel("");
    GridBagConstraints gbc_label_expiredDate = new GridBagConstraints();
    gbc_label_expiredDate.insets = new Insets(0, 0, 5, 0);
    gbc_label_expiredDate.gridx = 1;
    gbc_label_expiredDate.gridy = 9;
    this.add(label_expiredDate, gbc_label_expiredDate);

    JButton button_2 = new JButton("");
    button_2.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {

            String licenseFilePath = Utility.trimNull(field_licenseFilePath.getText());
            String pubKeyFilePath = Utility.trimNull(field_pubKeyFilePath.getText());
            if (Utility.isEmpty(licenseFilePath)) {
                JOptionPane.showMessageDialog(e.getComponent(), "?!");
                return;
            }
            if (Utility.isEmpty(pubKeyFilePath)) {
                JOptionPane.showMessageDialog(e.getComponent(), "!");
                return;
            }
            File licenseFile = new File(licenseFilePath);
            try {
                XMLConfiguration config = new XMLConfiguration(licenseFile);
                config.setAutoSave(true);

                label_licenseId.setText(config.getString(("licenseId")));
                label_licenseType.setText(config.getString("licenseType"));
                label_productName.setText(config.getString("productName"));
                label_companyName.setText(config.getString("companyName"));
                label_customerName.setText(config.getString("customerName"));
                label_version.setText(config.getString("version"));
                label_createDate.setText(config.getString("createDate"));
                label_expiredDate.setText(config.getString("expiredDate"));

            } catch (Exception e1) {
                // TODO Auto-generated catch block
                JOptionPane.showMessageDialog(e.getComponent(), e1.getMessage());
            }

            try {
                LicenseManager.validateLicense(licenseFile.getAbsolutePath(), pubKeyFilePath);
                JOptionPane.showMessageDialog(e.getComponent(), "?");
            } catch (LicenseException e1) {
                // TODO Auto-generated catch block
                JOptionPane.showMessageDialog(e.getComponent(), e1.getMessage());
            }

        }
    });
    GridBagConstraints gbc_button_2 = new GridBagConstraints();
    gbc_button_2.gridx = 1;
    gbc_button_2.gridy = 10;
    this.add(button_2, gbc_button_2);
}

From source file:com.funambol.foundation.admin.FileSystemSyncSourceConfigPanel.java

/**
 * Create the panel//from  w ww. j a va  2s .  com
 * @throws Exception if error occures during creation of the panel
 */

private void init() {
    // set layout
    this.setLayout(null);

    // set properties of label, position and border
    //  referred to the title of the panel
    titledBorder1 = new TitledBorder("");

    panelName.setFont(titlePanelFont);
    panelName.setText("Edit File System SyncSource");
    panelName.setBounds(new Rectangle(14, 5, 316, 28));
    panelName.setAlignmentX(SwingConstants.CENTER);
    panelName.setBorder(titledBorder1);

    int y = 60;
    int dy = 30;

    sourceUriLabel.setText("Source URI: ");
    sourceUriLabel.setFont(defaultFont);
    sourceUriLabel.setBounds(new Rectangle(14, y, 150, 18));
    sourceUriValue.setFont(defaultFont);
    sourceUriValue.setBounds(new Rectangle(170, y, 350, 18));

    y += dy;

    nameLabel.setText("Name: ");
    nameLabel.setFont(defaultFont);
    nameLabel.setBounds(new Rectangle(14, y, 150, 18));
    nameValue.setFont(defaultFont);
    nameValue.setBounds(new Rectangle(170, y, 350, 18));

    y += dy;

    directoryLabel.setText("Source Directory: ");
    directoryLabel.setFont(defaultFont);
    directoryLabel.setBounds(new Rectangle(14, y, 150, 18));
    directoryValue.setFont(defaultFont);
    directoryValue.setBounds(new Rectangle(170, y, 350, 18));

    y += dy;

    infoTypesLabel.setText("Supported types: ");
    infoTypesLabel.setFont(defaultFont);
    infoTypesLabel.setBounds(new Rectangle(14, y, 150, 18));
    infoTypesValue.setFont(defaultFont);
    infoTypesValue.setBounds(new Rectangle(170, y, 350, 18));

    y += dy;

    infoVersionsLabel.setText("Supported versions: ");
    infoVersionsLabel.setFont(defaultFont);
    infoVersionsLabel.setBounds(new Rectangle(14, y, 150, 18));
    infoVersionsValue.setFont(defaultFont);
    infoVersionsValue.setBounds(new Rectangle(170, y, 350, 18));

    y += dy;

    multiUserLabel.setText("MultiUser: ");
    multiUserLabel.setFont(defaultFont);
    multiUserLabel.setBounds(new Rectangle(14, y, 150, 18));
    multiUserValue.setSelected(false);
    multiUserValue.setBounds(167, y, 50, 25);

    y += dy;
    y += dy;

    confirmButton.setFont(defaultFont);
    confirmButton.setText("Add");
    confirmButton.setBounds(170, y, 70, 25);

    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                if (getState() == STATE_INSERT) {
                    FileSystemSyncSourceConfigPanel.this
                            .actionPerformed(new ActionEvent(FileSystemSyncSourceConfigPanel.this,
                                    ACTION_EVENT_INSERT, event.getActionCommand()));
                } else {
                    FileSystemSyncSourceConfigPanel.this
                            .actionPerformed(new ActionEvent(FileSystemSyncSourceConfigPanel.this,
                                    ACTION_EVENT_UPDATE, event.getActionCommand()));
                }
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage()));
            }
        }
    });

    // add all components to the panel
    this.add(panelName, null);
    this.add(sourceUriLabel, null);
    this.add(sourceUriValue, null);
    this.add(nameLabel, null);
    this.add(nameValue, null);
    this.add(directoryLabel, null);
    this.add(directoryValue, null);
    this.add(infoTypesLabel, null);
    this.add(infoTypesValue, null);
    this.add(infoVersionsLabel, null);
    this.add(infoVersionsValue, null);
    this.add(multiUserLabel, null);
    this.add(multiUserValue, null);
    this.add(confirmButton, null);

}

From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV1_5.ADAP3DecompositionV1_5SetupDialog.java

@Override
protected void addDialogComponents() {
    super.addDialogComponents();

    comboPeakList = new JComboBox<>();
    comboClustersModel = new DefaultComboBoxModel<>();
    comboClusters = new JComboBox<>(comboClustersModel);
    retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z");
    retTimeIntensityPlot = new EICPlot();

    PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists();

    // -----------------------------
    // Panel with preview parameters
    // -----------------------------

    preview = new JCheckBox("Show preview");
    preview.addActionListener(this);
    preview.setHorizontalAlignment(SwingConstants.CENTER);

    if (peakLists == null || peakLists.length == 0)
        preview.setEnabled(false);/*from  ww  w .  j  a  va2  s  .c om*/
    else
        preview.setEnabled(true);

    final JPanel previewPanel = new JPanel(new BorderLayout());
    previewPanel.add(new JSeparator(), BorderLayout.NORTH);
    previewPanel.add(preview, BorderLayout.CENTER);
    previewPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);

    comboPeakList.setFont(COMBO_FONT);
    for (final PeakList peakList : peakLists)
        if (peakList.getNumberOfRawDataFiles() == 1)
            comboPeakList.addItem(peakList);
    comboPeakList.addActionListener(this);

    comboClusters.setFont(COMBO_FONT);
    comboClusters.addActionListener(this);

    pnlLabelsFields = GUIUtils.makeTablePanel(2, 2, new JComponent[] { new JLabel("Peak list"), comboPeakList,
            new JLabel("Cluster list"), comboClusters });

    pnlVisible = new JPanel(new BorderLayout());
    pnlVisible.add(previewPanel, BorderLayout.NORTH);

    // --------------------------------------------------------------------
    // ----- Tabbed panel with plots --------------------------------------
    // --------------------------------------------------------------------

    //        pnlTabs = new JTabbedPane();
    pnlTabs = new JPanel();
    pnlTabs.setLayout(new BoxLayout(pnlTabs, BoxLayout.Y_AXIS));

    retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS);

    JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout());
    pnlPlotRetTimeClusters.setBackground(Color.white);
    pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10);

    pnlTabs.add(pnlPlotRetTimeClusters);

    retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS);

    JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout());
    pnlPlotShapeClusters.setBackground(Color.white);
    pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10);

    pnlTabs.add(pnlPlotShapeClusters);

    super.mainPanel.add(pnlVisible, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0,
            GridBagConstraints.HORIZONTAL);
}

From source file:com.borqs.sync.server.contact.admin.ContactSyncSourceAdminPanel.java

/**
 * Create the panel// w  ww . j a v a  2  s.co m
 * @throws Exception if error occures during creation of the panel
 */
private void init() {
    // set layout
    this.setLayout(null);
    // set properties of label, position and border
    //  referred to the title of the panel
    titledBorder = new TitledBorder("");
    panelName.setFont(titlePanelFont);
    panelName.setText(getPanelName());
    panelName.setBounds(new Rectangle(14, 5, 316, 28));
    panelName.setAlignmentX(SwingConstants.CENTER);
    panelName.setBorder(titledBorder);

    final int LABEL_X = 14;
    final int VALUE_X = 170;
    int y = 60;
    final int GAP_X = 150;
    final int GAP_Y = 30;

    sourceUriLabel.setText("Source URI: ");
    sourceUriLabel.setFont(defaultFont);
    sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    sourceUriValue.setFont(defaultFont);
    sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    y += GAP_Y; // New line

    nameLabel.setText("Name: ");
    nameLabel.setFont(defaultFont);
    nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    nameValue.setFont(defaultFont);
    nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18));
    y += GAP_Y; // New line

    typeLabel.setText("Client Type: ");
    typeLabel.setFont(defaultFont);
    typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    typeCombo.setFont(defaultFont);
    typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18));
    y += GAP_Y; // New line

    datastoretypeLabel.setText("Datastore Type: ");
    datastoretypeLabel.setFont(defaultFont);
    datastoretypeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18));
    datastoretypeCombo.setFont(defaultFont);
    datastoretypeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18));

    y += GAP_Y; // New line
    int x = LABEL_X;

    confirmButton.setFont(defaultFont);
    confirmButton.setText("Add");
    confirmButton.setBounds(VALUE_X, y, 70, 25);

    // What happens when the confirmButton is pressed?
    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                if (getState() == STATE_INSERT) {
                    ContactSyncSourceAdminPanel.this.actionPerformed(new ActionEvent(
                            ContactSyncSourceAdminPanel.this, ACTION_EVENT_INSERT, event.getActionCommand()));
                } else {
                    ContactSyncSourceAdminPanel.this.actionPerformed(new ActionEvent(
                            ContactSyncSourceAdminPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand()));
                }
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage(), e));
            }
        }
    });

    // Adds all components to the panel
    this.add(panelName, null);
    this.add(nameLabel, null);
    this.add(sourceUriLabel, null);
    this.add(sourceUriValue, null);
    this.add(nameValue, null);
    this.add(typeLabel, null);
    this.add(typeCombo, null);
    this.add(confirmButton, null);
    this.add(datastoretypeLabel, null);
    this.add(datastoretypeCombo, null);

}

From source file:edu.ku.brc.specify.config.init.TaxonLoadSetupPanel.java

/**
 * Creates a dialog for entering database name and selecting the appropriate driver.
 *//*from   ww  w. ja  v a  2 s . com*/
public TaxonLoadSetupPanel(final String helpContext, final JButton nextBtn, final JButton prevBtn) {
    super("PRELOADTXN", helpContext, nextBtn, prevBtn);

    String header = getResourceString("PRELOADTXN_INFO");

    CellConstraints cc = new CellConstraints();

    String rowDef = "p,10px," + createDuplicateJGoodiesDef("p", "2px", 8) + ",p:g";
    PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,p:g", rowDef), this);
    int row = 1;

    stdSep = builder.add(createLabel(header, SwingConstants.CENTER), cc.xywh(1, row, 3, 1));
    row += 2;

    fileCBX = createComboBox();
    srcTF = createTextField("");
    coverageTF = createTextField("");
    descTA = createTextArea();
    otherBrw = new ValBrowseBtnPanel(otherTF = new ValTextField(), false, true);
    otherBrw.setUseNativeFileDlg(true);

    descTA.setEditable(false);
    descTA.setColumns(30);
    descTA.setRows(5);
    descTA.setWrapStyleWord(true);
    descTA.setLineWrap(true);

    ViewFactory.changeTextFieldUIForDisplay(srcTF, false);
    ViewFactory.changeTextFieldUIForDisplay(coverageTF, false);

    builder.add(preloadChk = createI18NCheckBox("TFD_LOAD_TAXON"), cc.xy(1, row));
    row += 2;

    builder.addSeparator(UIRegistry.getResourceString("TFD_SEP_STD"), cc.xyw(1, row, 3));
    row += 2;

    builder.add(fileLbl = createI18NFormLabel("TFD_FILE_LBL"), cc.xy(1, row));
    builder.add(fileCBX, cc.xy(3, row));
    row += 2;

    builder.add(srcLbl = createI18NFormLabel("TFD_SRC_LBL"), cc.xy(1, row));
    builder.add(srcTF, cc.xy(3, row));
    row += 2;

    builder.add(coverageLbl = createI18NFormLabel("TFD_CVRG_LBL"), cc.xy(1, row));
    builder.add(coverageTF, cc.xy(3, row));
    row += 2;

    builder.add(descLbl = createI18NFormLabel("TFD_DESC_LBL"), cc.xy(1, row));
    builder.add(createScrollPane(descTA), cc.xy(3, row));
    row += 2;

    //othSep = builder.addSeparator(UIRegistry.getResourceString("TFD_SEP_OTH"), cc.xyw(1, row, 3));
    row += 2;

    //builder.add(otherLbl = createI18NFormLabel("TFD_OTHER_LBL"), cc.xy(1, row));
    //builder.add(otherBrw,        cc.xy(3, row));
    row += 2;

    updateBtnUI();

    otherTF.getDocument().addDocumentListener(new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            updateBtnUI();
        }
    });

    preloadChk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean checked = preloadChk.isSelected();
            if (checked) {
                if (fileCBX.getModel().getSize() > 0 && fileCBX.getSelectedIndex() == -1) {
                    fileCBX.setSelectedIndex(0);
                }
                enableUI(otherTF.getText().isEmpty(), true, true);

            } else {
                enableUI(false, true, false);
            }
        }
    });

    otherTF.addFocusListener(new FocusAdapter() {

        /* (non-Javadoc)
         * @see java.awt.event.FocusAdapter#focusLost(java.awt.event.FocusEvent)
         */
        @Override
        public void focusLost(FocusEvent e) {
            updateBtnUI();
        }

    });

    otherBrw.setNativeDlgFilter(new FilenameFilter() {

        /* (non-Javadoc)
         * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
         */
        @Override
        public boolean accept(File dir, String name) {
            return name.toLowerCase().endsWith(XLS);
        }
    });
}