Example usage for java.awt FlowLayout FlowLayout

List of usage examples for java.awt FlowLayout FlowLayout

Introduction

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

Prototype

public FlowLayout(int align) 

Source Link

Document

Constructs a new FlowLayout with the specified alignment and a default 5-unit horizontal and vertical gap.

Usage

From source file:BlendCompositeDemo.java

public BlendCompositeDemo() {
    super("Blend Composites");

    compositeTestPanel = new CompositeTestPanel();
    compositeTestPanel.setComposite(BlendComposite.Average);
    add(compositeTestPanel);//from  w w  w  .  j  a  v a  2 s  . c o  m

    combo = new JComboBox(BlendComposite.BlendingMode.values());
    combo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            compositeTestPanel.setComposite(BlendComposite.getInstance(
                    BlendComposite.BlendingMode.valueOf(combo.getSelectedItem().toString()),
                    slider.getValue() / 100.0f));
        }
    });

    slider = new JSlider(0, 100, 100);
    slider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            BlendComposite blend = (BlendComposite) compositeTestPanel.getComposite();
            blend = blend.derive(slider.getValue() / 100.0f);
            compositeTestPanel.setComposite(blend);
        }
    });

    JPanel controls = new JPanel(new FlowLayout(FlowLayout.LEFT));
    controls.add(combo);
    controls.add(new JLabel("0%"));
    controls.add(slider);
    controls.add(new JLabel("100%"));
    add(controls, BorderLayout.SOUTH);

    pack();
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:com.okmich.twitanalysis.gui.ApplicationFrame.java

private void setChartPanel(JPanel jpanel) {
    this.negativeSeries = new TimeSeries("Negative", Millisecond.class);
    this.postiveSeries = new TimeSeries("Positive", Millisecond.class);
    this.neutralSeries = new TimeSeries("Neutral", Millisecond.class);
    final TimeSeriesCollection dataset = new TimeSeriesCollection(this.negativeSeries);
    dataset.addSeries(this.postiveSeries);
    dataset.addSeries(this.neutralSeries);
    final JFreeChart chart = createChart(dataset);
    chart.getXYPlot().getRenderer(0).setSeriesPaint(0, Color.RED);
    chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(2.0f));
    chart.getXYPlot().getRenderer(0).setSeriesPaint(1, Color.GREEN);
    chart.getXYPlot().getRenderer(0).setSeriesStroke(1, new BasicStroke(2.0f));
    chart.getXYPlot().getRenderer(0).setSeriesPaint(2, Color.GRAY);
    chart.getXYPlot().getRenderer(0).setSeriesStroke(2, new BasicStroke(2.0f));
    chart.getPlot().setBackgroundPaint(Color.BLACK);

    final ChartPanel chartPanel = new ChartPanel(chart);

    final JPanel tweetCountPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));

    tweetCountLabel = new JLabel();
    setTweetCountLabel();/*from w w  w .  ja v  a  2 s  .c  om*/
    tweetCountPanel.add(tweetCountLabel);

    jpanel.setLayout(new BorderLayout(10, 10));
    jpanel.add(chartPanel, BorderLayout.CENTER);
    jpanel.add(tweetCountPanel, BorderLayout.SOUTH);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(jpanel);
}

From source file:net.sf.firemox.ui.wizard.Wizard.java

/**
 * Create a new instance of this class./* www.  j  a v a 2 s. c  o m*/
 * 
 * @param ability
 *          ability to associate to this ability. If this ability has an
 *          associated picture, it will be used instead of given picture.
 *          Ability's name is also used to fill the title. This ability will
 *          be used to restart this wizard in case of Background button is
 *          used.
 * @param title
 *          the title of this wizard.
 * @param description
 *          the description appended to the title of this wizard. This content
 *          will be displayed as Html.
 * @param iconName
 *          the icon's name to display on the top right place.
 * @param width
 *          the preferred width.
 * @param height
 *          the preferred height.
 */
public Wizard(Ability ability, String title, String description, String iconName, int width, int height) {
    super(MagicUIComponents.magicForm, StringUtils.capitalize(title), true);
    getRootPane().setPreferredSize(new Dimension(width, 300));
    getRootPane().setMinimumSize(new Dimension(width, height));
    setSize(new Dimension(width, height));

    // center
    gameParamPanel = new JPanel(null);
    gameParamPanel.setLayout(new BoxLayout(gameParamPanel, BoxLayout.Y_AXIS));
    if (ability == null)
        getContentPane().add(new WizardTitle(new WizardImageIcon((Image) null, iconName), description),
                BorderLayout.NORTH);
    else
        getContentPane().add(new WizardTitle(new WizardImageIcon(ability.getCard(), iconName), description),
                BorderLayout.NORTH);
    getContentPane().add(gameParamPanel, BorderLayout.CENTER);
    getContentPane().add(new JPanel(), BorderLayout.EAST);

    // bottom
    final JPanel abstractButtonPanel = new JPanel(new BorderLayout());
    this.buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    this.ability = ability;
    abstractButtonPanel.setBorder(null);
    abstractButtonPanel.add(new JSeparator(), BorderLayout.NORTH);
    abstractButtonPanel.add(buttonPanel, BorderLayout.CENTER);
    abstractButtonPanel.add(wizardInfo, BorderLayout.SOUTH);
    getContentPane().add(abstractButtonPanel, BorderLayout.SOUTH);
    setLocationRelativeTo(null);
}

From source file:ErroresPorTraza.TabbedForm.java

private void setChartPorcentaje(int tt) {
    ErrorPorcentajePie aceptrech = new ErrorPorcentajePie();
    ChartPanel chartpanel1 = aceptrech.getChartPanel("Porcentaje de errores", jTable1, tt);
    jPanelPorcentaje.removeAll();//  www  .  java  2  s . c  o m
    jPanelPorcentaje.setLayout(new FlowLayout(FlowLayout.LEFT));
    jPanelPorcentaje.add(chartpanel1);
    this.setLocationRelativeTo(null);
}

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

public SummaryDialog(Recurso r) {

    super();/*w  w  w.j  av a 2  s  .co  m*/
    r = (r == null) ? null : RecursoConsultas.getByIdentificador(r.getIdentificador());
    setAlwaysOnTop(true);
    setResizable(false);
    setName(r.getIdentificador());
    setBackground(Color.WHITE);
    setSize(600, 400);
    setTitle(i18n.getString("Resources.summary.titleWindow") + " " + r.getIdentificador());
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }
    JPanel base = new JPanel();
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));
    base.setBackground(Color.WHITE);

    r = RecursoConsultas.getByIdentificador(r.getIdentificador());

    // Icono del titulo
    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));

    final JLabel labelTitle = new JLabel(i18n.getString("Resources.summary.title") + " " + r.getIdentificador(),
            LogicConstants.getIcon("tittleficha_icon_recurso"), JLabel.LEFT);
    labelTitle.setFont(LogicConstants.deriveBoldFont(12f));

    title.setBackground(Color.WHITE);

    title.add(labelTitle);

    base.add(title);

    // Nombre
    JPanel mid = new JPanel(new SpringLayout());
    mid.setBackground(Color.WHITE);
    mid.add(new JLabel(i18n.getString("Resources.name"), JLabel.RIGHT));
    JTextField name = new JTextField(25);
    if (r != null)
        name.setText(r.getIdentificador());
    name.setEditable(false);
    mid.add(name);
    // Patrulla
    mid.add(new JLabel(i18n.getString("Resources.squad"), JLabel.RIGHT));
    // JComboBox squads = new
    // JComboBox(PatrullaConsultas.getAll().toArray());
    JTextField squads = new JTextField(r.getPatrullas() == null ? null : r.getPatrullas().getNombre());
    // squads.setSelectedItem(r.getPatrullas());
    squads.setEditable(false);
    squads.setColumns(21);
    // squads.setEnabled(false);
    mid.add(squads);

    // Tipo
    mid.add(new JLabel(i18n.getString("Resources.type"), JLabel.RIGHT));
    JTextField types = new JTextField(r.getTipo());
    types.setEditable(false);
    mid.add(types);

    // Estado Eurocop
    mid.add(new JLabel(i18n.getString("Resources.status"), JLabel.RIGHT));
    JTextField status = new JTextField();
    if (r.getEstadoEurocop() != null)
        status.setText(r.getEstadoEurocop().getIdentificador());
    status.setEditable(false);
    mid.add(status);

    // Subflota
    mid.add(new JLabel(i18n.getString("Resources.subfleet"), JLabel.RIGHT));
    JTextField subfleets = new JTextField(r.getFlotas() == null ? null : r.getFlotas().getNombre());
    subfleets.setEditable(false);
    mid.add(subfleets);

    // Referencia Humana
    mid.add(new JLabel(i18n.getString("Resources.incidences"), JLabel.RIGHT));
    JTextField rHumana = new JTextField();
    // if (r.getIncidencias() != null)
    // rHumana.setText(r.getIncidencias().getReferenciaHumana());
    rHumana.setEditable(false);
    mid.add(rHumana);
    // dispositivo
    mid.add(new JLabel(i18n.getString("Resources.device"), JLabel.RIGHT));
    JTextField issi = new JTextField();
    issi.setEditable(false);
    mid.add(issi);
    mid.add(new JLabel(i18n.getString("Resources.enabled"), JLabel.RIGHT));
    JCheckBox enabled = new JCheckBox("", true);
    enabled.setEnabled(false);
    enabled.setOpaque(false);
    if (r.getDispositivo() != null) {
        final String valueOf = String.valueOf(r.getDispositivo());
        try {
            issi.setText(String.format(FORMAT, r.getDispositivo()));
        } catch (Throwable t) {
            issi.setText(valueOf);
        }
        enabled.setSelected(r.getHabilitado());
    }
    mid.add(enabled);

    // Fecha ultimo gps
    mid.add(new JLabel(i18n.getString("Resources.lastPosition"), JLabel.RIGHT));
    JTextField lastGPS = new JTextField();

    final Date lastGPSDateForRecurso = HistoricoGPSConsultas.lastGPSDateForRecurso(r);
    if (lastGPSDateForRecurso != null) {
        lastGPS.setText(SimpleDateFormat.getDateTimeInstance().format(lastGPSDateForRecurso));
    }
    lastGPS.setEditable(false);
    mid.add(lastGPS);

    // Espacio en blanco
    mid.add(Box.createHorizontalGlue());
    mid.add(Box.createHorizontalGlue());

    // Espacio en blanco
    mid.add(Box.createHorizontalGlue());
    mid.add(Box.createHorizontalGlue());

    SpringUtilities.makeCompactGrid(mid, 5, 4, 6, 6, 6, 18);
    base.add(mid);

    // informacion adicional
    JPanel infoPanel = new JPanel(new SpringLayout());
    JTextField info = new JTextField(25);
    info.setText(r.getInfoAdicional());
    info.setEditable(false);
    infoPanel.setOpaque(false);
    infoPanel.add(new JLabel(i18n.getString("Resources.info")));
    infoPanel.add(info);
    SpringUtilities.makeCompactGrid(infoPanel, 1, 2, 6, 6, 6, 18);
    base.add(infoPanel);

    JPanel buttons = new JPanel();

    buttons.setBackground(Color.WHITE);
    JButton accept = new JButton(i18n.getString("Buttons.ok"), LogicConstants.getIcon("button_accept"));

    accept.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    buttons.add(accept);
    base.add(buttons);

    getContentPane().add(base);
    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);
    }
}

From source file:es.emergya.ui.plugins.forms.FormGeneric.java

protected void generateTitle() {
    title = new JPanel(new FlowLayout(FlowLayout.LEADING));
    final JLabel labelTitle = new JLabel(this.getTitle(), this.getIcon(), JLabel.LEFT);
    labelTitle.setFont(LogicConstants.deriveBoldFont(12f));
    title.setBackground(Color.WHITE);
    title.add(labelTitle);//  w  w w. j a v  a  2  s.  c  om
}

From source file:org.uncommons.watchmaker.swing.evolutionmonitor.PopulationFitnessView.java

/**
 * Creates the GUI controls for toggling graph display options.
 * @return A component that can be added to the main panel.
 *//*from w  ww  .  jav a  2s  .  c o m*/
private JComponent createControls(boolean islands) {
    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    allDataButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
            updateDomainAxisRange();
        }
    });
    String text = "Last " + SHOW_FIXED_GENERATIONS + (islands ? " Epochs" : " Generations");
    JRadioButton recentDataButton = new JRadioButton(text, true);
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(allDataButton);
    buttonGroup.add(recentDataButton);

    controls.add(allDataButton);
    controls.add(recentDataButton);

    final JCheckBox meanCheckBox = new JCheckBox("Show Mean", true);
    meanCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent itemEvent) {
            if (itemEvent.getStateChange() == ItemEvent.SELECTED) {
                dataSet.addSeries(meanSeries);
            } else {
                dataSet.removeSeries(meanSeries);
            }
        }
    });
    controls.add(meanCheckBox);

    invertCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent itemEvent) {
            rangeAxis.setInverted(invertCheckBox.isSelected());
        }
    });
    controls.add(invertCheckBox);

    return controls;
}

From source file:org.uncommons.watchmaker.swing.evolutionmonitor.IslandsView.java

/**
 * Creates the GUI controls for toggling graph display options.
 * @return A component that can be added to the main panel.
 *///from w w w.j av  a  2  s.  co  m
private JComponent createControls() {
    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    final JCheckBox meanCheckBox = new JCheckBox("Show Mean and Standard Deviation", false);
    meanCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent itemEvent) {
            chart.setNotify(false);
            CategoryPlot plot = (CategoryPlot) chart.getPlot();
            if (itemEvent.getStateChange() == ItemEvent.SELECTED) {
                plot.setDataset(1, meanDataSet);
                plot.setRenderer(1, meanRenderer);
            } else {
                plot.setDataset(1, null);
                plot.setRenderer(1, null);
            }
            chart.setNotify(true);
        }
    });
    controls.add(meanCheckBox);

    return controls;
}

From source file:com.emental.mindraider.ui.dialogs.ConnectUriqaServerJDialog.java

/**
 * Constructor./*  w  ww  . j  a v a 2 s .co  m*/
 */
public ConnectUriqaServerJDialog() {
    super(Messages.getString("ConnectUriqaServerJDialog.title"));
    getContentPane().setLayout(new BorderLayout());

    // north
    JPanel north = new JPanel();
    north.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.serverUrl")));

    uriqaServerUrl = new JTextField("http://sw.nokia.com/uriqa/", 31);
    uriqaServerUrl.setMinimumSize(new Dimension(TEXT_AREAS_WIDTH, uriqaServerUrl.getPreferredSize().height));
    uriqaServerUrl.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
                connect();
            }
        }

        public void keyReleased(KeyEvent keyEvent) {
        }

        public void keyTyped(KeyEvent keyEvent) {
        }
    });
    north.add(uriqaServerUrl);
    getContentPane().add(north, BorderLayout.NORTH);

    // center
    JPanel center = new JPanel();
    center.setLayout(new BorderLayout());

    JPanel centerTop = new JPanel();
    centerTop.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.resource")));
    String[] knowUriqaUris = new String[] { "http://sw.nokia.com/VOC-1/term", "http://sw.nokia.com/MARS-3/Rank",
            "http://sw.nokia.com/MARS-3", "http://sw.nokia.com/schemas/nokia/MARS-3.1.rdf" };
    resourceUri = new JComboBox(knowUriqaUris);
    resourceUri.setMinimumSize(new Dimension(TEXT_AREAS_WIDTH, resourceUri.getPreferredSize().height));
    resourceUri.setEditable(true);
    centerTop.add(resourceUri);

    JPanel centerCenter = new JPanel();
    centerCenter.setLayout(new FlowLayout(FlowLayout.LEFT));
    centerCenter.setToolTipText(Messages.getString("ConnectUriqaServerJDialog.loadOverToolTip"));
    centerCenter.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.loadOver")));
    JCheckBox loadOver = new JCheckBox();
    loadOver.setSelected(true);
    loadOver.setEnabled(false);
    centerCenter.add(loadOver);

    JPanel centerBottom = new JPanel();
    centerBottom.setLayout(new FlowLayout(FlowLayout.LEFT));
    centerBottom.setToolTipText(Messages.getString("ConnectUriqaServerJDialog.addInferedToolTip"));
    centerBottom.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.addInfered")));
    addInfered = new JCheckBox();
    addInfered.setSelected(true);
    centerBottom.add(addInfered);

    center.add(centerTop, BorderLayout.NORTH);
    center.add(centerCenter, BorderLayout.CENTER);
    center.add(centerBottom, BorderLayout.SOUTH);
    getContentPane().add(center, BorderLayout.CENTER);

    // south
    JPanel south = new JPanel();
    JButton uploadButton = new JButton(Messages.getString("ConnectUriqaServerJDialog.connect"));
    uploadButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            connect();
        }
    });
    south.add(uploadButton);

    JButton cancelButton = new JButton(Messages.getString("ConnectUriqaServerJDialog.cancel"));
    cancelButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    south.add(cancelButton);
    getContentPane().add(south, BorderLayout.SOUTH);

    // show
    pack();
    Gfx.centerAndShowWindow(this);
}

From source file:com.emental.mindraider.ui.dialogs.AttachmentJDialog.java

/**
 * Concetructor.//from www .j  a  va  2 s. c  o m
 * 
 * @param noteResource
 *            The concept resource.
 * @param dragAndDropReference
 *            The drag'n'drop reference.
 */
public AttachmentJDialog(ConceptResource conceptResource, DragAndDropReference dragAndDropReference) {

    super(Messages.getString("AttachmentJDialog.title"));
    this.conceptResource = conceptResource;
    getContentPane().setLayout(new BorderLayout());
    JPanel p, pp;

    p = new JPanel();
    p.setLayout(new BorderLayout());
    JLabel intro = new JLabel("<html>&nbsp;&nbsp;" + Messages.getString("AttachmentJDialog.introduction")
            + "&nbsp;&nbsp;<br><br></html>");
    p.add(intro, BorderLayout.NORTH);
    p.add(new JLabel("<html>&nbsp;&nbsp;" + Messages.getString("AttachmentJDialog.description") + "</html>"),
            BorderLayout.CENTER);
    description = new JTextField(38);
    pp = new JPanel(new FlowLayout(FlowLayout.LEFT));
    pp.add(description);
    p.add(pp, BorderLayout.SOUTH);
    getContentPane().add(p, BorderLayout.NORTH);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.setBorder(new TitledBorder(Messages.getString("AttachmentJDialog.resource")));

    ButtonGroup attachType = new ButtonGroup();

    JPanel webPanel = new JPanel();
    webPanel.setLayout(new BorderLayout());
    webType = new JRadioButton(Messages.getString("AttachmentJDialog.web"));
    webType.setActionCommand(WEB);
    webType.addActionListener(this);
    webType.setSelected(true);
    attachType.add(webType);
    webPanel.add(webType, BorderLayout.NORTH);
    urlTextField = new JTextField("http://", 35);
    urlTextField.selectAll();
    urlTextField.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
                attach();
            }
        }

        public void keyReleased(KeyEvent keyEvent) {
        }

        public void keyTyped(KeyEvent keyEvent) {
        }
    });
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));
    p.add(new JLabel("   "));
    p.add(urlTextField);
    webPanel.add(p, BorderLayout.SOUTH);
    mainPanel.add(webPanel, BorderLayout.NORTH);

    JPanel localPanel = new JPanel();
    localPanel.setLayout(new BorderLayout());
    JRadioButton localType = new JRadioButton(Messages.getString("AttachmentJDialog.local"));
    localType.setActionCommand(LOCAL);
    localType.addActionListener(this);
    localPanel.add(localType, BorderLayout.NORTH);
    pathTextField = new JTextField(35);
    pathTextField.setEnabled(false);
    browseButton = new JButton(Messages.getString("AttachmentJDialog.browse"));
    browseButton.setToolTipText(Messages.getString("AttachmentJDialog.browseTip"));
    browseButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            fc.setApproveButtonText(Messages.getString("AttachmentJDialog.attach"));
            fc.setControlButtonsAreShown(true);
            fc.setDialogTitle(Messages.getString("AttachmentJDialog.chooseAttachment"));
            fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            int returnVal = fc.showOpenDialog(AttachmentJDialog.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                pathTextField.setText(file.toString());
            }
        }
    });
    browseButton.setEnabled(false);
    pp = new JPanel();
    pp.setLayout(new BorderLayout());
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.LEFT));
    p.add(new JLabel("   "));
    pp.add(p, BorderLayout.NORTH);
    p.add(pathTextField);
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p.add(browseButton);
    pp.add(p, BorderLayout.SOUTH);
    localPanel.add(pp, BorderLayout.SOUTH);
    attachType.add(localType);
    mainPanel.add(localPanel, BorderLayout.SOUTH);

    getContentPane().add(mainPanel, BorderLayout.CENTER);

    // buttons
    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER));
    JButton addButton = new JButton(Messages.getString("AttachmentJDialog.attach"));

    p.add(addButton);
    addButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            attach();
        }
    });
    JButton cancelButton = new JButton(Messages.getString("AttachmentJDialog.cancel"));
    p.add(cancelButton);
    cancelButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            AttachmentJDialog.this.dispose();
        }
    });
    getContentPane().add(p, BorderLayout.SOUTH);

    /*
     * drag and drop initialization
     */
    if (dragAndDropReference != null) {
        if (dragAndDropReference.getType() == DragAndDropReference.BROWSER_LINK) {
            urlTextField.setText(dragAndDropReference.getReference());
            localType.setSelected(false);
            webType.setSelected(true);
            enableWebTypeButtons();
        } else {
            pathTextField.setText(dragAndDropReference.getReference());
            localType.setSelected(true);
            webType.setSelected(false);
            enableLocalTypeButtons();
        }
        description.setText(dragAndDropReference.getTitle());
    }

    pack();
    Gfx.centerAndShowWindow(this);
}