Example usage for java.awt GridBagConstraints NORTHWEST

List of usage examples for java.awt GridBagConstraints NORTHWEST

Introduction

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

Prototype

int NORTHWEST

To view the source code for java.awt GridBagConstraints NORTHWEST.

Click Source Link

Document

Put the component at the top-left corner of its display area.

Usage

From source file:Citas.FrameCita.java

public FrameCita()
        throws ClientProtocolException, IOException, JSONException, ParseException, java.text.ParseException {

    initComponents();/*ww  w  .ja  v  a 2s  .  c  om*/
    this.getContentPane().setLayout(new GridBagLayout());
    rutasLeer = new Leer();
    rutasAdd = new Add();
    medico = new Medico(2, 0, 3, 30); //MEDICO EN SESIOOON
    citas = new Citas[medico.cantidadDeCitasxDia(10, 30)];

    try {
        font = Font.createFont(Font.TRUETYPE_FONT, new File("Sertig.otf"));
        font = font.deriveFont(Font.BOLD, 11);
    } catch (FontFormatException ex) {
        Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex);
    }

    setTitle("Citas");

    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weightx = 0.5;
    gbc.weighty = 0.5;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.BOTH;
    this.getContentPane().add(PanelCalendar, gbc);
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weightx = 0.5;
    gbc.weighty = 1.0;
    this.getContentPane().add(PanelCita, gbc);

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridwidth = 2;
    gbc.gridheight = 2;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    this.getContentPane().add(PanelDetalle, gbc);

    ////////////////// PANEL DETALLES

    //Colores
    colorBackGround = new Color(hex("8FA8F6"));//Color de los BackGround 
    colorTextFields = new Color(hex("CDCBA6"));//Color de los JTextFields
    colorDelPapa = new Color(hex("2980b9"));//Color del backgorud del papa
    colorBotones = new Color(hex("2C3E50"));//Color d elos botonte
    colorActivo = new Color(hex("81CFE0"));//Color de los jTextFild cuando los activan
    //Colores

    //Inicializaciones

    this.setBackground(colorDelPapa);//Color del backgroud
    //BOTONES INICIALIZACION
    modificarB = new JButton("Modificar");
    eliminarB = new JButton("Eliminar");
    agregarB = new JButton("Agregar");
    atrasB = new JButton("Atras");
    buscarB = new JButton("Buscar");
    Botones = new JPanel(); //PAnel donde van los botones Agregar, Modificar y Eliminar
    BotonAtras = new JPanel(); //PAnel donde va el boton atras
    BotonBuscar = new JPanel(); //PAnel donde va el boton buscar
    agregarB.addActionListener(this);
    modificarB.addActionListener(this);
    eliminarB.addActionListener(this);
    atrasB.addActionListener(this);
    buscarB.addActionListener(this);
    // FIN BOTONES INICIALIZACION

    PanelCita.setLayout(new GridBagLayout());

    disenoBotones(modificarB);
    disenoBotones(eliminarB);
    disenoBotones(agregarB);
    disenoBotones(atrasB);
    disenoBotones(buscarB);
    PanelDetalle.setLayout(new GridBagLayout()); //Panel Pap (PanelDetalle)
    cambiarColorPanel(PanelCalendar, colorDelPapa);
    cambiarColorPanel(PanelCita, colorDelPapa);
    cambiarColorPanel(PanelDetalle, colorDelPapa);

    //LABELS
    horaCitas = new JLabel();
    fechaL = new JLabel("<HTML> Fecha &nbsp</HTML>");
    horaL = new JLabel("<HTML> Hora &nbsp</HTML>");
    nombreL = new JLabel("<HTML> Nombre &nbsp &nbsp </HTML>");
    apellidoL = new JLabel("<HTML> Apellido &nbsp &nbsp &nbsp</HTML>");
    cedulaL = new JLabel("<HTML> Cedula &nbsp &nbsp &nbsp &nbsp &nbsp</HTML>");
    direccionL = new JLabel("<HTML> Direccion &nbsp &nbsp</HTML>");
    motivosL = new JLabel("<HTML> Motivos &nbsp &nbsp &nbsp &nbsp</HTML>");
    telefonoCasaL = new JLabel("<HTML> Tlfn Casa&nbsp </HTML>");
    telefonoCelularL = new JLabel("<HTML> Tlfn Celular</HTML>");
    correoL = new JLabel("<HTML> Correo &nbsp &nbsp &nbsp</HTML>");

    font = font = font.deriveFont(Font.BOLD, 11);
    disenoLabel(horaCitas);
    disenoLabel(fechaL);
    disenoLabel(horaL);
    disenoLabel(nombreL);
    disenoLabel(apellidoL);
    disenoLabel(cedulaL);
    disenoLabel(direccionL);
    disenoLabel(motivosL);
    disenoLabel(telefonoCasaL);
    disenoLabel(telefonoCelularL);
    disenoLabel(correoL);

    //JTEXTFIELDS y TEXAREA

    fechaJ = new JTextField("");
    horaJ = new JTextField("");
    nombreJ = new JTextField("");
    apellidoJ = new JTextField("");
    cedulaJ = new JTextField("");
    direccionJ = new JTextField();
    motivosTA = new JTextArea("");
    telefonoCasaJ = new JTextField("");
    telefonoCelularJ = new JTextField("");
    correoJ = new JTextField("");
    //COLORES
    /*fechaJ.setBackground(colorTextFields);
    horaJ.setBackground(colorTextFields);
    nombreJ.setBackground(colorTextFields);
    apellidoJ.setBackground(colorTextFields);
    cedulaJ.setBackground(colorTextFields);
    direccionJ.setBackground(colorTextFields);
    motivosTA .setBackground(colorTextFields);
    telefonoCasaJ.setBackground(colorTextFields);
    telefonoCelularJ.setBackground(colorTextFields);
    correoJ.setBackground(colorTextFields);
    */
    //Aadir componentes al PanelDetalle
    GridBagConstraints constraints = new GridBagConstraints();

    //Caracteristicas globales del grid
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weighty = 1.0;
    constraints.insets.set(5, 0, 5, 10);
    //Fin Caracteristicas Globales del grid

    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(fechaL, constraints);

    constraints.gridx = 1; //Necesita estirarse
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(fechaJ, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(horaL, constraints);

    constraints.gridx = 1; //Necesita estirarse
    constraints.gridy = 1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(horaJ, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(nombreL, constraints);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(nombreJ, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(apellidoL, constraints);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(apellidoJ, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 4;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(cedulaL, constraints);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 4;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(cedulaJ, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 5;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(direccionL, constraints);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 5;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(direccionJ, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 6;
    constraints.gridwidth = 1;
    constraints.gridheight = 2;
    constraints.weighty = 1.0;
    PanelDetalle.add(motivosL, constraints);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 6;
    constraints.gridwidth = 1;
    constraints.gridheight = 2;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    PanelDetalle.add(motivosTA, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 8;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(telefonoCasaL, constraints);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 8;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(telefonoCasaJ, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 9;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(telefonoCelularL, constraints);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 9;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(telefonoCelularJ, constraints);
    constraints.weightx = 0.0;

    constraints.gridx = 0;
    constraints.gridy = 10;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    PanelDetalle.add(correoL, constraints);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 10;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1.0;
    PanelDetalle.add(correoJ, constraints);
    constraints.weightx = 0.0;

    //PANEL DE LOS BOTONES

    constraints.insets.set(30, 0, 10, 10);

    constraints.gridx = 1;//Necesita estirarse
    constraints.gridy = 11;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;
    FlowLayout flowLayout1 = new FlowLayout();
    Botones.setLayout(flowLayout1);
    Botones.add(agregarB);
    Botones.add(modificarB);
    Botones.add(eliminarB);
    PanelDetalle.add(Botones, constraints);

    //Boton Buscar
    constraints.anchor = GridBagConstraints.NORTH;
    constraints.insets.set(10, 0, 0, 0);
    constraints.gridx = 2;//Necesita estirarse
    constraints.gridy = 4;
    constraints.gridwidth = 1;
    constraints.gridheight = 0;
    constraints.weightx = 0.0;
    BotonBuscar.setLayout(flowLayout1);
    BotonBuscar.add(buscarB);
    BotonBuscar.setBackground(colorBackGround);
    PanelDetalle.add(BotonBuscar, constraints);
    constraints.insets.set(30, 0, 10, 10);

    //BOTON ATRAS

    constraints.insets.set(30, 0, 10, 10);
    constraints.gridx = 2;//Necesita estirarse
    constraints.gridy = 11;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.0;

    BotonAtras.setLayout(flowLayout1);
    BotonAtras.add(atrasB);

    PanelDetalle.add(BotonAtras, constraints);

    cambiarColorPanel(Botones, colorDelPapa);
    cambiarColorPanel(BotonBuscar, colorDelPapa);
    cambiarColorPanel(BotonAtras, colorDelPapa);

    PanelDetalle.setVisible(true);

    //////////////////////ULTIMAS MOTIFICACIONES PRIMER INCREMENTO
    atrasB.setEnabled(false);
    buscarB.setEnabled(false);
    modificarB.setEnabled(false);
    agregarB.setEnabled(false);
    eliminarB.setEnabled(false);
    fechaJ.setEditable(false);
    horaJ.setEditable(false);
    nombreJ.setEditable(false);
    apellidoJ.setEditable(false);
    cedulaJ.setEditable(false);
    direccionJ.setEditable(false);
    motivosTA.setEditable(false);
    telefonoCasaJ.setEditable(false);
    telefonoCelularJ.setEditable(false);
    correoJ.setEditable(false);

    /////////////////////FIN ULTIMAS MOTIFICACIONES PRIMER INCREMENTO

    /////////////////Para enero

    setCitas();
    dibujarPanelCita(medico);//Dibuja la "libreta" de las citas

    /////// fin para ENERO

    //jCalendar1.getDayChooser().addDateEvaluator(new DJFechasEspInv());//Pinta las Fechas ocupadas en rojo
    jCalendar1.addPropertyChangeListener("calendar", new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            try {
                try {
                    setCitas();
                } catch (ClientProtocolException ex) {
                    Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex);
                } catch (ParseException ex) {
                    Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex);
                } catch (java.text.ParseException ex) {
                    Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex);
                }
            } catch (IOException ex) {
                Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex);
            } catch (JSONException ex) {
                Logger.getLogger(FrameCita.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });

}

From source file:org.zaproxy.zap.extension.brk.impl.http.BreakAddDialog.java

private JPanel getJPanel() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
        java.awt.GridBagConstraints gridBagConstraints13 = new GridBagConstraints();

        javax.swing.JLabel jLabel2 = new JLabel();

        java.awt.GridBagConstraints gridBagConstraints3 = new GridBagConstraints();

        java.awt.GridBagConstraints gridBagConstraints2 = new GridBagConstraints();

        jPanel = new JPanel();
        jPanel.setLayout(new GridBagLayout());
        jPanel.setPreferredSize(new java.awt.Dimension(400, 90));
        jPanel.setMinimumSize(new java.awt.Dimension(400, 90));
        gridBagConstraints2.gridx = 1;/*from  www . j  ava 2  s .c o m*/
        gridBagConstraints2.gridy = 5;
        gridBagConstraints2.insets = new java.awt.Insets(2, 2, 2, 2);
        gridBagConstraints2.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints3.gridx = 2;
        gridBagConstraints3.gridy = 5;
        gridBagConstraints3.insets = new java.awt.Insets(2, 2, 2, 10);
        gridBagConstraints3.anchor = java.awt.GridBagConstraints.EAST;

        gridBagConstraints13.gridx = 0;
        gridBagConstraints13.gridy = 5;
        gridBagConstraints13.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints13.weightx = 1.0D;
        gridBagConstraints13.insets = new java.awt.Insets(2, 10, 2, 5);

        gridBagConstraints15.weightx = 1.0;
        gridBagConstraints15.weighty = 0.0D;
        gridBagConstraints15.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints15.insets = new java.awt.Insets(2, 10, 5, 10);
        gridBagConstraints15.gridwidth = 3;
        gridBagConstraints15.gridx = 0;
        gridBagConstraints15.gridy = 2;
        gridBagConstraints15.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints15.ipadx = 0;
        gridBagConstraints15.ipady = 10;

        jPanel.add(getJScrollPane(), gridBagConstraints15);
        jPanel.add(jLabel2, gridBagConstraints13);
        jPanel.add(getBtnCancel(), gridBagConstraints2);
        jPanel.add(getBtnAdd(), gridBagConstraints3);
    }
    return jPanel;
}

From source file:org.executequery.gui.scriptgenerators.GenerateScriptsPanelThree.java

private JPanel createFileOutputPanel() {

    pathField = WidgetFactory.createTextField();

    final JButton browseButton = new DefaultPanelButton("Browse");
    browseButton.setMnemonic('B');
    browseButton.addActionListener(this);

    final DefaultFieldLabel label = new DefaultFieldLabel("Save Path:");

    writeToFileCheck = new JCheckBox("Write to file");
    writeToFileCheck.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean enable = writeToFileCheck.isSelected();
            browseButton.setEnabled(enable);
            pathField.setEnabled(enable);
            label.setEnabled(enable);//from   w w  w.ja  v  a  2 s.  c  o  m
        }
    });

    browseButton.setEnabled(false);
    pathField.setEnabled(false);
    label.setEnabled(false);

    ComponentTitledPanel panel = new ComponentTitledPanel(writeToFileCheck);
    JPanel fileOutputPanel = panel.getContentPane();
    fileOutputPanel.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx++;
    gbc.gridy++;
    gbc.insets = new Insets(7, 5, 5, 5);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    fileOutputPanel.add(label, gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    fileOutputPanel.add(pathField, gbc);
    gbc.fill = GridBagConstraints.NONE;
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.insets.top = 3;
    gbc.insets.right = 5;
    fileOutputPanel.add(browseButton, gbc);

    return panel;
}

From source file:org.rdv.ui.ImportDialog.java

private void initComponents() {
    JPanel container = new JPanel();
    setContentPane(container);/*from w  w  w. j  a  v  a 2  s  .  co  m*/

    InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap actionMap = container.getActionMap();

    container.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weighty = 1;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;

    JLabel headerLabel = new JLabel("Please specify the desired source name for the data.");
    headerLabel.setBackground(Color.white);
    headerLabel.setOpaque(true);
    headerLabel.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray),
                    BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(0, 0, 0, 0);
    container.add(headerLabel, c);

    c.fill = GridBagConstraints.NONE;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(10, 10, 10, 5);
    container.add(new JLabel("Source name: "), c);

    sourceNameTextField = new JTextField();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new java.awt.Insets(10, 0, 10, 10);
    container.add(sourceNameTextField, c);

    importProgressBar = new JProgressBar(0, 100000);
    importProgressBar.setStringPainted(true);
    importProgressBar.setValue(0);
    importProgressBar.setVisible(false);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.5;
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    ;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new java.awt.Insets(0, 10, 10, 10);
    container.add(importProgressBar, c);

    JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout());

    Action importAction = new AbstractAction() {
        /** serialization version identifier */
        private static final long serialVersionUID = -4719316285523193555L;

        public void actionPerformed(ActionEvent e) {
            importData();
        }
    };
    importAction.putValue(Action.NAME, "Import");
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), "import");
    actionMap.put("export", importAction);
    importButton = new JButton(importAction);
    getRootPane().setDefaultButton(importButton);
    panel.add(importButton);

    Action cancelAction = new AbstractAction() {
        /** serialization version identifier */
        private static final long serialVersionUID = 7909429022904810958L;

        public void actionPerformed(ActionEvent e) {
            cancel();
        }
    };
    cancelAction.putValue(Action.NAME, "Cancel");
    inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel");
    actionMap.put("cancel", cancelAction);
    cancelButton = new JButton(cancelAction);
    panel.add(cancelButton);

    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.5;
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    ;
    c.anchor = GridBagConstraints.LINE_END;
    c.insets = new java.awt.Insets(0, 0, 10, 5);
    container.add(panel, c);

    pack();

    sourceNameTextField.requestFocusInWindow();

    setLocationByPlatform(true);
    setVisible(true);
}

From source file:de.juwimm.cms.gui.admin.PanUnitGroupPerUser.java

void jbInit() throws Exception {
    this.setLayout(new GridBagLayout());

    this.unitPickData = new PickListData();
    this.unitPickData.setLeftLabel(rb.getString("panel.admin.tab.units.assigned"));
    this.unitPickData.setRightLabel(rb.getString("panel.admin.tab.units.all"));
    this.groupPickData = new PickListData();
    this.groupPickData.setLeftLabel(rb.getString("panel.admin.tab.groups.assigned"));
    this.groupPickData.setRightLabel(rb.getString("panel.admin.tab.groups.all"));
    this.panUnitPick = new PickListPanel(this.unitPickData);
    this.panGroupPick = new PickListPanel(this.groupPickData);
    this.btnSave.setText(rb.getString("dialog.save"));
    this.lblUser.setText(rb.getString("panel.login.username"));

    this.btnSave.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            save();//from w  w w.ja  v  a  2 s  .  c  om
        }
    });

    this.tblUser = new JTable();
    JScrollPane scrollUser = new NoResizeScrollPane(tblUser);

    this.add(lblUser, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL, new Insets(10, 10, 5, 0), 0, 0));
    this.add(scrollUser, new GridBagConstraints(0, 1, 1, 2, 1.0, 1.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, new Insets(0, 10, 0, 0), 0, 0));
    this.add(btnSave, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHWEST,
            GridBagConstraints.NONE, new Insets(10, 10, 10, 0), 0, 0));
    this.add(this.panUnitPick, new GridBagConstraints(1, 0, 1, 2, 2.0, 1.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, new Insets(0, 10, 0, 10), 0, 0));
    this.add(this.panGroupPick, new GridBagConstraints(1, 2, 1, 1, 2.0, 1.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, new Insets(0, 10, 0, 10), 0, 0));
}

From source file:org.executequery.gui.browser.TableDataTab.java

private void init() throws Exception {

    if (displayRowCount) {

        initRowCountPanel();/*from   www  . j a v  a  2 s  .  c om*/
    }

    canEditTableNotePanel = createCanEditTableNotePanel();
    canEditTableNoteConstraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0);

    scroller = new JScrollPane();
    scrollerConstraints = new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.SOUTHEAST,
            GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);

    rowCountPanelConstraints = new GridBagConstraints(1, 3, 1, 1, 1.0, 0, GridBagConstraints.SOUTHWEST,
            GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0);

    errorLabelConstraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);

    tableDataChanges = new ArrayList<TableDataChange>();
    alwaysShowCanEditNotePanel = SystemProperties.getBooleanProperty(Constants.USER_PROPERTIES_KEY,
            "browser.always.show.table.editable.label");

    cancelPanel = new InterruptibleProcessPanel("Executing query for data...");

    EventMediator.registerListener(this);
}

From source file:org.pentaho.ui.xul.swing.tags.SwingDialog.java

public void resetContainer() {

    container.removeAll();// w  w w.  j a  v  a  2  s  .co m

    gc = new GridBagConstraints();
    gc.gridy = GridBagConstraints.RELATIVE;
    gc.gridx = 0;
    gc.gridheight = 1;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    int pad = getPadding();
    gc.insets = new Insets(pad, pad, pad, pad);
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.anchor = GridBagConstraints.NORTHWEST;
    gc.weightx = 1;

}

From source file:org.executequery.gui.ExecuteSqlScriptPanel.java

private void init() throws Exception {

    fileNameField = WidgetFactory.createTextField();
    connectionsCombo = WidgetFactory.createComboBox();
    combosGroup = new TableSelectionCombosGroup(connectionsCombo);

    actionOnErrorCombo = WidgetFactory.createComboBox();

    ActionOnError[] actionsOnError = { ActionOnError.HALT, ActionOnError.CONTINUE };

    actionOnErrorCombo.setModel(new DefaultComboBoxModel(actionsOnError));

    outputPanel = new LoggingOutputPanel();
    statusBar = new SqlTextPaneStatusBar();
    statusBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 1));

    JButton button = WidgetFactory.createInlineFieldButton("Browse");
    button.setActionCommand("browse");
    button.addActionListener(this);
    button.setMnemonic('r');

    logOutputCheckBox = new JCheckBox(
            "<html>&nbsp;&nbsp;<i>Note:</i> This will slow down the process significantly </html>");

    JPanel mainPanel = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;/* w w  w.  j  a v a2s  . com*/
    gbc.gridx = 0;
    gbc.gridheight = 1;
    gbc.insets.top = 7;
    gbc.insets.bottom = 5;
    gbc.insets.right = 5;
    gbc.insets.left = 5;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    mainPanel.add(new JLabel("Connection:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.top = 5;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(connectionsCombo, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 5;
    mainPanel.add(new JLabel("Action on Error:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets.top = 0;
    mainPanel.add(actionOnErrorCombo, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 5;
    mainPanel.add(new JLabel("Input File:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.top = 0;
    mainPanel.add(fileNameField, gbc);
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.insets.left = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(button, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.insets.top = 5;
    gbc.insets.left = 5;
    mainPanel.add(new JLabel("Log output:"), gbc);
    gbc.gridx = 1;
    gbc.insets.top = 2;
    gbc.insets.left = 0;
    mainPanel.add(logOutputCheckBox, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 1.0;
    gbc.weightx = 1.0;
    gbc.insets.top = 5;
    gbc.insets.left = 5;
    gbc.insets.bottom = 0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    mainPanel.add(outputPanel, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 0;
    gbc.insets.bottom = 5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(statusBar, gbc);

    mainPanel.setBorder(BorderFactory.createEtchedBorder());

    int minimumButtonWidth = 85;
    startButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Start", "start");
    rollbackButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Commit", "commit");
    commitButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Rollback", "rollback");
    stopButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Stop", "stop");

    rollbackButton.setEnabled(false);
    commitButton.setEnabled(false);
    stopButton.setEnabled(false);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 2, 5));
    buttonPanel.add(startButton);
    buttonPanel.add(rollbackButton);
    buttonPanel.add(commitButton);
    buttonPanel.add(stopButton);

    add(mainPanel, BorderLayout.CENTER);
    add(buttonPanel, BorderLayout.SOUTH);
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    EventMediator.registerListener(this);
}

From source file:org.n52.oxf.ui.swing.ChartDialog.java

/**
 * initializes (or updates) the JFreeChart->ChartPanel.
 * //from  w ww  .  j a v  a2s. com
 * @param parameters
 * @param selectedfeatures
 */
private void initChartPanel(OXFFeatureCollection observations, ParameterContainer paramCon) {

    MyGridBagLayout mainLayout = (MyGridBagLayout) getContentPane().getLayout();

    int chartPanelPosition = 3;

    if (getContentPane().getComponentCount() > chartPanelPosition) {
        getContentPane().remove(chartPanelPosition);
    }

    JFreeChart chart = chartRenderer.renderChart(observations, paramCon);
    org.jfree.chart.ChartPanel chartPanel = new org.jfree.chart.ChartPanel(chart);
    chartPanel.setMouseZoomable(true, true);

    mainLayout.addComponent(chartPanelPosition, chartPanel, 0, 0, 2, 1, 100, 100, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, new Insets(9, 9, 9, 9));

    getContentPane().validate();
}

From source file:com.digitalgeneralists.assurance.ui.components.SettingsPanel.java

@Override
protected void initializeComponent() {
    if (!this.initialized) {
        this.dialogTitle = Application.applicationShortName + " Settings";

        // NOTE:  There is no notion of add-mode in this dialog.  There should
        // always be a single instance of the application configuration.
        if (this.configuration == null) {
            this.configuration = ApplicationConfiguration.createDefaultConfiguration();
        }/*from   w w w.jav a 2  s  . c o m*/
        this.mode = AssuranceDialogMode.EDIT;

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

        final JPanel scanSettingsPanel = new JPanel();
        scanSettingsPanel.setLayout(new GridBagLayout());

        Border scanSettingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        scanSettingsPanelBorder = BorderFactory.createTitledBorder(scanSettingsPanelBorder, "Scan Settings",
                TitledBorder.CENTER, TitledBorder.TOP);

        GridBagConstraints scanSettingsPanelConstraints = new GridBagConstraints();
        scanSettingsPanelConstraints.anchor = GridBagConstraints.NORTH;
        scanSettingsPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
        scanSettingsPanelConstraints.gridx = 0;
        scanSettingsPanelConstraints.gridy = 0;
        scanSettingsPanelConstraints.weightx = 1.0;
        scanSettingsPanelConstraints.weighty = 1.0;
        scanSettingsPanelConstraints.gridheight = 1;
        scanSettingsPanelConstraints.gridwidth = 2;
        scanSettingsPanelConstraints.insets = new Insets(5, 5, 5, 5);

        scanSettingsPanel.setBorder(scanSettingsPanelBorder);
        this.add(scanSettingsPanel, scanSettingsPanelConstraints);

        GridBagConstraints ignoredFileNamesLabelConstraints = new GridBagConstraints();
        ignoredFileNamesLabelConstraints.anchor = GridBagConstraints.NORTHWEST;
        ignoredFileNamesLabelConstraints.fill = GridBagConstraints.NONE;
        ignoredFileNamesLabelConstraints.gridx = 0;
        ignoredFileNamesLabelConstraints.gridy = 0;
        ignoredFileNamesLabelConstraints.weightx = 1.0;
        ignoredFileNamesLabelConstraints.weighty = 1.0;
        ignoredFileNamesLabelConstraints.gridheight = 1;
        ignoredFileNamesLabelConstraints.gridwidth = 1;
        ignoredFileNamesLabelConstraints.insets = new Insets(5, 10, 0, 5);

        final JLabel ignoredFileNamesLabel = new JLabel("Ignored Files", SwingConstants.LEFT);
        scanSettingsPanel.add(ignoredFileNamesLabel, ignoredFileNamesLabelConstraints);

        GridBagConstraints ignoredFileNamesTextFieldConstraints = new GridBagConstraints();
        ignoredFileNamesTextFieldConstraints.anchor = GridBagConstraints.NORTH;
        ignoredFileNamesTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        ignoredFileNamesTextFieldConstraints.gridx = 0;
        ignoredFileNamesTextFieldConstraints.gridy = 1;
        ignoredFileNamesTextFieldConstraints.weightx = 1.0;
        ignoredFileNamesTextFieldConstraints.weighty = 1.0;
        ignoredFileNamesTextFieldConstraints.gridheight = 1;
        ignoredFileNamesTextFieldConstraints.gridwidth = 2;
        ignoredFileNamesTextFieldConstraints.insets = new Insets(2, 5, 5, 5);

        GridBagConstraints ignoredFileExtensionsLabelConstraints = new GridBagConstraints();
        ignoredFileExtensionsLabelConstraints.anchor = GridBagConstraints.NORTHWEST;
        ignoredFileExtensionsLabelConstraints.fill = GridBagConstraints.NONE;
        ignoredFileExtensionsLabelConstraints.gridx = 0;
        ignoredFileExtensionsLabelConstraints.gridy = 2;
        ignoredFileExtensionsLabelConstraints.weightx = 1.0;
        ignoredFileExtensionsLabelConstraints.weighty = 1.0;
        ignoredFileExtensionsLabelConstraints.gridheight = 1;
        ignoredFileExtensionsLabelConstraints.gridwidth = 1;
        ignoredFileExtensionsLabelConstraints.insets = new Insets(5, 10, 0, 5);

        final JLabel ignoredFileExtensionsLabel = new JLabel("Ignored File Extensions", SwingConstants.LEFT);
        scanSettingsPanel.add(ignoredFileExtensionsLabel, ignoredFileExtensionsLabelConstraints);

        GridBagConstraints ignoredFileExtensionsTextFieldConstraints = new GridBagConstraints();
        ignoredFileExtensionsTextFieldConstraints.anchor = GridBagConstraints.NORTH;
        ignoredFileExtensionsTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        ignoredFileExtensionsTextFieldConstraints.gridx = 0;
        ignoredFileExtensionsTextFieldConstraints.gridy = 3;
        ignoredFileExtensionsTextFieldConstraints.weightx = 1.0;
        ignoredFileExtensionsTextFieldConstraints.weighty = 1.0;
        ignoredFileExtensionsTextFieldConstraints.gridheight = 1;
        ignoredFileExtensionsTextFieldConstraints.gridwidth = 2;
        ignoredFileExtensionsTextFieldConstraints.insets = new Insets(2, 5, 5, 5);

        scanSettingsPanel.add(this.ignoredFileNamesTextField, ignoredFileNamesTextFieldConstraints);
        this.ignoredFileNamesTextField.getDocument().addDocumentListener(this.textPropertyValidationListener);
        scanSettingsPanel.add(this.ignoredFileExtensionsTextField, ignoredFileExtensionsTextFieldConstraints);
        this.ignoredFileExtensionsTextField.getDocument()
                .addDocumentListener(this.textPropertyValidationListener);

        GridBagConstraints numberScanThreadsLabelConstraints = new GridBagConstraints();
        numberScanThreadsLabelConstraints.anchor = GridBagConstraints.NORTH;
        numberScanThreadsLabelConstraints.fill = GridBagConstraints.NONE;
        numberScanThreadsLabelConstraints.gridx = 0;
        numberScanThreadsLabelConstraints.gridy = 4;
        numberScanThreadsLabelConstraints.weightx = 1.0;
        numberScanThreadsLabelConstraints.weighty = 1.0;
        numberScanThreadsLabelConstraints.gridheight = 1;
        numberScanThreadsLabelConstraints.gridwidth = 1;
        numberScanThreadsLabelConstraints.insets = new Insets(10, 5, 0, 5);

        final JLabel numberOfThreadsLabel = new JLabel("Number of Threads", SwingConstants.RIGHT);
        scanSettingsPanel.add(numberOfThreadsLabel, numberScanThreadsLabelConstraints);

        GridBagConstraints numberScanThreadsSpinnerConstraints = new GridBagConstraints();
        numberScanThreadsSpinnerConstraints.anchor = GridBagConstraints.NORTHWEST;
        numberScanThreadsSpinnerConstraints.fill = GridBagConstraints.NONE;
        numberScanThreadsSpinnerConstraints.gridx = 1;
        numberScanThreadsSpinnerConstraints.gridy = 4;
        numberScanThreadsSpinnerConstraints.weightx = 1.0;
        numberScanThreadsSpinnerConstraints.weighty = 1.0;
        numberScanThreadsSpinnerConstraints.gridheight = 1;
        numberScanThreadsSpinnerConstraints.gridwidth = 1;
        numberScanThreadsSpinnerConstraints.insets = new Insets(5, 5, 5, 5);

        scanSettingsPanel.add(this.numberScanThreadsSpinner, numberScanThreadsSpinnerConstraints);

        if (this.configuration != null) {
            this.ignoredFileNamesTextField.setText(this.configuration.getIgnoredFileNames());
            this.ignoredFileExtensionsTextField.setText(this.configuration.getIgnoredFileExtensions());
            this.numberScanThreadsSpinner.setValue(this.configuration.getNumberOfScanThreads());
        }

        this.initialized = true;
    }
}