Example usage for javax.swing JCheckBox setOpaque

List of usage examples for javax.swing JCheckBox setOpaque

Introduction

In this page you can find the example usage for javax.swing JCheckBox setOpaque.

Prototype

@BeanProperty(expert = true, description = "The component's opacity")
public void setOpaque(boolean isOpaque) 

Source Link

Document

If true the component paints every pixel within its bounds.

Usage

From source file:Main.java

public static void main(String[] args) {
    JPanel panel = new JPanel();
    panel.setLayout(new OverlayLayout(panel));

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("1", new JTextField("one"));
    tabbedPane.add("2", new JTextField("two"));
    tabbedPane.setAlignmentX(1.0f);/*from  w  w  w  .j ava2s . c  o m*/
    tabbedPane.setAlignmentY(0.0f);

    JCheckBox checkBox = new JCheckBox("Add tab");
    checkBox.setOpaque(false);
    checkBox.setAlignmentX(1.0f);
    checkBox.setAlignmentY(0.0f);

    panel.add(checkBox);
    panel.add(tabbedPane);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel);
    frame.setSize(400, 100);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JPanel panel = new JPanel();
    panel.setLayout(new OverlayLayout(panel));

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("1", new JTextField("one"));
    tabbedPane.add("2", new JTextField("two"));
    tabbedPane.setAlignmentX(1.0f);//from ww w.  ja  v  a  2 s.  c o m
    tabbedPane.setAlignmentY(0.0f);

    JCheckBox checkBox = new JCheckBox("Check Me");
    checkBox.setOpaque(false);
    checkBox.setAlignmentX(1.0f);
    checkBox.setAlignmentY(0.0f);

    panel.add(checkBox);
    panel.add(tabbedPane);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel);
    frame.setLocationByPlatform(true);
    frame.setSize(400, 100);
    frame.setVisible(true);
}

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

public SummaryDialog(Recurso r) {

    super();/*from w ww .  j a v a2s.  c  o 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.admin.aux1.RecursoDialog.java

public RecursoDialog(final Recurso rec, final AdminResources adminResources) {
    super();// w  w w. j  a v a 2s  .  c o m
    setAlwaysOnTop(true);
    setSize(600, 400);

    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            super.windowClosing(e);
            if (cambios) {
                int res = JOptionPane.showConfirmDialog(RecursoDialog.this,
                        "Existen cambios sin guardar. Seguro que desea cerrar la ventana?",
                        "Cambios sin guardar", JOptionPane.OK_CANCEL_OPTION);
                if (res != JOptionPane.CANCEL_OPTION) {
                    e.getWindow().dispose();
                }
            } else {
                e.getWindow().dispose();
            }
        }
    });
    final Recurso r = (rec == null) ? null : RecursoConsultas.get(rec.getId());
    if (r != null) {
        setTitle(i18n.getString("Resources.summary.titleWindow") + " " + r.getIdentificador());
    } else {
        setTitle(i18n.getString("Resources.summary.titleWindow.new"));
    }
    setIconImage(getBasicWindow().getFrame().getIconImage());
    JPanel base = new JPanel();
    base.setBackground(Color.WHITE);
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

    // Icono del titulo
    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));
    title.setOpaque(false);
    JLabel labelTitulo = null;
    if (r != null) {
        labelTitulo = new JLabel(i18n.getString("Resources.summary"),
                LogicConstants.getIcon("tittleficha_icon_recurso"), JLabel.LEFT);

    } else {
        labelTitulo = new JLabel(i18n.getString("Resources.cabecera.nuevo"),
                LogicConstants.getIcon("tittleficha_icon_recurso"), JLabel.LEFT);

    }
    labelTitulo.setFont(LogicConstants.deriveBoldFont(12f));
    title.add(labelTitulo);
    base.add(title);

    // Nombre
    JPanel mid = new JPanel(new SpringLayout());
    mid.setOpaque(false);
    mid.add(new JLabel(i18n.getString("Resources.name"), JLabel.RIGHT));
    final JTextField name = new JTextField(25);
    if (r != null) {
        name.setText(r.getNombre());
    }

    name.getDocument().addDocumentListener(changeListener);
    name.setEditable(r == null);
    mid.add(name);

    // patrullas
    final JLabel labelSquads = new JLabel(i18n.getString("Resources.squad"), JLabel.RIGHT);
    mid.add(labelSquads);
    List<Patrulla> pl = PatrullaConsultas.getAll();
    pl.add(0, null);
    final JComboBox squads = new JComboBox(pl.toArray());
    squads.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXX");
    squads.addActionListener(changeSelectionListener);
    squads.setOpaque(false);
    labelSquads.setLabelFor(squads);
    if (r != null) {
        squads.setSelectedItem(r.getPatrullas());
    } else {
        squads.setSelectedItem(null);
    }
    squads.setEnabled((r != null && r.getHabilitado() != null) ? r.getHabilitado() : true);
    mid.add(squads);

    // // Identificador
    // mid.setOpaque(false);
    // mid.add(new JLabel(i18n.getString("Resources.identificador"),
    // JLabel.RIGHT));
    // final JTextField identificador = new JTextField("");
    // if (r != null) {
    // identificador.setText(r.getIdentificador());
    // }
    // identificador.getDocument().addDocumentListener(changeListener);
    // identificador.setEditable(r == null);
    // mid.add(identificador);
    // Espacio en blanco
    // mid.add(Box.createHorizontalGlue());
    // mid.add(Box.createHorizontalGlue());

    // Tipo
    final JLabel labelTipoRecursos = new JLabel(i18n.getString("Resources.type"), JLabel.RIGHT);
    mid.add(labelTipoRecursos);
    final JComboBox types = new JComboBox(RecursoConsultas.getTipos());
    labelTipoRecursos.setLabelFor(types);
    types.addActionListener(changeSelectionListener);
    if (r != null) {
        types.setSelectedItem(r.getTipo());
    } else {
        types.setSelectedItem(0);
    }
    // types.setEditable(true);
    types.setEnabled(true);
    mid.add(types);

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

    // Subflota y patrulla
    mid.add(new JLabel(i18n.getString("Resources.subfleet"), JLabel.RIGHT));
    final JComboBox subfleets = new JComboBox(FlotaConsultas.getAllHabilitadas());
    subfleets.addActionListener(changeSelectionListener);
    if (r != null) {
        subfleets.setSelectedItem(r.getFlotas());
    } else {
        subfleets.setSelectedIndex(0);
    }
    subfleets.setEnabled(true);
    subfleets.setOpaque(false);
    mid.add(subfleets);

    // Referencia humana
    mid.add(new JLabel(i18n.getString("Resources.incidences"), JLabel.RIGHT));
    final JTextField rhumana = new JTextField();
    // if (r != null && 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));
    final PlainDocument plainDocument = new PlainDocument() {

        private static final long serialVersionUID = 4929271093724956016L;

        @Override
        public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
            if (this.getLength() + str.length() <= LogicConstants.LONGITUD_ISSI) {
                super.insertString(offs, str, a);
            }
        }
    };
    final JTextField issi = new JTextField(plainDocument, "", LogicConstants.LONGITUD_ISSI);
    plainDocument.addDocumentListener(changeListener);
    issi.setEditable(true);
    mid.add(issi);
    mid.add(new JLabel(i18n.getString("Resources.enabled"), JLabel.RIGHT));
    final JCheckBox enabled = new JCheckBox("", true);
    enabled.addActionListener(changeSelectionListener);
    enabled.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (enabled.isSelected()) {
                squads.setSelectedIndex(0);
            }
            squads.setEnabled(enabled.isSelected());
        }
    });
    enabled.setEnabled(true);
    enabled.setOpaque(false);
    if (r != null) {
        enabled.setSelected(r.getHabilitado());
    } else {
        enabled.setSelected(true);
    }
    if (r != null && r.getDispositivo() != null) {
        issi.setText(
                StringUtils.leftPad(String.valueOf(r.getDispositivo()), LogicConstants.LONGITUD_ISSI, '0'));
    }

    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());

    // informacion adicional
    JPanel infoPanel = new JPanel(new SpringLayout());
    final JTextField info = new JTextField(25);
    info.getDocument().addDocumentListener(changeListener);
    infoPanel.add(new JLabel(i18n.getString("Resources.info")));
    infoPanel.add(info);
    infoPanel.setOpaque(false);
    info.setOpaque(false);
    SpringUtilities.makeCompactGrid(infoPanel, 1, 2, 6, 6, 6, 18);

    if (r != null) {
        info.setText(r.getInfoAdicional());
    } else {
        info.setText("");
    }
    info.setEditable(true);

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

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

    JPanel buttons = new JPanel();
    buttons.setOpaque(false);
    JButton accept = null;
    if (r == null) {
        accept = new JButton("Crear", LogicConstants.getIcon("button_crear"));
    } else {
        accept = new JButton("Guardar", LogicConstants.getIcon("button_save"));
    }
    accept.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                if (cambios || r == null || r.getId() == null) {
                    boolean shithappens = true;
                    if ((r == null || r.getId() == null)) { // Estamos
                        // creando
                        // uno nuevo
                        if (RecursoConsultas.alreadyExists(name.getText())) {
                            shithappens = false;
                            JOptionPane.showMessageDialog(RecursoDialog.this,
                                    i18n.getString("admin.recursos.popup.error.nombreUnico"));
                        } else if (issi.getText() != null && issi.getText().length() > 0 && StringUtils
                                .trimToEmpty(issi.getText()).length() != LogicConstants.LONGITUD_ISSI) {
                            JOptionPane.showMessageDialog(RecursoDialog.this, i18n.getString(Locale.ROOT,
                                    "admin.recursos.popup.error.faltanCifras", LogicConstants.LONGITUD_ISSI));
                            shithappens = false;
                        } else if (issi.getText() != null && issi.getText().length() > 0
                                && LogicConstants.isNumeric(issi.getText())
                                && RecursoConsultas.alreadyExists(new Integer(issi.getText()))) {
                            shithappens = false;
                            JOptionPane.showMessageDialog(RecursoDialog.this,
                                    i18n.getString("admin.recursos.popup.error.dispositivoUnico"));
                        }
                    }
                    if (shithappens) {
                        if (name.getText().isEmpty()) {
                            JOptionPane.showMessageDialog(RecursoDialog.this,
                                    i18n.getString("admin.recursos.popup.error.nombreNulo"));
                        } else if (issi.getText() != null && issi.getText().length() > 0 && StringUtils
                                .trimToEmpty(issi.getText()).length() != LogicConstants.LONGITUD_ISSI) {
                            JOptionPane.showMessageDialog(RecursoDialog.this, i18n.getString(Locale.ROOT,
                                    "admin.recursos.popup.error.faltanCifras", LogicConstants.LONGITUD_ISSI));
                        } else if (issi.getText() != null && issi.getText().length() > 0
                                && LogicConstants.isNumeric(issi.getText()) && r != null && r.getId() != null
                                && RecursoConsultas.alreadyExists(new Integer(issi.getText()), r.getId())) {
                            JOptionPane.showMessageDialog(RecursoDialog.this,
                                    i18n.getString("admin.recursos.popup.error.issiUnico"));
                        } else if (issi.getText() != null && issi.getText().length() > 0
                                && !LogicConstants.isNumeric(issi.getText())) {
                            JOptionPane.showMessageDialog(RecursoDialog.this,
                                    i18n.getString("admin.recursos.popup.error.noNumerico"));
                            // } else if (identificador.getText().isEmpty())
                            // {
                            // JOptionPane
                            // .showMessageDialog(
                            // RecursoDialog.this,
                            // i18n.getString("admin.recursos.popup.error.identificadorNulo"));
                        } else if (subfleets.getSelectedIndex() == -1) {
                            JOptionPane.showMessageDialog(RecursoDialog.this,
                                    i18n.getString("admin.recursos.popup.error.noSubflota"));
                        } else if (types.getSelectedItem() == null
                                || types.getSelectedItem().toString().trim().isEmpty()) {
                            JOptionPane.showMessageDialog(RecursoDialog.this,
                                    i18n.getString("admin.recursos.popup.error.noTipo"));
                        } else {
                            int i = JOptionPane.showConfirmDialog(RecursoDialog.this,
                                    i18n.getString("admin.recursos.popup.dialogo.guardar.titulo"),
                                    i18n.getString("admin.recursos.popup.dialogo.guardar.guardar"),
                                    JOptionPane.YES_NO_CANCEL_OPTION);

                            if (i == JOptionPane.YES_OPTION) {

                                Recurso recurso = r;

                                if (r == null) {
                                    recurso = new Recurso();
                                }

                                recurso.setInfoAdicional(info.getText());
                                if (issi.getText() != null && issi.getText().length() > 0) {
                                    recurso.setDispositivo(new Integer(issi.getText()));
                                } else {
                                    recurso.setDispositivo(null);
                                }
                                recurso.setFlotas(FlotaConsultas.find(subfleets.getSelectedItem().toString()));
                                if (squads.getSelectedItem() != null && enabled.isSelected()) {
                                    recurso.setPatrullas(
                                            PatrullaConsultas.find(squads.getSelectedItem().toString()));
                                } else {
                                    recurso.setPatrullas(null);
                                }
                                recurso.setNombre(name.getText());
                                recurso.setHabilitado(enabled.isSelected());
                                // recurso.setIdentificador(identificador
                                // .getText());
                                recurso.setTipo(types.getSelectedItem().toString());
                                dispose();

                                RecursoAdmin.saveOrUpdate(recurso);
                                adminResources.refresh(null);

                                PluginEventHandler.fireChange(adminResources);
                            } else if (i == JOptionPane.NO_OPTION) {
                                dispose();
                            }
                        }
                    }
                } else {
                    log.debug("No hay cambios");
                    dispose();
                }

            } catch (Throwable t) {
                log.error("Error guardando un recurso", t);
            }
        }
    });
    buttons.add(accept);

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

    cancelar.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (cambios) {
                if (JOptionPane.showConfirmDialog(RecursoDialog.this,
                        "Existen cambios sin guardar. Seguro que desea cerrar la ventana?",
                        "Cambios sin guardar", JOptionPane.OK_CANCEL_OPTION) != JOptionPane.CANCEL_OPTION) {
                    dispose();
                }
            } else {
                dispose();
            }
        }
    });

    buttons.add(cancelar);

    base.add(buttons);

    getContentPane().add(base);
    setLocationRelativeTo(null);
    cambios = false;
    if (r == null) {
        cambios = true;
    }

    pack();

    int x;
    int y;

    Container myParent = getBasicWindow().getPluginContainer().getDetachedTab(0);
    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);
    cambios = false;
}

From source file:net.aepik.alasca.gui.ldap.SchemaObjectEditorFrame.java

/**
 * Build frame./*from ww w  .  j  a  v  a 2  s .  c om*/
 */
private void build() {
    setTitle("Proprits de l'objet " + objetSchema.getId());
    setSize(700, 400);
    setResizable(false);
    setLocationRelativeTo(mainFrame);

    if (mainFrame != null)
        setIconImage(mainFrame.getIconImage());

    // - Panel bouton du bas -

    JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    boutonsPanel.add(boutonOk);
    boutonsPanel.add(boutonAnnuler);

    // - Description -

    JTextArea textAreaValues = new JTextArea("Vous pouvez apporter des modifications sur les paramtres"
            + " de cet objet d'identifiant " + objetSchema.getId() + ". Les"
            + " modifications apportes  des paramtres non-cochs ne" + " seront pas prises en compte.");
    textAreaValues.setEditable(false);
    textAreaValues.setLineWrap(true);
    textAreaValues.setWrapStyleWord(true);
    textAreaValues.setFont((new JLabel()).getFont());
    textAreaValues.setBorder(BorderFactory.createEmptyBorder(7, 8, 7, 8));
    textAreaValues.setBackground((new JLabel()).getBackground());

    // - La table des valeurs -
    // Correction : Tri alphabtique des valeurs

    Enumeration<String> k = values.keys();
    String[] keys = new String[values.size()];

    for (int i = 0; i < keys.length; i++)
        keys[i] = k.nextElement();
    Arrays.sort(keys);

    JPanel colonne1 = new JPanel(new GridLayout(keys.length, 1));
    JPanel colonne2 = new JPanel(new GridLayout(keys.length, 1));

    // Enumeration<JComponent> l = labels.elements();
    // Enumeration<JComponent> v = values.elements();
    // Enumeration<String> k = values.keys();
    // JPanel colonne1 = new JPanel( new GridLayout( values.size(), 1 ) );
    // JPanel colonne2 = new JPanel( new GridLayout( values.size(), 1 ) );

    for (int i = 0; keys != null && i < keys.length; i++) {

        // while( l.hasMoreElements() && v.hasMoreElements() && k.hasMoreElements() ) {

        String key = keys[i];
        JComponent label = labels.get(key);
        JComponent value = values.get(key);
        JCheckBox checkbox = valuesPresent.get(key);

        // String key = k.nextElement();
        // JComponent label = l.nextElement();
        // JComponent value = v.nextElement();
        // JCheckBox checkbox = valuesPresent.get( key );

        if (!value.isEnabled() && value instanceof JTextField) {

            //value.setEnabled( true );

            JButton b = new JButton("...");
            b.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createMatteBorder(0, 5, 0, 0, Color.white), b.getBorder()));
            b.addActionListener(new SchemaValueEditorLauncher(b, (JTextField) value, objetSchema, key));

            JPanel tmp = new JPanel(new BorderLayout());
            tmp.add(value, BorderLayout.CENTER);
            tmp.add(b, BorderLayout.EAST);
            tmp.setOpaque(false);
            value = tmp;
        }

        JPanel panelTmp1 = new JPanel(new BorderLayout());
        panelTmp1.add(checkbox, BorderLayout.WEST);
        panelTmp1.add(label, BorderLayout.CENTER);
        panelTmp1.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 3));
        colonne1.add(panelTmp1);

        JPanel panelTmp2 = new JPanel(new BorderLayout());
        panelTmp2.add(value, BorderLayout.CENTER);
        panelTmp2.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3));
        colonne2.add(panelTmp2);

        checkbox.setOpaque(false);
        label.setOpaque(false);
        value.setOpaque(false);
        panelTmp1.setOpaque(false);
        panelTmp2.setOpaque(false);
    }

    JPanel tablePanel = new JPanel(new BorderLayout());
    tablePanel.add(colonne1, BorderLayout.WEST);
    tablePanel.add(colonne2, BorderLayout.EAST);
    tablePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    colonne1.setOpaque(false);
    colonne2.setOpaque(false);
    tablePanel.setOpaque(false);

    JPanel tablePanelContainer = new JPanel(new BorderLayout());
    tablePanelContainer.add(tablePanel, BorderLayout.NORTH);
    tablePanelContainer.setBackground(Color.white);

    JList tmpForBorderList = new JList();
    JScrollPane tmpForBorderScroller = new JScrollPane(tmpForBorderList);

    JScrollPane tableScroller = new JScrollPane(tablePanelContainer);
    //tableScroller.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
    tableScroller.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 6, 1, 6),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Listes des paramtres "),
                    BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5),
                            tmpForBorderScroller.getBorder()))));

    // - Organisation gnrale -

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(textAreaValues, BorderLayout.NORTH);
    mainPanel.add(tableScroller, BorderLayout.CENTER);

    JPanel mainPanelContainer = new JPanel(new BorderLayout());
    mainPanelContainer.add(mainPanel, BorderLayout.CENTER);
    mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH);
    mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1));

    getContentPane().add(mainPanelContainer);

    // - Listeners -

    addWindowListener(this);
    boutonOk.addActionListener(this);
    boutonAnnuler.addActionListener(this);
}

From source file:ome.formats.importer.gui.GuiCommonElements.java

/**
 * Add a check box (with label) to parent container 
 * //from   w  ww  . j ava2 s  . co m
 * @param container - parent container
 * @param label - check box label
 * @param placement - TableLayout placement in parent container
 * @param debug - turn on/off red debug borders
 * @return JCheckBox
 */
public static JCheckBox addCheckBox(Container container, String label, String placement, boolean debug) {
    JCheckBox checkBox = new JCheckBox(label);
    container.add(checkBox, placement);
    checkBox.setOpaque(false);
    return checkBox;
}

From source file:org.ut.biolab.medsavant.client.variant.ImportVariantsWizard.java

private AbstractWizardPage getChooseFilesPage() {
    //setup page/*from  w w  w. ja v  a  2 s  . c  o m*/
    final DefaultWizardPage page = new DefaultWizardPage("Choose Files") {
        @Override
        public void setupWizardButtons() {
            fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH);
            fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK);

            if (uploadRequired) {
                if (variantFiles != null && variantFiles.length > 0) {
                    fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
                } else {
                    fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
                }
            } else {
                if (serverPathField.getText().isEmpty()) {
                    fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
                } else {
                    fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
                }
            }
        }
    };

    chooseContainer = new JPanel();
    chooseContainer = new JPanel();
    chooseContainer.setLayout(new BorderLayout());
    chooseTitleLabel = new JLabel();
    filesOnMyComputerPanel = populateOnMyComputerPanel(page);// populateRepositoryPanel();
    filesOnMedSavantServerPanel = populateOnServerPanel(page); //populateLocalPanel();

    page.addComponent(chooseTitleLabel);
    page.addComponent(chooseContainer);

    page.addComponent(
            new JLabel("Files can be in Variant Call Format (*.vcf) or BGZipped\nVCF (*.vcf.gz).\n\n"));

    final JCheckBox homoRefBox = new JCheckBox("Include HomoRef variants (strongly discouraged)");
    homoRefBox.setOpaque(false);
    homoRefBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            includeHomoRef = homoRefBox.isSelected();
        }
    });
    page.addComponent(homoRefBox);

    setUploadRequired(true);

    return page;

}

From source file:storybook.model.EntityUtil.java

public static List<JCheckBox> createCategoryCheckBoxes(MainFrame mainFrame, ActionListener comp) {
    List<JCheckBox> list = new ArrayList<>();
    BookModel model = mainFrame.getBookModel();
    Session session = model.beginTransaction();
    CategoryDAOImpl dao = new CategoryDAOImpl(session);
    List<Category> categories = dao.findAllOrderBySort();
    model.commit();//from   w  ww.  j  a  va  2  s . c  o  m
    for (Category category : categories) {
        JCheckBox cb = new JCheckBox(category.getName());
        cb.putClientProperty(SbConstants.ComponentName.CB_CATEGORY, category);
        cb.setOpaque(false);
        cb.addActionListener(comp);
        cb.setSelected(true);
        list.add(cb);
    }
    return list;
}

From source file:storybook.model.EntityUtil.java

public static List<JCheckBox> createCountryCheckBoxes(MainFrame mainFrame, ActionListener comp) {
    List<JCheckBox> list = new ArrayList<>();
    BookModel model = mainFrame.getBookModel();
    Session session = model.beginTransaction();
    LocationDAOImpl dao = new LocationDAOImpl(session);
    List<String> countries = dao.findCountries();
    model.commit();//from  ww w  .ja  v a 2 s. c  o  m
    for (String country : countries) {
        JCheckBox chb = new JCheckBox(country);
        chb.setOpaque(false);
        chb.addActionListener(comp);
        chb.setSelected(true);
        list.add(chb);
    }
    return list;
}

From source file:storybook.model.EntityUtil.java

public static List<JCheckBox> createPersonCheckBoxes(MainFrame mainFrame, List<JCheckBox> cbl,
        ActionListener comp) {/* w ww.  j  av  a2s  .  c o m*/
    List<JCheckBox> list = new ArrayList<>();
    BookModel model = mainFrame.getBookModel();
    Session session = model.beginTransaction();
    PersonDAOImpl dao = new PersonDAOImpl(session);
    for (JCheckBox cb : cbl) {
        if (cb.isSelected()) {
            Category category = (Category) cb.getClientProperty(SbConstants.ComponentName.CB_CATEGORY);
            List<Person> persons = dao.findByCategory(category);
            for (Person person : persons) {
                JCheckBox cbPerson = new JCheckBox(person.getFullNameAbbr());
                cbPerson.setOpaque(false);
                cbPerson.putClientProperty(SbConstants.ComponentName.CB_PERSON, person);
                cbPerson.addActionListener(comp);
                list.add(cbPerson);
            }
        }
    }
    model.commit();
    return list;
}