Example usage for javax.swing.border EmptyBorder EmptyBorder

List of usage examples for javax.swing.border EmptyBorder EmptyBorder

Introduction

In this page you can find the example usage for javax.swing.border EmptyBorder EmptyBorder.

Prototype

public EmptyBorder(int top, int left, int bottom, int right) 

Source Link

Document

Creates an empty border with the specified insets.

Usage

From source file:jmemorize.gui.swing.panels.HistoryChartPanel.java

private void initComponents() {
    m_chart = createChart();/*from   ww  w  .  j a  va  2 s .  c  o  m*/
    ChartPanel chartPanel = new ChartPanel(m_chart);

    chartPanel.setMinimumDrawHeight(100);
    chartPanel.setMinimumDrawWidth(400);

    chartPanel.setMaximumDrawHeight(1600);
    chartPanel.setMaximumDrawWidth(3000);

    setLayout(new BorderLayout());
    setBorder(new EmptyBorder(5, 5, 5, 5));

    add(buildChartChooser(), BorderLayout.NORTH);
    add(chartPanel, BorderLayout.CENTER);
}

From source file:org.datacleaner.windows.MonitorConnectionDialog.java

@Inject
public MonitorConnectionDialog(WindowContext windowContext, UserPreferences userPreferences) {
    super(windowContext, imageManager.getImage("images/window/banner-dq-monitor.png"));
    _userPreferences = userPreferences;/*from w ww .  j  a  v  a 2s .co m*/

    final MonitorConnection monitorConnection = _userPreferences.getMonitorConnection();

    _urlLabel = DCLabel.bright("");
    _urlLabel.setForeground(WidgetUtils.BG_COLOR_LESS_BRIGHT);
    _urlLabel.setBorder(new EmptyBorder(0, 0, 25, 0));

    _httpsCheckBox = new DCCheckBox<Void>("Use HTTPS?", false);
    if (monitorConnection != null && monitorConnection.isHttps()) {
        _httpsCheckBox.setSelected(true);
    }
    _httpsCheckBox.setBorderPainted(false);
    _httpsCheckBox.setOpaque(false);
    _httpsCheckBox.setForeground(WidgetUtils.BG_COLOR_BRIGHTEST);
    _httpsCheckBox.addListener(new Listener<Void>() {
        @Override
        public void onItemSelected(Void item, boolean selected) {
            updateUrlLabel();
        }
    });

    _hostnameTextField = WidgetFactory.createTextField("Hostname");
    if (monitorConnection != null && monitorConnection.getHostname() != null) {
        _hostnameTextField.setText(monitorConnection.getHostname());
    } else {
        _hostnameTextField.setText("localhost");
    }
    _hostnameTextField.getDocument().addDocumentListener(new DCDocumentListener() {
        @Override
        protected void onChange(DocumentEvent event) {
            updateUrlLabel();
        }
    });

    _portTextField = WidgetFactory.createTextField("Port");
    _portTextField.setDocument(new NumberDocument(false));
    if (monitorConnection != null) {
        _portTextField.setText(monitorConnection.getPort() + "");
    } else {
        _portTextField.setText("8080");
    }
    _portTextField.getDocument().addDocumentListener(new DCDocumentListener() {
        @Override
        protected void onChange(DocumentEvent event) {
            updateUrlLabel();
        }
    });

    _contextPathTextField = WidgetFactory.createTextField("Context path");
    if (monitorConnection != null) {
        _contextPathTextField.setText(monitorConnection.getContextPath());
    } else {
        _contextPathTextField.setText("DataCleaner-monitor");
    }
    _contextPathTextField.getDocument().addDocumentListener(new DCDocumentListener() {
        @Override
        protected void onChange(DocumentEvent event) {
            updateUrlLabel();
        }
    });

    _tenantTextField = WidgetFactory.createTextField("Tenant ID");
    if (monitorConnection != null) {
        _tenantTextField.setText(monitorConnection.getTenantId());
    } else {
        _tenantTextField.setText("DC");
    }
    _tenantTextField.getDocument().addDocumentListener(new DCDocumentListener() {
        @Override
        protected void onChange(DocumentEvent event) {
            updateUrlLabel();
        }
    });

    _usernameTextField = WidgetFactory.createTextField("Username");
    _passwordTextField = WidgetFactory.createPasswordField();

    _authenticationCheckBox = new DCCheckBox<Void>("Use authentication?", true);
    _authenticationCheckBox.setBorderPainted(false);
    _authenticationCheckBox.setOpaque(false);
    _authenticationCheckBox.setForeground(WidgetUtils.BG_COLOR_BRIGHTEST);
    _authenticationCheckBox.addListener(new Listener<Void>() {
        @Override
        public void onItemSelected(Void item, boolean selected) {
            _usernameTextField.setEnabled(selected);
            _passwordTextField.setEnabled(selected);
        }
    });

    if (monitorConnection != null && monitorConnection.isAuthenticationEnabled()) {
        _authenticationCheckBox.setSelected(true);

        final String username = monitorConnection.getUsername();
        _usernameTextField.setText(username);

        final String decodedPassword = SecurityUtils.decodePassword(monitorConnection.getEncodedPassword());
        _passwordTextField.setText(decodedPassword);
    } else {
        _authenticationCheckBox.setSelected(false);
    }

    updateUrlLabel();
}

From source file:es.emergya.ui.gis.popups.SaveGPXDialog.java

private SaveGPXDialog(final List<Layer> capas) {
    super("Consulta de Posiciones GPS");
    setResizable(false);//from  w ww .j  a va  2s.co  m
    setAlwaysOnTop(true);
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }

    this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    JPanel dialogo = new JPanel(new BorderLayout());
    dialogo.setBackground(Color.WHITE);
    dialogo.setBorder(new EmptyBorder(10, 10, 10, 10));

    JPanel central = new JPanel(new FlowLayout());
    central.setOpaque(false);
    final JTextField nombre = new JTextField(15);
    nombre.setEditable(false);
    central.add(nombre);
    final JButton button = new JButton("Examinar...", LogicConstants.getIcon("button_nuevo"));
    central.add(button);
    final JButton aceptar = new JButton("Guardar", LogicConstants.getIcon("button_save"));
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = new JFileChooser();
            if (fileChooser.showSaveDialog(SaveGPXDialog.this) == JFileChooser.APPROVE_OPTION) {
                nombre.setText(fileChooser.getSelectedFile().getAbsolutePath());
                aceptar.setEnabled(true);
            }
        }
    });

    dialogo.add(central, BorderLayout.CENTER);

    JPanel botones = new JPanel(new FlowLayout());
    botones.setOpaque(false);

    aceptar.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String base_url = nombre.getText() + "_";
            for (Layer layer : capas) {
                if (layer instanceof GpxLayer) {
                    GpxLayer gpxLayer = (GpxLayer) layer;
                    File f = new File(base_url + gpxLayer.name + ".gpx");

                    boolean sobreescribir = !f.exists();

                    try {
                        while (!sobreescribir) {
                            String original = f.getCanonicalPath();
                            f = checkFileOverwritten(nombre, f);
                            sobreescribir = !f.exists() || original.equals(f.getCanonicalPath());
                        }
                    } catch (NullPointerException t) {
                        log.debug("Cancelando creacion de fichero: " + t);
                        sobreescribir = false;
                    } catch (Throwable t) {
                        log.error("Error comprobando la sobreescritura", t);
                        sobreescribir = false;
                    }

                    if (sobreescribir) {
                        try {
                            f.createNewFile();
                        } catch (IOException e1) {
                            log.error(e1, e1);
                        }
                        if (!(f.isFile() && f.canWrite()))
                            JOptionPane.showMessageDialog(SaveGPXDialog.this,
                                    "No tengo permiso para escribir en " + f.getAbsolutePath());
                        else {
                            try {
                                OutputStream out = new FileOutputStream(f);
                                GpxWriter writer = new GpxWriter(out);
                                writer.write(gpxLayer.data);
                                out.close();
                            } catch (Throwable t) {
                                log.error("Error al escribir el gpx", t);
                                JOptionPane.showMessageDialog(SaveGPXDialog.this,
                                        "Ocurri un error al escribir en " + f.getAbsolutePath());
                            }
                        }
                    } else
                        log.error("Por errores anteriores no se escribio el fichero");
                } else
                    log.error("Una de las capas no era gpx: " + layer.name);
            }
            SaveGPXDialog.this.dispose();

        }

        private File checkFileOverwritten(final JTextField nombre, File f) throws Exception {
            String nueva = JOptionPane.showInputDialog(nombre, i18n.getString("savegpxdialog.overwrite"),
                    "Sobreescribir archivo", JOptionPane.QUESTION_MESSAGE, null, null, f.getCanonicalPath())
                    .toString();
            log.debug("Nueva ruta: " + nueva);
            return new File(nueva);
        }
    });

    JButton cancelar = new JButton("Cancelar", LogicConstants.getIcon("button_cancel"));

    cancelar.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SaveGPXDialog.this.dispose();
        }
    });

    aceptar.setEnabled(false);
    botones.add(aceptar);
    botones.add(cancelar);
    dialogo.add(botones, BorderLayout.SOUTH);

    add(dialogo);
    setPreferredSize(new Dimension(300, 200));
    pack();

    int x;
    int y;

    Container myParent;
    try {
        myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getContentPane();
        java.awt.Point topLeft = myParent.getLocationOnScreen();
        Dimension parentSize = myParent.getSize();

        Dimension mySize = getSize();

        if (parentSize.width > mySize.width)
            x = ((parentSize.width - mySize.width) / 2) + topLeft.x;
        else
            x = topLeft.x;

        if (parentSize.height > mySize.height)
            y = ((parentSize.height - mySize.height) / 2) + topLeft.y;
        else
            y = topLeft.y;

        setLocation(x, y);
    } catch (Throwable e1) {
        LOG.error("There is no basic window!", e1);
    }

    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosed(WindowEvent e) {
            nombre.setText("");
            nombre.repaint();
        }

        @Override
        public void windowClosing(WindowEvent e) {
            nombre.setText("");
            nombre.repaint();
        }
    });
}

From source file:ca.uhn.hl7v2.testpanel.ui.AddMessageDialog.java

/**
 * Create the dialog./*from   ww  w. ja v  a2s.c  o  m*/
 */
public AddMessageDialog(Controller theController) {
    myController = theController;

    setMinimumSize(new Dimension(450, 400));
    setPreferredSize(new Dimension(450, 400));
    setSize(new Dimension(450, 400));
    setResizable(false);
    setMaximumSize(new Dimension(450, 400));
    setTitle("Add Message");
    setBounds(100, 100, 450, 401);
    getContentPane().setLayout(new BorderLayout());
    mycontentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(mycontentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] { 0, 0 };
    gbl_contentPanel.rowHeights = new int[] { 0, 0, 0 };
    gbl_contentPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_contentPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
    mycontentPanel.setLayout(gbl_contentPanel);
    {
        JPanel panel = new JPanel();
        panel.setBorder(
                new TitledBorder(null, "Message Type", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.weighty = 1.0;
        gbc_panel.insets = new Insets(0, 0, 5, 0);
        gbc_panel.fill = GridBagConstraints.BOTH;
        gbc_panel.gridx = 0;
        gbc_panel.gridy = 0;
        mycontentPanel.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 0, 0, 0 };
        gbl_panel.rowHeights = new int[] { 0, 0, 0 };
        gbl_panel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
        panel.setLayout(gbl_panel);
        {
            JLabel lblVersion = new JLabel("Version");
            GridBagConstraints gbc_lblVersion = new GridBagConstraints();
            gbc_lblVersion.insets = new Insets(0, 0, 5, 5);
            gbc_lblVersion.gridx = 0;
            gbc_lblVersion.gridy = 0;
            panel.add(lblVersion, gbc_lblVersion);
        }
        {
            JLabel lblType = new JLabel("Type");
            GridBagConstraints gbc_lblType = new GridBagConstraints();
            gbc_lblType.insets = new Insets(0, 0, 5, 0);
            gbc_lblType.gridx = 1;
            gbc_lblType.gridy = 0;
            panel.add(lblType, gbc_lblType);
        }
        {
            JScrollPane scrollPane = new JScrollPane();
            scrollPane.setViewportBorder(null);
            GridBagConstraints gbc_scrollPane = new GridBagConstraints();
            gbc_scrollPane.weighty = 1.0;
            gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
            gbc_scrollPane.fill = GridBagConstraints.BOTH;
            gbc_scrollPane.gridx = 0;
            gbc_scrollPane.gridy = 1;
            panel.add(scrollPane, gbc_scrollPane);
            {
                myVersionList = new JList();
                myVersionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                scrollPane.setViewportView(myVersionList);
            }
        }
        {
            JScrollPane scrollPane = new JScrollPane();
            scrollPane.setViewportBorder(null);
            GridBagConstraints gbc_scrollPane = new GridBagConstraints();
            gbc_scrollPane.weighty = 1.0;
            gbc_scrollPane.weightx = 1.0;
            gbc_scrollPane.fill = GridBagConstraints.BOTH;
            gbc_scrollPane.gridx = 1;
            gbc_scrollPane.gridy = 1;
            panel.add(scrollPane, gbc_scrollPane);
            {
                myMessageTypeList = new JList();
                myMessageTypeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                scrollPane.setViewportView(myMessageTypeList);
            }
        }
    }
    {
        JPanel panel = new JPanel();
        panel.setBorder(new TitledBorder(null, "Options", TitledBorder.LEADING, TitledBorder.TOP, null, null));
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.fill = GridBagConstraints.BOTH;
        gbc_panel.gridx = 0;
        gbc_panel.gridy = 1;
        mycontentPanel.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 0, 0, 0 };
        gbl_panel.rowHeights = new int[] { 0, 0 };
        gbl_panel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
        panel.setLayout(gbl_panel);
        {
            JLabel lblEncoding = new JLabel("Encoding");
            GridBagConstraints gbc_lblEncoding = new GridBagConstraints();
            gbc_lblEncoding.insets = new Insets(0, 0, 0, 5);
            gbc_lblEncoding.gridx = 0;
            gbc_lblEncoding.gridy = 0;
            panel.add(lblEncoding, gbc_lblEncoding);
        }
        {
            JPanel panel_1 = new JPanel();
            panel_1.setBorder(null);
            GridBagConstraints gbc_panel_1 = new GridBagConstraints();
            gbc_panel_1.anchor = GridBagConstraints.WEST;
            gbc_panel_1.fill = GridBagConstraints.VERTICAL;
            gbc_panel_1.gridx = 1;
            gbc_panel_1.gridy = 0;
            panel.add(panel_1, gbc_panel_1);
            {
                myEr7Radio = new JRadioButton("ER7");
                myEr7Radio.setSelected(true);
                encodingButtonGroup.add(myEr7Radio);
                panel_1.add(myEr7Radio);
            }
            {
                JRadioButton myXmlRadio = new JRadioButton("XML");
                encodingButtonGroup.add(myXmlRadio);
                panel_1.add(myXmlRadio);
            }
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    try {
                        String version = (String) myVersionList.getSelectedValue();
                        String fullType = (String) myMessageTypeList.getSelectedValue();
                        String structure = myTypesToStructures.get(fullType);
                        String[] fullTypeBits = fullType.split("\\^");
                        String type = fullTypeBits[0];
                        String trigger = fullTypeBits[1];

                        Hl7V2EncodingTypeEnum encoding = myEr7Radio.isSelected() ? Hl7V2EncodingTypeEnum.ER_7
                                : Hl7V2EncodingTypeEnum.XML;
                        myController.addMessage(version, type, trigger, structure, encoding);
                    } finally {
                        setVisible(false);
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    AddMessageDialog.this.setVisible(false);
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }

    initLocal();
}

From source file:com.diversityarrays.kdxplore.curate.fieldview.OverviewDialog.java

@SuppressWarnings("unchecked")
public OverviewDialog(Window window, String title,

        @SuppressWarnings("rawtypes") ComboBoxModel comboBoxModel, CurationData curationData,
        Transformer<TraitInstance, String> tiNameProvider, OverviewInfoProvider overviewInfoProvider,
        FieldViewSelectionModel fvsm, FieldLayoutTableModel fltm, CurationTableModel ctm) {
    super(window, title, ModalityType.MODELESS);

    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setAlwaysOnTop(true);/*  w  w  w. j  a  va2s.c  o m*/

    this.fieldViewSelectionModel = fvsm;

    @SuppressWarnings({ "rawtypes" })
    JComboBox activeTiCombo = new JComboBox(comboBoxModel);
    TraitInstanceCellRenderer tiCellRenderer = new TraitInstanceCellRenderer(
            curationData.getTraitColorProvider(), tiNameProvider);
    activeTiCombo.setRenderer(tiCellRenderer);

    JLabel infoLabel = new JLabel(" ");
    infoLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));

    final JFrame[] helpDialog = new JFrame[1];
    Action helpAction = new AbstractAction("?") {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (helpDialog[0] != null) {
                GuiUtil.restoreFrame(helpDialog[0]);
            } else {
                JFrame f = new JFrame("Overview Help");
                helpDialog[0] = f;
                f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                f.setAlwaysOnTop(true);
                f.setLocationRelativeTo(overview);
                String html = Overview.getOverviewHelpHtml();
                JLabel label = new JLabel(html);
                label.setBorder(new EmptyBorder(0, 10, 0, 10));
                f.setContentPane(label);
                f.pack();
                f.setVisible(true);
            }
        }
    };

    //        Window window = GuiUtil.getOwnerWindow(FieldLayoutViewPanel.this);
    if (window != null) {
        if (window instanceof JFrame) {
            System.out.println("Found window: " + ((JFrame) window).getTitle());
        }
        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                window.removeWindowListener(this);
                if (helpDialog[0] != null) {
                    helpDialog[0].dispose();
                }
            }
        });
    }

    KDClientUtils.initAction(ImageId.HELP_24, helpAction, "Help for Overview");
    Box top = Box.createHorizontalBox();
    top.add(activeTiCombo);
    top.add(new JButton(helpAction));

    overview = new Overview(overviewInfoProvider, fltm, curationData, ctm, infoLabel);
    overview.setActiveTraitInstance(fvsm.getActiveTraitInstance(true));
    Container cp = getContentPane();

    cp.add(top, BorderLayout.NORTH);
    //      cp.add(traitLabel, BorderLayout.NORTH);
    cp.add(infoLabel, BorderLayout.SOUTH);
    cp.add(overview, BorderLayout.CENTER);

    pack();
    //      setResizable(false);

    //      setLocationRelativeTo(showOverviewButton);
    // DEFAULT POSITION is "out of the way"
    setVisible(true);

    this.fieldViewSelectionModel.addListSelectionListener(listSelectionListener);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            toFront();
        }

        @Override
        public void windowClosed(WindowEvent e) {
            fieldViewSelectionModel.removeListSelectionListener(listSelectionListener);
            removeWindowListener(this);
        }
    });
}

From source file:com.moneydance.modules.features.mdvenmoimporter.VenmoImporterWindow.java

public VenmoImporterWindow(Main extension) {
    super("VenmoImporter Console");
    this.extension = extension;

    loadSettings();//ww  w .  j a v a  2 s  . c o m

    setResizable(false);
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    setBounds(100, 100, 516, 176);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(10, 10, 10, 10));
    setContentPane(contentPane);
    contentPane.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("8dlu"),
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    JLabel lblVenmoToken = new JLabel("Venmo Token");
    lblVenmoToken.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPane.add(lblVenmoToken, "2, 2");

    venmoTokenField = new JTextField(venmoToken);
    venmoTokenField.setToolTipText(venmoTokenTooltip);
    contentPane.add(venmoTokenField, "4, 2, fill, default");
    venmoTokenField.setColumns(50);

    JLabel lblAccount = new JLabel("Account");
    contentPane.add(lblAccount, "2, 4, right, default");

    targetAccountCombo = new JComboBox<>(
            new Vector<>(extension.getUnprotectedContext().getRootAccount().getSubAccounts()));
    contentPane.add(targetAccountCombo, "4, 4, fill, default");
    if (targetAcctId != null) {
        targetAccountCombo.setSelectedItem(
                extension.getUnprotectedContext().getCurrentAccountBook().getAccountByUUID(targetAcctId));
    }

    JLabel lblDescriptionFormat = new JLabel("Memo template");
    contentPane.add(lblDescriptionFormat, "2, 6, right, default");

    descriptionFormatField = new JTextField(
            descriptionFormat == null ? descriptionFormatDefault : descriptionFormat);
    descriptionFormatField.setToolTipText(descriptionFormatTooltip);
    contentPane.add(descriptionFormatField, "4, 6, fill, default");
    descriptionFormatField.setColumns(10);

    panel = new JPanel();
    panel.setBorder(null);
    contentPane.add(panel, "2, 8, 3, 1, fill, fill");

    btnDelete = new JButton("Delete Settings");
    panel.add(btnDelete);

    btnCancel = new JButton("Cancel");
    panel.add(btnCancel);

    btnSave = new JButton("Save");
    panel.add(btnSave);

    btnDownloadTransactions = new JButton("Download Transactions");
    panel.add(btnDownloadTransactions);

    btnCancel.addActionListener(this);
    btnSave.addActionListener(this);
    btnDelete.addActionListener(this);
    btnDownloadTransactions.addActionListener(this);

    enableEvents(WindowEvent.WINDOW_CLOSING);

}

From source file:projects.tgas.exec.HrDiagram.java

/**
 * Main constructor.//from   ww w.  j  av a  2 s.  co m
 */
public HrDiagram() {

    tgasStars = TgasUtils.loadTgasCatalogue();

    method = METHOD.NAIVE;
    fMax = 1.0;

    final JComboBox<METHOD> methodComboBox = new JComboBox<METHOD>(METHOD.values());
    methodComboBox.setSelectedItem(method);
    methodComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            method = (METHOD) methodComboBox.getSelectedItem();
            updateChart();
        }
    });

    final JSlider fSlider = GuiUtil.buildSlider(0.0, 2.0, 5, "%3.3f");
    fSlider.setValue((int) Math.rint(100.0 * fMax / 2.0));
    final JLabel fLabel = new JLabel(getFLabel());
    // Create a change listener fot these
    ChangeListener cl = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();

            if (source == fSlider) {
                // Compute fractional parallax error from slider position
                double newF = (2.0 * source.getValue() / 100.0);
                fMax = newF;
                fLabel.setText(getFLabel());
            }
            updateChart();
        }
    };
    fSlider.addChangeListener(cl);
    // Add a bit of padding to space things out
    fSlider.setBorder(new EmptyBorder(5, 5, 5, 5));

    // Present controls below the HR diagram
    JPanel controls = new JPanel(new GridLayout(2, 2));
    controls.add(new JLabel("Distance estimation method:"));
    controls.add(methodComboBox);
    controls.add(fLabel);
    controls.add(fSlider);

    // Initialise the ChartPanel
    updateChart();

    // Build the panel contents
    setLayout(new BorderLayout());
    add(hrDiagPanel, BorderLayout.CENTER);
    add(controls, BorderLayout.SOUTH);
}

From source file:com.k42b3.aletheia.response.html.Images.java

public Images() {
    super();// w w  w  .  j  a  v  a2s  . c om

    executorService = Executors.newFixedThreadPool(6);

    // settings
    this.setTitle("Images");
    this.setLocation(100, 100);
    this.setPreferredSize(new Dimension(360, 600));
    this.setMinimumSize(this.getSize());
    this.setResizable(false);
    this.setLayout(new BorderLayout());

    // list
    model = new DefaultListModel<URL>();
    list = new JList<URL>(model);
    list.addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            btnDownload.setEnabled(list.getSelectedIndex() != -1);
        }

    });
    list.setCellRenderer(new ImageCellRenderer());

    scp = new JScrollPane(list);
    scp.setBorder(new EmptyBorder(4, 4, 4, 4));

    this.add(scp, BorderLayout.CENTER);

    // buttons
    JPanel panelButtons = new JPanel();

    FlowLayout fl = new FlowLayout();
    fl.setAlignment(FlowLayout.LEFT);

    panelButtons.setLayout(fl);

    btnDownload = new JButton("Download");
    btnDownload.addActionListener(new DownloadHandler());
    btnDownload.setEnabled(false);
    JButton btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(new CloseHandler());
    lblInfo = new JLabel("");

    panelButtons.add(btnDownload);
    panelButtons.add(btnCancel);
    panelButtons.add(lblInfo);

    this.add(panelButtons, BorderLayout.SOUTH);

    this.pack();
}

From source file:gov.loc.repository.bagger.ui.NewBagInPlaceFrame.java

private JPanel createComponents() {

    TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from   www .  ja va2s  .  c  om*/
    JPanel pageControl = new JPanel(new BorderLayout());
    JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("NewBagInPlace.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("NewBagInPlace.description")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);

    JPanel contentPanel = new JPanel(new GridBagLayout());
    contentPanel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;
    layoutSelectDataContent(contentPanel, row++);
    layoutBagVersionContent(contentPanel, row++);
    layoutProfileSelectionContent(contentPanel, row++);
    layoutAddKeepFilesToEmptyCheckBox(contentPanel, row++);
    layoutSpacer(contentPanel, row++);

    GuiStandardUtils.attachDialogBorder(contentPanel);
    pageControl.add(contentPanel);
    JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:com.hp.alm.ali.idea.content.taskboard.BacklogItemPanel.java

public BacklogItemPanel(Project project, Entity item, TaskBoardFilter filter) {
    super(new BorderLayout());

    this.project = project;
    this.item = item;
    this.filter = filter;
    entityLabelService = project.getComponent(EntityLabelService.class);
    entityService = project.getComponent(EntityService.class);
    activeItemService = project.getComponent(ActiveItemService.class);
    taskBoardConfiguration = project.getComponent(TaskBoardConfiguration.class);
    taskBoardFlow = project.getComponent(TaskBoardFlow.class);
    aliProjectConfiguration = project.getComponent(AliProjectConfiguration.class);

    header = new Header();
    header.setBorder(new EmptyBorder(0, 5, 0, 5));
    add(header, BorderLayout.NORTH);
    entityName = new JTextPane();
    entityName.setBackground(getBackground());
    entityName.setEditable(false);//w ww.  jav a  2  s . c o  m
    add(entityName, BorderLayout.CENTER);
    content = new Content();
    content.setBorder(new EmptyBorder(0, 5, 10, 5));
    add(content, BorderLayout.SOUTH);

    tasks = new HashMap<Integer, TaskPanel>();

    taskContainers = new HashMap<String, TaskContainerPanel>();
    taskContainers.put(TaskPanel.TASK_NEW, new TaskContainerPanel(this, TaskPanel.TASK_NEW, item));
    taskContainers.put(TaskPanel.TASK_IN_PROGRESS,
            new TaskContainerPanel(this, TaskPanel.TASK_IN_PROGRESS, item));
    taskContainers.put(TaskPanel.TASK_COMPLETED, new TaskContainerPanel(this, TaskPanel.TASK_COMPLETED, item));

    taskContent = new JPanel(new GridLayout(1, 3));
    taskContent.add(getTaskContainer(TaskPanel.TASK_NEW));
    taskContent.add(getTaskContainer(TaskPanel.TASK_IN_PROGRESS));
    taskContent.add(getTaskContainer(TaskPanel.TASK_COMPLETED));

    Color gridColor = UIManager.getDefaults().getColor("Table.gridColor");
    taskContent.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 0, gridColor));
    setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, gridColor));

    // we don't use gap in grid layout to avoid trailing line (on the right)
    getTaskContainer(TaskPanel.TASK_IN_PROGRESS)
            .setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, gridColor));
    getTaskContainer(TaskPanel.TASK_COMPLETED)
            .setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, gridColor));

    simpleHighlight = new SimpleHighlight(entityName);

    setPreferredSize(DIMENSION);

    update(item);
}