Example usage for javax.swing JTextField setText

List of usage examples for javax.swing JTextField setText

Introduction

In this page you can find the example usage for javax.swing JTextField setText.

Prototype

@BeanProperty(bound = false, description = "the text of this component")
public void setText(String t) 

Source Link

Document

Sets the text of this TextComponent to the specified text.

Usage

From source file:cool.pandora.modeller.ui.jpanel.text.CreateWordsFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*  ww w.j  a v a2 s .  c om*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateWordsFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Words in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = CreateWordsHandler.getWordContainerURI(map);
    try {
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

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

public SummaryDialog(Recurso r) {

    super();/* w  w  w. j a v  a  2 s  .  com*/
    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:cool.pandora.modeller.ui.jpanel.text.CreateLinesFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();//from w  ww  . j a va  2 s .c o  m
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateLinesFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Lines in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getLineContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.CreatePagesFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();//from ww  w  . j a va2  s  .  com
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreatePagesFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Pages in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getPageContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.PatchAreasFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from w  w w  .ja  v  a 2s.  com*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchAreasFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Areas in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getAreaContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.PatchLinesFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from  w ww.  j ava  2  s  .c om*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchLinesFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Lines in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getLineContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.PatchPagesFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from w ww.ja v  a 2s  .c  o m*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchPagesFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Pages in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getPageContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.PatchWordsFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();//from w w w.j  ava2s . c  om
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchWordsFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Words in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getWordContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:org.cds06.speleograph.graph.ValueAxisEditor.java

/**
 * {@inheritDoc}//from www  . j  av a 2 s.  c  o m
 */
@Override
protected void setup() {
    PanelBuilder builder = new PanelBuilder(getFormLayout(), getPanel());
    CellConstraints cc = new CellConstraints();

    Dimension d = maxModifier.getPreferredSize();
    maxModifier.setPreferredSize(new Dimension(d.width + 50, d.height));
    d = minModifier.getPreferredSize();
    minModifier.setPreferredSize(new Dimension(d.width + 50, d.height));

    {
        builder.add(new JLabel("Titre de l'axe :"));
        final JTextField axisTitleField = new JTextField();
        axisTitleField.setText(axis.getLabel());
        builder.nextColumn(2);
        builder.add(axisTitleField, cc.xyw(3, 1, 5));
        addListenerOnSuccess(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                String text = axisTitleField.getText();
                if (text != null && !text.equals(""))
                    axis.setLabel(axisTitleField.getText());
            }
        });
    }

    {
        builder.nextLine(2);
        builder.add(new JLabel("Valeur min. :"));
        builder.nextColumn(2);
        builder.add(lowField);
        addListenerOnSuccess(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    Double value = Double.valueOf(lowField.getText());
                    if (isApply) {
                        axis.setLowerBound(value);
                    } else if (isCancel && oldLowValue != null)
                        axis.setLowerBound(oldLowValue);
                } catch (NumberFormatException e1) {
                    canClose = false;
                    JOptionPane.showMessageDialog(ValueAxisEditor.this.getParent(),
                            "'" + lowField.getText() + "' n'est pas un nombre", "Erreur",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        });
        builder.nextColumn(2);
        builder.add(new JLabel("+"));
        builder.nextColumn(2);
        builder.add(minModifier);
    }

    {
        builder.nextLine(2);
        builder.add(new JLabel("Valeur max. :"));
        builder.nextColumn(2);
        builder.add(maxField);
        addListenerOnSuccess(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    Double value = Double.valueOf(maxField.getText());
                    if (isApply) {
                        axis.setUpperBound(value);
                    } else if (isCancel && oldHighValue != null)
                        axis.setUpperBound(oldHighValue);
                } catch (NumberFormatException e1) {
                    canClose = false;
                    JOptionPane.showMessageDialog(ValueAxisEditor.this.getParent(),
                            "'" + maxField.getText() + "' n'est pas un nombre", "Erreur",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        });
        builder.nextColumn(2);
        builder.add(new JLabel("+"));
        builder.nextColumn(2);
        builder.add(maxModifier);
    }

    {
        builder.nextLine(2);
        builder.add(new JLabel("<HTML><strong>Sries associes  l'axe</strong></HTML>"), cc.xyw(1, 7, 3));
        String linkedSeries = "<html><ul>";
        for (Series series : Series.getInstances()) {
            if (series.getAxis().equals(axis))
                linkedSeries += "<li>" + series.toString(true) + "</li>";
        }
        linkedSeries += "</ul></html>";

        builder.add(new JLabel(linkedSeries), cc.xyw(1, 8, 3));
    }

    JPanel buttonPanel = new JPanel();
    ButtonBarBuilder buttonBuilder = new ButtonBarBuilder(buttonPanel);
    buttonBuilder.addGlue();
    {
        buttonBuilder.addButton(new AbstractAction() {

            {
                putValue(NAME, I18nSupport.translate("cancel"));
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                isCancel = true;
                isApply = false;
                canClose = true;
                validateForm();
            }
        });
    }

    {
        buttonBuilder.addButton(new AbstractAction() {

            {
                putValue(NAME, I18nSupport.translate("apply"));
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                isCancel = false;
                isApply = true;
                canClose = false;
                validateForm();
            }
        });
    }

    {
        buttonBuilder.addButton(new AbstractAction() {

            {
                putValue(NAME, I18nSupport.translate("ok"));
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                isCancel = false;
                isApply = true;
                canClose = true;
                validateForm();
            }
        });
    }

    buttonBuilder.build();
    buttonPanel.setVisible(true);
    builder.add(buttonBuilder.getPanel(), cc.xyw(1, 10, 10));

    {
        translateSlider.setToolTipText("Translation des axes");
        translateSlider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                int maxValue = -translateSlider.getValue();
                maxModifier.setText(String.valueOf(maxValue));
                int lowValue = -translateSlider.getValue();
                minModifier.setText(String.valueOf(lowValue));
            }
        });
        builder.add(translateSlider, cc.xywh(9, 1, 1, 8));
    }
    {
        homotSlider.setToolTipText("Homothtie sur les axes");
        homotSlider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                int maxValue = -homotSlider.getValue();
                maxModifier.setText(String.valueOf(maxValue));
                int lowValue = homotSlider.getValue();
                minModifier.setText(String.valueOf(lowValue));
            }
        });
        builder.add(homotSlider, cc.xywh(10, 1, 1, 8));
    }

    builder.build();

    getPanel().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    addListenerOnSuccess(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (canClose)
                setVisible(false);
        }
    });
}

From source file:com.eviware.soapui.support.editor.inspectors.auth.ExpirationTimeChooser.java

private JTextField createTimeTextField(boolean enableManualTimeControls) {
    JTextField timeTextField = new JTextField(5);
    timeTextField.setName(TIME_FIELD_NAME);
    timeTextField.setHorizontalAlignment(JTextField.RIGHT);

    timeTextField.setEnabled(enableManualTimeControls);

    String manualAccessTokenExpirationTime = profile.getManualAccessTokenExpirationTime();
    if (manualAccessTokenExpirationTime == null) {
        timeTextField.setText("");
    } else {/*from w w w  .j av  a 2 s.  c  o m*/
        timeTextField.setText(manualAccessTokenExpirationTime);
    }
    return timeTextField;
}