Example usage for javax.swing SwingConstants RIGHT

List of usage examples for javax.swing SwingConstants RIGHT

Introduction

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

Prototype

int RIGHT

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

Click Source Link

Document

Box-orientation constant used to specify the right side of a box.

Usage

From source file:savant.view.swing.Savant.java

/**
 * Customize the UI. This includes doing any platform-specific
 * customization./*  w  ww.j ava  2 s .co  m*/
 */
private void customizeUI() {
    if (MiscUtils.MAC) {
        try {
            macOSXApplication = Application.getApplication();
            macOSXApplication.setAboutHandler(new AboutHandler() {
                @Override
                public void handleAbout(AppEvent.AboutEvent evt) {
                    final Splash dlg = new Splash(instance, true);
                    dlg.addMouseListener(new MouseAdapter() {
                        @Override
                        public void mouseClicked(MouseEvent e) {
                            dlg.setVisible(false);
                        }
                    });
                    dlg.setVisible(true);
                }
            });
            macOSXApplication.setPreferencesHandler(new PreferencesHandler() {
                @Override
                public void handlePreferences(AppEvent.PreferencesEvent evt) {
                    preferencesItemActionPerformed(null);
                }
            });
            macOSXApplication.setQuitHandler(new QuitHandler() {
                @Override
                public void handleQuitRequestWith(AppEvent.QuitEvent evt, QuitResponse resp) {
                    exitItemActionPerformed(null);
                    // If the user agreed to quit, System.exit would have been
                    // called.  Since we got here, the user has said "No" to quitting.
                    resp.cancelQuit();
                }
            });
            fileMenu.remove(jSeparator4);
            fileMenu.remove(exitItem);
            editMenu.remove(jSeparator7);
            editMenu.remove(preferencesItem);
        } catch (Throwable x) {
            LOG.error("Unable to load Apple eAWT classes.", x);
            DialogUtils.displayError("Warning",
                    "Savant requires Java for Mac OS X 10.6 Update 3 (or later).\nPlease check Software Update for the latest version.");
        }
    }
    LookAndFeelFactory.UIDefaultsCustomizer uiDefaultsCustomizer = new LookAndFeelFactory.UIDefaultsCustomizer() {
        @Override
        public void customize(UIDefaults defaults) {
            ThemePainter painter = (ThemePainter) UIDefaultsLookup.get("Theme.painter");
            defaults.put("OptionPaneUI", "com.jidesoft.plaf.basic.BasicJideOptionPaneUI");

            defaults.put("OptionPane.showBanner", Boolean.TRUE); // show banner or not. default is true
            //defaults.put("OptionPane.bannerIcon", JideIconsFactory.getImageIcon(JideIconsFactory.JIDE50));
            defaults.put("OptionPane.bannerFontSize", 13);
            defaults.put("OptionPane.bannerFontStyle", Font.BOLD);
            defaults.put("OptionPane.bannerMaxCharsPerLine", 60);
            defaults.put("OptionPane.bannerForeground", Color.BLACK); //painter != null ? painter.getOptionPaneBannerForeground() : null);  // you should adjust this if banner background is not the default gradient paint
            defaults.put("OptionPane.bannerBorder", null); // use default border

            // set both bannerBackgroundDk and // set both bannerBackgroundLt to null if you don't want gradient
            //defaults.put("OptionPane.bannerBackgroundDk", painter != null ? painter.getOptionPaneBannerDk() : null);
            //defaults.put("OptionPane.bannerBackgroundLt", painter != null ? painter.getOptionPaneBannerLt() : null);
            //defaults.put("OptionPane.bannerBackgroundDirection", Boolean.TRUE); // default is true

            // optionally, you can set a Paint object for BannerPanel. If so, the three UIDefaults related to banner background above will be ignored.
            defaults.put("OptionPane.bannerBackgroundPaint", null);

            defaults.put("OptionPane.buttonAreaBorder", BorderFactory.createEmptyBorder(6, 6, 6, 6));
            defaults.put("OptionPane.buttonOrientation", SwingConstants.RIGHT);

        }
    };
    uiDefaultsCustomizer.customize(UIManager.getDefaults());
}

From source file:se.llbit.chunky.renderer.ui.RenderControls.java

/**
 * Add a tab and ensure that the icon is to the left of the text in the
 * tab label./*from w w  w .  j  av  a 2s .  co  m*/
 *
 * @param title
 * @param icon
 * @param component
 */
private void addTab(String title, Texture icon, Component component) {
    int index = tabbedPane.getTabCount();

    tabbedPane.add(title, component);

    if (icon != null) {
        JLabel lbl = new JLabel(title, icon.imageIcon(), SwingConstants.RIGHT);
        lbl.setIconTextGap(5);
        tabbedPane.setTabComponentAt(index, lbl);
    }
}

From source file:uk.ac.ucl.cs.cmic.giftcloud.uploadapp.ConfigurationDialog.java

ConfigurationDialog(final Component owner, final UploaderGuiController controller,
        final GiftCloudPropertiesFromApplication giftCloudProperties, final ProjectListModel projectListModel,
        final ResourceBundle resourceBundle, final GiftCloudDialogs giftCloudDialogs,
        final GiftCloudReporter reporter) {
    this.controller = controller;
    this.giftCloudProperties = giftCloudProperties;
    this.projectListModel = projectListModel;
    this.resourceBundle = resourceBundle;
    this.giftCloudDialogs = giftCloudDialogs;
    this.reporter = reporter;
    temporaryDropDownListModel = new TemporaryProjectListModel(projectListModel,
            giftCloudProperties.getLastProject());
    componentToCenterDialogOver = owner;

    dialog = new JDialog();
    dialog.setModal(true);//  w w  w  .j  a  v  a2 s . c o m
    dialog.setResizable(false);

    // Call custom dialog close code when the close button is clicked
    dialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    dialog.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent ev) {
            closeDialog();
        }
    });

    dialog.setLocationRelativeTo(componentToCenterDialogOver); // without this, appears at TLHC rather then center of parent or screen
    dialog.setTitle(resourceBundle.getString("configurationDialogTitle"));

    final GridBagConstraints sectionTitleConstraints = new GridBagConstraints();
    sectionTitleConstraints.gridx = 0;
    sectionTitleConstraints.gridy = 1;
    sectionTitleConstraints.gridwidth = 2;
    sectionTitleConstraints.weightx = 1;
    sectionTitleConstraints.weighty = 1;
    sectionTitleConstraints.anchor = GridBagConstraints.CENTER;
    sectionTitleConstraints.fill = GridBagConstraints.HORIZONTAL;

    final GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.gridx = 0;
    labelConstraints.gridy = 0;
    labelConstraints.gridwidth = 1;
    labelConstraints.weightx = 1;
    labelConstraints.weighty = 1;
    labelConstraints.anchor = GridBagConstraints.LINE_START;
    labelConstraints.fill = GridBagConstraints.NONE;

    final GridBagConstraints inputConstraints = new GridBagConstraints();
    inputConstraints.gridx = 1;
    inputConstraints.gridy = 0;
    inputConstraints.gridwidth = 1;
    inputConstraints.weightx = 1;
    inputConstraints.weighty = 1;
    inputConstraints.anchor = GridBagConstraints.LINE_END;
    inputConstraints.fill = GridBagConstraints.HORIZONTAL;

    GridBagConstraints separatorConstraint = new GridBagConstraints();
    separatorConstraint.weightx = 1.0;
    separatorConstraint.fill = GridBagConstraints.HORIZONTAL;
    separatorConstraint.gridwidth = GridBagConstraints.REMAINDER;

    // The panel containing the GIFT-Cloud server configuration
    final JPanel giftCloudServerPanel = new JPanel();
    {
        GridBagLayout projectUploadlayout = new GridBagLayout();
        giftCloudServerPanel.setLayout(projectUploadlayout);
        JLabel serverPanelLabel = new JLabel(resourceBundle.getString("configPanelServerConfig"),
                SwingConstants.CENTER);
        giftCloudServerPanel.add(serverPanelLabel, sectionTitleConstraints);

        // GIFT-Cloud server URL
        {
            labelConstraints.gridwidth = 1;
            labelConstraints.gridy = 2;
            final JLabel giftCloudServerLabel = new JLabel(resourceBundle.getString("giftCloudServerText"),
                    SwingConstants.RIGHT);
            giftCloudServerLabel.setToolTipText(resourceBundle.getString("giftCloudServerTextToolTipText"));
            giftCloudServerPanel.add(giftCloudServerLabel, labelConstraints);

            giftCloudServerText = new AutoFocusTextField(giftCloudProperties.getGiftCloudUrl().orElse(""),
                    textFieldLengthForGiftCloudServerUrl);
            inputConstraints.gridy = 2;
            giftCloudServerPanel.add(giftCloudServerText, inputConstraints);
        }

        // GIFT-Cloud username
        {
            labelConstraints.gridy = 3;
            final JLabel giftCloudUserNameLabel = new JLabel(resourceBundle.getString("giftCloudUsername"),
                    SwingConstants.RIGHT);
            giftCloudUserNameLabel.setToolTipText(resourceBundle.getString("giftCloudUsernameToolTipText"));
            giftCloudServerPanel.add(giftCloudUserNameLabel, labelConstraints);

            final Optional<String> serverUrl = giftCloudProperties.getLastUserName();
            final String initialServerText = serverUrl.isPresent() ? serverUrl.get() : "";
            giftCloudUsernameText = new AutoFocusTextField(initialServerText);
            inputConstraints.gridy = 3;
            giftCloudServerPanel.add(giftCloudUsernameText, inputConstraints);
        }

        // GIFT-Cloud password
        {
            labelConstraints.gridy = 4;
            final JLabel giftCloudPasswordLabel = new JLabel(resourceBundle.getString("giftCloudPassword"),
                    SwingConstants.RIGHT);
            giftCloudPasswordLabel.setToolTipText(resourceBundle.getString("giftCloudPasswordToolTipText"));
            giftCloudServerPanel.add(giftCloudPasswordLabel, labelConstraints);

            final Optional<char[]> password = giftCloudProperties.getLastPassword();
            final char[] initialPassword = password.isPresent() ? password.get() : "".toCharArray();
            giftCloudPasswordText = new JPasswordField(new String(initialPassword), 16); // Shouldn't create a String but there's no other way to initialize the password field
            inputConstraints.gridy = 4;
            giftCloudServerPanel.add(giftCloudPasswordText, inputConstraints);
        }

        // Project list
        {
            labelConstraints.gridy = 5;
            JLabel projectListLabel = new JLabel(resourceBundle.getString("giftCloudProjectLabelText"),
                    SwingConstants.RIGHT);
            giftCloudServerPanel.add(projectListLabel, labelConstraints);

            inputConstraints.gridy = 5;
            projectList = new BackwardsCompatibleComboBox();
            projectList.setEditable(false);
            projectList.setToolTipText(resourceBundle.getString("giftCloudProjectTooltip"));
            giftCloudServerPanel.add(projectList, inputConstraints);

            labelConstraints.gridx = 1;
            projectListWaitingLabel = new JLabel(resourceBundle.getString("giftCloudProjectWaitingLabelText"),
                    SwingConstants.RIGHT);
            giftCloudServerPanel.add(projectListWaitingLabel, labelConstraints);
            labelConstraints.gridx = 0;
        }

        // Subject prefix
        {
            labelConstraints.gridy = 6;
            JLabel subjectPrefixLabel = new JLabel(resourceBundle.getString("configPanelListenerSubjectPrefix"),
                    SwingConstants.RIGHT);
            subjectPrefixLabel
                    .setToolTipText(resourceBundle.getString("configPanelListenerSubjectPrefixTooltip"));
            giftCloudServerPanel.add(subjectPrefixLabel, labelConstraints);

            inputConstraints.gridy = 6;
            final Optional<String> subjectPrefixText = giftCloudProperties.getSubjectPrefix();
            subjectPrefixField = new AutoFocusTextField(subjectPrefixText.orElse(""));
            giftCloudServerPanel.add(subjectPrefixField, inputConstraints);
        }
    }

    // Local Dicom node configuration
    final JPanel listenerPanel = new JPanel();
    {
        GridBagLayout listenerPanellayout = new GridBagLayout();
        listenerPanel.setLayout(listenerPanellayout);
        JSeparator separator = new JSeparator();
        listenerPanel.add(separator, separatorConstraint);

        JLabel listenerPanelLabel = new JLabel(resourceBundle.getString("configPanelListenerConfig"),
                SwingConstants.CENTER);
        listenerPanel.add(listenerPanelLabel, sectionTitleConstraints);

        {
            labelConstraints.gridy = 2;
            JLabel listeningAETitleJLabel = new JLabel(resourceBundle.getString("configPanelListenerAe"),
                    SwingConstants.RIGHT);
            listeningAETitleJLabel.setToolTipText(resourceBundle.getString("configPanelListenerAeToolTip"));
            listenerPanellayout.setConstraints(listeningAETitleJLabel, labelConstraints);
            listenerPanel.add(listeningAETitleJLabel);

            inputConstraints.gridy = 2;
            final String listeningAETitleInitialText = giftCloudProperties.getListenerAETitle();
            listeningAETitleField = new AutoFocusTextField(listeningAETitleInitialText);
            listenerPanellayout.setConstraints(listeningAETitleField, inputConstraints);
            listenerPanel.add(listeningAETitleField);
        }
        {
            labelConstraints.gridy = 3;
            JLabel listeningPortJLabel = new JLabel(resourceBundle.getString("configPanelListenerPort"),
                    SwingConstants.RIGHT);
            listeningPortJLabel.setToolTipText(resourceBundle.getString("configPanelListenerPortToolTip"));
            listenerPanellayout.setConstraints(listeningPortJLabel, labelConstraints);
            listenerPanel.add(listeningPortJLabel);

            inputConstraints.gridy = 3;
            final int port = giftCloudProperties.getListeningPort();
            final String portValue = Integer.toString(port);
            listeningPortField = new AutoFocusTextField(portValue);
            listenerPanellayout.setConstraints(listeningPortField, inputConstraints);
            listenerPanel.add(listeningPortField);
        }
        {
            labelConstraints.gridy = 4;
            JLabel patientListExportFolderLabel = new JLabel(
                    resourceBundle.getString("configPanelListenerPatientListExportFolder"),
                    SwingConstants.RIGHT);
            patientListExportFolderLabel.setToolTipText(
                    resourceBundle.getString("configPanelListenerPatientListExportFolderTooltip"));
            listenerPanellayout.setConstraints(patientListExportFolderLabel, labelConstraints);
            listenerPanel.add(patientListExportFolderLabel);

            inputConstraints.gridy = 4;
            final Optional<String> patientListExportFolder = giftCloudProperties.getPatientListExportFolder();
            patientListExportFolderField = new AutoFocusTextField(patientListExportFolder.orElse(""));
            listenerPanellayout.setConstraints(patientListExportFolderField, inputConstraints);
            listenerPanel.add(patientListExportFolderField);
        }

        // Patient list spreadsheet password
        {
            labelConstraints.gridy = 5;
            final JLabel patientListSpreadsheetPasswordLabel = new JLabel(
                    resourceBundle.getString("configPanelListenerPatientListSpreadhsheetPassword"),
                    SwingConstants.RIGHT);
            patientListSpreadsheetPasswordLabel.setToolTipText(
                    resourceBundle.getString("configPanelListenerPatientListSpreadhsheetPasswordTooltip"));
            listenerPanel.add(patientListSpreadsheetPasswordLabel, labelConstraints);

            final Optional<char[]> password = giftCloudProperties.getPatientListPassword();
            final char[] initialPassword = password.isPresent() ? password.get() : "".toCharArray();
            patientListSpreadsheetPasswordField = new JPasswordField(new String(initialPassword), 16); // Shouldn't create a String but there's no other way to initialize the password field
            inputConstraints.gridy = 5;
            listenerPanel.add(patientListSpreadsheetPasswordField, inputConstraints);
        }
    }

    // Remote PACS configuration
    final JPanel remoteAEPanel = new JPanel();

    {
        GridBagLayout pacsPanellayout = new GridBagLayout();
        remoteAEPanel.setLayout(pacsPanellayout);

        JSeparator separator = new JSeparator();
        remoteAEPanel.add(separator, separatorConstraint);

        JLabel remotePanelLabel = new JLabel(resourceBundle.getString("pacsPanelListenerConfig"),
                SwingConstants.CENTER);
        remoteAEPanel.add(remotePanelLabel, sectionTitleConstraints);

        {
            labelConstraints.gridy = 2;
            JLabel remoteAeTitleLabel = new JLabel(resourceBundle.getString("configPanelPacsAeTitle"),
                    SwingConstants.RIGHT);
            remoteAeTitleLabel.setToolTipText(resourceBundle.getString("configPanelPacsAeTitleTooltip"));
            remoteAEPanel.add(remoteAeTitleLabel, labelConstraints);

            final Optional<String> pacsAeTitle = giftCloudProperties.getPacsAeTitle();
            remoteAETitleField = new AutoFocusTextField(pacsAeTitle.isPresent() ? pacsAeTitle.get() : "");
            inputConstraints.gridy = 2;
            remoteAEPanel.add(remoteAETitleField, inputConstraints);
        }

        {
            labelConstraints.gridy = 3;
            JLabel remoteAeHostLabel = new JLabel(resourceBundle.getString("configPanelPacsHostname"),
                    SwingConstants.RIGHT);
            remoteAeHostLabel.setToolTipText(resourceBundle.getString("configPanelPacsHostnameTooltip"));
            remoteAEPanel.add(remoteAeHostLabel, labelConstraints);

            remoteAEHostName = new AutoFocusTextField(giftCloudProperties.getPacsHostName().orElse(""));
            inputConstraints.gridy = 3;
            remoteAEPanel.add(remoteAEHostName, inputConstraints);
        }

        {
            labelConstraints.gridy = 4;
            JLabel remoteAeTitleLabel = new JLabel(resourceBundle.getString("configPanelPacsPort"),
                    SwingConstants.RIGHT);
            remoteAeTitleLabel.setToolTipText(resourceBundle.getString("configPanelPacsPortTooltip"));
            remoteAEPanel.add(remoteAeTitleLabel, labelConstraints);

            remoteAEPortField = new AutoFocusTextField(Integer.toString(giftCloudProperties.getPacsPort()));
            inputConstraints.gridy = 4;
            remoteAEPanel.add(remoteAEPortField, inputConstraints);
        }

    }

    // The panel containing the cancel and apply buttons
    JPanel buttonPanel = new JPanel();
    JPanel closeButtonPanel = new JPanel();
    {
        final GridBagLayout buttonPanellayout = new GridBagLayout();
        buttonPanel.setLayout(buttonPanellayout);

        JSeparator separator = new JSeparator();
        buttonPanel.add(separator, separatorConstraint);

        closeButtonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

        JButton cancelButton = new JButton(resourceBundle.getString("cancelSettingsButtonLabelText"));
        cancelButton.setToolTipText(resourceBundle.getString("cancelSettingsButtonToolTipText"));
        closeButtonPanel.add(cancelButton);
        cancelButton.addActionListener(new CancelActionListener());

        JButton applyButton = new JButton(resourceBundle.getString("applySettingsButtonLabelText"));
        applyButton.setToolTipText(resourceBundle.getString("applySettingsButtonToolTipText"));
        closeButtonPanel.add(applyButton);
        applyButton.addActionListener(new ApplyActionListener());

        JButton closeButton = new JButton(resourceBundle.getString("closeSettingsButtonLabelText"));
        closeButton.setToolTipText(resourceBundle.getString("closeSettingsButtonToolTipText"));
        closeButtonPanel.add(closeButton);
        closeButton.addActionListener(new CloseActionListener());

        final GridBagConstraints constraints = new GridBagConstraints();
        constraints.gridx = 0;
        constraints.gridy = 1;
        constraints.weightx = 1;
        constraints.weighty = 1;
        constraints.insets = new Insets(5, 5, 5, 5);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        buttonPanellayout.setConstraints(closeButtonPanel, constraints);
        buttonPanel.add(closeButtonPanel);
    }

    // The main panel of the configuration dialog
    JPanel configPanel = new JPanel();
    {
        final GridBagLayout configPanelLayout = new GridBagLayout();
        configPanel.setLayout(configPanelLayout);
        {
            final GridBagConstraints constraints = new GridBagConstraints();
            constraints.gridx = 0;
            constraints.gridy = 0;
            constraints.weightx = 1;
            constraints.weighty = 1;
            constraints.insets = new Insets(5, 5, 5, 5);
            constraints.fill = GridBagConstraints.HORIZONTAL;
            configPanelLayout.setConstraints(giftCloudServerPanel, constraints);
            configPanel.add(giftCloudServerPanel);
        }
        {
            final GridBagConstraints constraints = new GridBagConstraints();
            constraints.gridx = 0;
            constraints.gridy = 1;
            constraints.weightx = 1;
            constraints.weighty = 1;
            constraints.insets = new Insets(5, 5, 5, 5);
            constraints.fill = GridBagConstraints.HORIZONTAL;
            configPanelLayout.setConstraints(listenerPanel, constraints);
            configPanel.add(listenerPanel);
        }
        {
            final GridBagConstraints constraints = new GridBagConstraints();
            constraints.gridx = 0;
            constraints.gridy = 2;
            constraints.insets = new Insets(5, 5, 5, 5);
            constraints.fill = GridBagConstraints.HORIZONTAL;
            configPanelLayout.setConstraints(remoteAEPanel, constraints);
            configPanel.add(remoteAEPanel);
        }
        {
            final GridBagConstraints constraints = new GridBagConstraints();
            constraints.gridx = 0;
            constraints.gridy = 3;
            constraints.insets = new Insets(5, 5, 5, 5);
            constraints.fill = GridBagConstraints.HORIZONTAL;
            configPanelLayout.setConstraints(buttonPanel, constraints);
            configPanel.add(buttonPanel);
        }
    }

    projectList.setModel(temporaryDropDownListModel);
    showProjectList(projectListModel.isEnabled());

    // Create a listener to enable/disable the project list when it is set from the server.
    // The reason for this is that the project list is set after logging into the server, which can happen asynchronously after property changes have been applied.
    // If the server was configured in the dialog and apply clicked, it might take a few seconds for the project list to be updated, and we want it to become available when this happens
    projectListEnabledListener = new DropDownListModel.EnabledListener<Boolean>() {
        @Override
        public void statusChanged(final Boolean visibility) {
            showProjectList(projectListModel.isEnabled());
        }
    };

    projectListModel.addListener(projectListEnabledListener);

    GridBagLayout layout = new GridBagLayout();
    dialog.setLayout(layout);
    Container content = dialog.getContentPane();
    content.add(configPanel);
    dialog.pack();
    dialog.setVisible(true);
    dialog.pack();
}

From source file:uk.chromis.pos.forms.JRootApp.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the FormEditor.//from ww  w. j  a  v a 2  s  .  c om
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    m_jPanelTitle = new javax.swing.JPanel();
    m_jLblTitle = new javax.swing.JLabel();
    poweredby = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    m_jPanelContainer = new javax.swing.JPanel();
    m_jPanelLogin = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 10),
            new java.awt.Dimension(32767, 0));
    jLabel1 = new javax.swing.JLabel();
    jPanel5 = new javax.swing.JPanel();
    m_jLogonName = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jPanel1 = new javax.swing.JPanel();
    m_txtKeys = new javax.swing.JTextField();
    m_jClose = new javax.swing.JButton();
    m_jPanelDown = new javax.swing.JPanel();
    panelTask = new javax.swing.JPanel();
    m_jHost = new javax.swing.JLabel();
    jPanel3 = new javax.swing.JPanel();

    setEnabled(false);
    setPreferredSize(new java.awt.Dimension(1024, 768));
    setLayout(new java.awt.BorderLayout());

    m_jPanelTitle.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0,
            javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")));
    m_jPanelTitle.setLayout(new java.awt.BorderLayout());

    m_jLblTitle.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
    m_jLblTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    m_jLblTitle.setText("Window.Title");
    m_jPanelTitle.add(m_jLblTitle, java.awt.BorderLayout.CENTER);

    poweredby.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    poweredby.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/uk/chromis/fixedimages/poweredby.png"))); // NOI18N
    poweredby.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 5));
    poweredby.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    poweredby.setMaximumSize(new java.awt.Dimension(222, 34));
    poweredby.setPreferredSize(new java.awt.Dimension(180, 34));
    poweredby.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            poweredbyMouseClicked(evt);
        }
    });
    m_jPanelTitle.add(poweredby, java.awt.BorderLayout.LINE_END);

    jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    jLabel2.setForeground(new java.awt.Color(102, 102, 102));
    jLabel2.setPreferredSize(new java.awt.Dimension(280, 34));
    jLabel2.setRequestFocusEnabled(false);
    m_jPanelTitle.add(jLabel2, java.awt.BorderLayout.LINE_START);

    add(m_jPanelTitle, java.awt.BorderLayout.NORTH);

    m_jPanelContainer.setLayout(new java.awt.CardLayout());

    m_jPanelLogin.setLayout(new java.awt.BorderLayout());

    jPanel4.setMinimumSize(new java.awt.Dimension(518, 177));
    jPanel4.setPreferredSize(new java.awt.Dimension(518, 177));
    jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));
    jPanel4.add(filler2);

    jLabel1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/chromis/fixedimages/chromis.png"))); // NOI18N
    jLabel1.setText("<html><center>Chromis POS - The New Face of open source POS<br>"
            + "Copyright \u00A9 2015 Chromis <br>" + "http://www.chromis.co.uk<br>" + "<br>"
            + "Chromis POS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<br>"
            + "<br>"
            + "Chromis POS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.<br>"
            + "<br>"
            + "You should have received a copy of the GNU General Public License along with Chromis POS.  If not, see http://www.gnu.org/licenses/<br>"
            + "</center>");
    jLabel1.setAlignmentX(0.5F);
    jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    jLabel1.setMaximumSize(new java.awt.Dimension(800, 1024));
    jLabel1.setMinimumSize(new java.awt.Dimension(518, 177));
    jLabel1.setPreferredSize(new java.awt.Dimension(518, 177));
    jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jPanel4.add(jLabel1);

    m_jPanelLogin.add(jPanel4, java.awt.BorderLayout.CENTER);

    jPanel5.setPreferredSize(new java.awt.Dimension(300, 400));

    m_jLogonName.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    m_jLogonName.setLayout(new java.awt.BorderLayout());

    jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 5));
    jPanel2.setPreferredSize(new java.awt.Dimension(100, 100));
    jPanel2.setLayout(new java.awt.BorderLayout());

    jPanel8.setLayout(new java.awt.GridLayout(0, 1, 5, 5));
    jPanel2.add(jPanel8, java.awt.BorderLayout.NORTH);

    m_jLogonName.add(jPanel2, java.awt.BorderLayout.LINE_END);

    jScrollPane1.setBackground(new java.awt.Color(255, 255, 255));
    jScrollPane1.setBorder(null);
    jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jScrollPane1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

    m_txtKeys.setPreferredSize(new java.awt.Dimension(0, 0));
    m_txtKeys.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyTyped(java.awt.event.KeyEvent evt) {
            m_txtKeysKeyTyped(evt);
        }
    });

    m_jClose.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    m_jClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/chromis/images/exit.png"))); // NOI18N
    m_jClose.setText(AppLocal.getIntString("Button.Close")); // NOI18N
    m_jClose.setFocusPainted(false);
    m_jClose.setFocusable(false);
    m_jClose.setPreferredSize(new java.awt.Dimension(100, 50));
    m_jClose.setRequestFocusEnabled(false);
    m_jClose.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            m_jCloseActionPerformed(evt);
        }
    });

    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(m_txtKeys, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(m_jClose, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 289,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(24, Short.MAX_VALUE)));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                    .add(m_txtKeys, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(m_jClose, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)));

    org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup().addContainerGap()
                    .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(jScrollPane1))
                    .add(104, 104, 104)
                    .add(m_jLogonName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(0, 0, Short.MAX_VALUE)));
    jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup().add(15, 15, 15)
                    .add(m_jLogonName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(434, 565, Short.MAX_VALUE))
            .add(jPanel5Layout.createSequentialGroup().add(jScrollPane1)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));

    m_jPanelLogin.add(jPanel5, java.awt.BorderLayout.EAST);

    m_jPanelContainer.add(m_jPanelLogin, "login");

    add(m_jPanelContainer, java.awt.BorderLayout.CENTER);

    m_jPanelDown.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 0, 0, 0,
            javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")));
    m_jPanelDown.setLayout(new java.awt.BorderLayout());

    m_jHost.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    m_jHost.setIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/chromis/images/display.png"))); // NOI18N
    m_jHost.setText("*Hostname");
    panelTask.add(m_jHost);

    m_jPanelDown.add(panelTask, java.awt.BorderLayout.LINE_START);
    m_jPanelDown.add(jPanel3, java.awt.BorderLayout.LINE_END);

    add(m_jPanelDown, java.awt.BorderLayout.SOUTH);
}

From source file:zxmax.tools.timerreview.gui.StartTimerWindow.java

private Component getPnlNewTimer() {
    setTitle(I18N.getLabel(getClass(), "window.title"));
    JPanel pnlNewTimer = new JPanel();
    LayoutManager layout = new MigLayout("flowy", "[328.00][grow,fill]", "[][][][][]");
    taFocusOn = new JTextArea();
    taFocusOn.setWrapStyleWord(true);// w ww.  ja va2 s.c o m
    JScrollPane spFocusOn = new JScrollPane();
    tfTitle = new JTextField(30);
    JButton btnStart = new JButton();

    pnlNewTimer.setLayout(layout);
    btnStart.setText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_BTN_START_LABEL));
    taFocusOn.setColumns(20);
    taFocusOn.setForeground(new Color(0, 153, 0));
    taFocusOn.setRows(5);
    taFocusOn.setTabSize(2);
    taFocusOn.setText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_TEXT_AREA_TEXT));
    taFocusOn.setToolTipText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_TEXT_AREA_TOOL_TIP));
    spFocusOn.setViewportView(taFocusOn);
    taFocusOn.getAccessibleContext().setAccessibleName("taFocusOn");

    btnStart.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            storeDataAndStartTimer();
        }
    });
    btnStart.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            logger.debug(evt.getKeyCode() + ", " + evt.getKeyChar());
            if (KeyEvent.VK_ENTER == evt.getKeyCode()) {
                storeDataAndStartTimer();
            }
        }
    });

    JLabel lblTitle = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_TITLE_LABEL));

    pnlNewTimer.add(lblTitle, "cell 0 0");
    pnlNewTimer.add(tfTitle, "cell 0 1 2 1,growx");
    JLabel lblFocusOn = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_LABEL));
    pnlNewTimer.add(lblFocusOn, "cell 0 2");
    pnlNewTimer.add(spFocusOn, "cell 0 3 2 1,growx");
    pnlNewTimer.add(btnStart, "cell 0 4 2 1,growx");

    Box horizontalBox = Box.createHorizontalBox();
    pnlNewTimer.add(horizontalBox, "flowx,cell 1 0");

    JLabel lblDurata = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_DURATA_LABEL));
    lblDurata.setHorizontalAlignment(SwingConstants.RIGHT);
    pnlNewTimer.add(lblDurata, "cell 1 0,alignx right");
    lblDurata.setLabelFor(txtDurata);

    txtDurata = new JTextField("20");
    txtDurata.setToolTipText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_DURATA_TOOL_TIP));
    pnlNewTimer.add(txtDurata, "cell 1 0,alignx center");
    txtDurata.setColumns(2);

    return pnlNewTimer;
}