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:ProgressDialog.java

private void setupComponent() {

    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();
    gc.gridx = 0;/*w  ww  .  ja v  a2  s  .c  o m*/
    gc.gridy = GridBagConstraints.RELATIVE;
    gc.anchor = GridBagConstraints.NORTHWEST;
    contentPane.add(lblMessage, gc);
    gc.weightx = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    contentPane.add(progressBar, gc);

    setTitle("");
    setModal(true);
    pack();

}

From source file:com.t3.macro.api.functions.input.ColumnPanel.java

public ColumnPanel() {
    tabVarSpec = null;/*from  w w  w  .ja  va  2 s . c o m*/
    varSpecs = new ArrayList<VarSpec>();
    labels = new ArrayList<JComponent>();
    inputFields = new ArrayList<JComponent>();
    lastFocus = null;
    onShowFocus = null;
    textInsets = new Insets(0, 2, 0, 2); // used by all TEXT controls

    setLayout(new GridBagLayout());
    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    componentCount = 0;
}

From source file:org.executequery.gui.importexport.ImportExportPanelThree.java

private void init() {

    table = new DefaultTable();
    table.setRowHeight(23);//from  w ww  .  j  a v  a 2s  .  c o  m
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setColumnSelectionAllowed(false);
    table.getTableHeader().setReorderingAllowed(false);

    JScrollPane scroller = new JScrollPane(table);
    scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    add(new JLabel(getString("ImportExportPanelThree.label")), gbc);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridy = 1;
    gbc.insets.top = 0;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    add(scroller, gbc);

}

From source file:algorithm.OaiOreSubmissionInformationPackage.java

private void createConfigurationPanel() {
    panel = new GUIPanel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;//from   ww w .  j av a  2 s . c o  m
    constraints.gridy = 0;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    panel.add(new JLabel("Choose archiving technique:"), constraints);
    constraints.gridx++;
    ButtonGroup archivingGroup = new ButtonGroup();
    archivingGroup.add(tarButton);
    archivingGroup.add(zipButton);
    zipButton.setSelected(true);
    panel.add(zipButton, constraints);
    constraints.gridy++;
    panel.add(tarButton, constraints);
    constraints.gridx = 0;
    constraints.gridy++;
}

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

private void init() throws IOException {

    hostField = new DisabledField();
    userNameField = WidgetFactory.createTextField();
    passwordField = WidgetFactory.createPasswordField();
    portField = WidgetFactory.createNumberTextField();

    mainPanel = new TextFieldPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.gridy = 0;//from   ww w . ja v a  2s.  com
    gbc.gridx = 0;

    gbc.insets.bottom = 5;

    gbc.gridwidth = GridBagConstraints.REMAINDER;
    mainPanel.add(new DefaultFieldLabel(
            FileUtils.loadResource("org/executequery/gui/browser/resource/ssh-tunnel.html")), gbc);

    addLabelFieldPair(mainPanel, "SSH Host:", hostField, "The SSH host server for the tunnel", gbc);

    addLabelFieldPair(mainPanel, "SSH Port:", portField, "The SSH server port", gbc);

    addLabelFieldPair(mainPanel, "SSH User Name:", userNameField, "The SSH user name for the tunnel", gbc);

    addLabelFieldPair(mainPanel, "SSH Password:", passwordField, "The SSH user password for the tunnel", gbc);

    savePwdCheck = ActionUtilities.createCheckBox("Store Password", "setStorePassword");

    JButton showPassword = new LinkButton("Show Password");
    showPassword.setActionCommand("showPassword");
    showPassword.addActionListener(this);

    JPanel passwordOptionsPanel = new JPanel(new GridBagLayout());
    addComponents(passwordOptionsPanel,
            new ComponentToolTipPair[] {
                    new ComponentToolTipPair(savePwdCheck,
                            "Store the password with the connection information"),
                    new ComponentToolTipPair(showPassword, "Show the password in plain text") });

    gbc.gridy++;
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    mainPanel.add(passwordOptionsPanel, gbc);

    JScrollPane scrollPane = new JScrollPane(mainPanel);
    scrollPane.setBorder(null);

    useSshCheckbox = ActionUtilities.createCheckBox(this, "Connect Using an SSH Tunnel", "useSshSelected");
    ComponentTitledPanel titledPanel = new ComponentTitledPanel(useSshCheckbox);

    JPanel panel = titledPanel.getContentPane();
    panel.setLayout(new BorderLayout());
    panel.add(scrollPane, BorderLayout.CENTER);

    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(titledPanel, BorderLayout.NORTH);
}

From source file:org.openconcerto.erp.graph.GraphFamilleArticlePanel.java

public GraphFamilleArticlePanel(Date d1, Date d2) {
    this.d1 = d1;
    this.d2 = d2;
    List<String> labels = new ArrayList<String>();
    List<Number> values = new ArrayList<Number>();
    BigDecimal total = updateDataset(labels, values);
    PieChart chart = new PieChart();
    chart.setDimension(new Dimension(800, 360));
    chart.setData(values);//  ww  w .j av a 2  s.c  o m
    for (String label : labels) {
        chart.addLabel(new Label(label));
    }

    ChartPanel p = new ChartPanel(chart);
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();
    c.insets = new Insets(4, 6, 4, 4);
    p.setOpaque(false);
    this.setBackground(Color.WHITE);
    this.add(p, c);

    final JPanel p1 = new JPanel();
    p1.setOpaque(false);
    p1.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    SimpleDateFormat format = new SimpleDateFormat("dd/MM/yy");
    p1.add(new JLabelBold("Rpartition du chiffre d'affaire du " + format.format(d1) + " au "
            + format.format(d2) + " pour un total de "
            + decFormat.format(total.setScale(2, RoundingMode.HALF_UP).doubleValue()) + ""));

    c.gridy++;
    c.weighty = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    this.add(p1, c);
}

From source file:com.lp.client.frame.component.PanelDiagramm.java

private void jbInit() throws Throwable {
    this.setLayout(new GridBagLayout());
    jpaWorkingOn = new JPanel(new GridBagLayout());
    chartPanel = new ChartPanel(null);
    JPanel panelButtonAction = getToolsPanel();
    getInternalFrame().addItemChangedListener(this);
    this.add(panelButtonAction, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    this.add(jpaWorkingOn, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
}

From source file:org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement.java

public SQLComponent createComponent() {
    return new BaseSQLComponent(this) {
        public void addViews() {
            this.setLayout(new GridBagLayout());
            final GridBagConstraints c = new DefaultGridBagConstraints();
            this.add(new JLabel(getLabelFor("CODE"), SwingConstants.RIGHT), c);
            c.gridx++;//from w w  w .  j a  v  a 2 s . c om
            c.weightx = 1;
            c.fill = GridBagConstraints.NONE;
            final JTextField code = new JTextField(6);
            this.add(code, c);

            c.gridx = 0;
            c.gridy++;
            c.fill = GridBagConstraints.HORIZONTAL;
            c.weightx = 0;
            this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c);
            c.gridx++;
            c.weightx = 1;
            final JTextField nom = new JTextField(25);
            this.add(nom, c);
            c.gridy++;
            c.anchor = GridBagConstraints.NORTHWEST;
            c.weighty = 1;
            final JCheckBox checkBox = new JCheckBox(getLabelFor("TYPE_BANQUE"));
            this.add(checkBox, c);

            this.addView(nom, "NOM", REQ);
            this.addView(code, "CODE", REQ);
            this.addView(checkBox, "TYPE_BANQUE");
        }

        @Override
        protected SQLRowValues createDefaults() {
            final SQLRowValues rowVals = new SQLRowValues(getTable());
            rowVals.put("TYPE_BANQUE", Boolean.TRUE);
            return rowVals;
        }
    };
}

From source file:pcgen.gui2.coreview.CoreViewFrame.java

public void initialize(CharacterFacade character) {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    getContentPane().setLayout(gridbag);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(2, 2, 2, 2);

    int col = 0;//from  w w  w. j a v  a2s  .  c om
    Utility.buildConstraints(c, col, 0, 1, 1, 100, 20);
    JLabel label = new JLabel(LanguageBundle.getFormattedString("in_CoreView_Perspective")); //$NON-NLS-1$
    gridbag.setConstraints(label, c);
    getContentPane().add(label);

    Utility.buildConstraints(c, col++, 1, 1, 1, 0, 20);
    gridbag.setConstraints(perspectiveChooser, c);
    getContentPane().add(perspectiveChooser);

    Utility.buildConstraints(c, 0, 2, col, 1, 0, 1000);
    viewTable.setAutoCreateRowSorter(true);
    JScrollPane pane = new JScrollPane(viewTable);
    pane.setPreferredSize(new Dimension(500, 300));
    gridbag.setConstraints(pane, c);
    getContentPane().add(pane);

    setTitle("Core Debug View");
    getContentPane().setSize(500, 400);
    pack();
    Utility.centerComponent(this, true);
}

From source file:com.sshtools.common.ui.SshToolsConnectionKerberosTab.java

/**
 * Creates a new SshToolsConnectionKerberosTab object.
 *//*from www  .  j  a  v  a  2s . co m*/
public SshToolsConnectionKerberosTab() {
    super();

    //  Create the main connection details panel
    JPanel mainConnectionDetailsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(0, 2, 2, 2);
    //  enabled option
    //gbc.fill = GridBagConstraints.NONE;
    useKerberos = new JCheckBox("Use MyProxy Kerberos support");
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, useKerberos, gbc, GridBagConstraints.REMAINDER);
    //  Host name
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Hostname"), gbc, GridBagConstraints.REMAINDER);
    //gbc.fill = GridBagConstraints.HORIZONTAL;
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextHostname, gbc, GridBagConstraints.REMAINDER);
    //gbc.fill = GridBagConstraints.NONE;

    //  Username
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Username"), gbc, GridBagConstraints.REMAINDER);
    //gbc.fill = GridBagConstraints.HORIZONTAL;
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextUsername, gbc, GridBagConstraints.REMAINDER);

    JPanel settingsPanel = new JPanel(new GridBagLayout());
    settingsPanel
            .setBorder(BorderFactory.createTitledBorder("Settings if krb5.conf or krb5.ini file not found: "));
    GridBagConstraints gbc2 = new GridBagConstraints();
    gbc2.fill = GridBagConstraints.HORIZONTAL;
    gbc2.anchor = GridBagConstraints.NORTHWEST;
    gbc2.insets = new Insets(0, 2, 2, 2);
    gbc2.weightx = 1.0;

    //  realm
    UIUtil.jGridBagAdd(settingsPanel, new JLabel("Realm"), gbc2, GridBagConstraints.REMAINDER);
    gbc2.fill = GridBagConstraints.HORIZONTAL;
    UIUtil.jGridBagAdd(settingsPanel, jTextRealm, gbc2, GridBagConstraints.REMAINDER);
    gbc2.fill = GridBagConstraints.NONE;

    //  kdc
    UIUtil.jGridBagAdd(settingsPanel, new JLabel("KDC"), gbc2, GridBagConstraints.REMAINDER);
    gbc2.fill = GridBagConstraints.HORIZONTAL;
    gbc2.weighty = 1.0;
    UIUtil.jGridBagAdd(settingsPanel, jTextKDC, gbc2, GridBagConstraints.REMAINDER);
    gbc2.fill = GridBagConstraints.NONE;

    //
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(4, 2, 2, 2);
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, settingsPanel, gbc, GridBagConstraints.REMAINDER);

    IconWrapperPanel iconMainConnectionDetailsPanel = new IconWrapperPanel(
            new ResourceIcon(SshToolsConnectionHostTab.class, AUTH_ICON), mainConnectionDetailsPanel);

    setLayout(new GridBagLayout());
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    UIUtil.jGridBagAdd(this, iconMainConnectionDetailsPanel, gbc, GridBagConstraints.REMAINDER);

}