Example usage for java.awt GridBagConstraints ABOVE_BASELINE_LEADING

List of usage examples for java.awt GridBagConstraints ABOVE_BASELINE_LEADING

Introduction

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

Prototype

int ABOVE_BASELINE_LEADING

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

Click Source Link

Document

Possible value for the anchor field.

Usage

From source file:com.jostrobin.battleships.view.frames.GameFrame.java

private void addPlacementPanel(int gridX, int gridY) {
    GridBagConstraints placementPanelConstraints = new GridBagConstraints();
    placementPanelConstraints.weightx = 1.0;
    placementPanelConstraints.weighty = 0.8;
    placementPanelConstraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    placementPanelConstraints.fill = GridBagConstraints.BOTH;
    placementPanelConstraints.gridy = gridY;
    placementPanelConstraints.gridx = gridX;
    add(placementPanel, placementPanelConstraints);
}

From source file:com.jostrobin.battleships.view.frames.GameFrame.java

private void addGamePanel(int gridX, int gridY, int gridWidth) {
    GridBagConstraints battlefieldConstraints = new GridBagConstraints();
    battlefieldConstraints.weightx = 1.0;
    battlefieldConstraints.weighty = 0.8;
    battlefieldConstraints.gridy = gridY;
    battlefieldConstraints.gridx = gridX;
    battlefieldConstraints.gridwidth = gridWidth;
    battlefieldConstraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    battlefieldConstraints.fill = GridBagConstraints.BOTH;
    add(gamePanel, battlefieldConstraints);
}

From source file:com.jostrobin.battleships.view.frames.GameFrame.java

public void addChatPanel(int gridX, int gridY) {
    GridBagConstraints chatPanelConstraints = new GridBagConstraints();
    chatPanelConstraints.gridy = gridY;/*from w ww. ja v a 2  s  .c om*/
    chatPanelConstraints.gridx = gridX;
    chatPanelConstraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    chatPanelConstraints.fill = GridBagConstraints.BOTH;
    chatPanelConstraints.weightx = 1.0;
    chatPanelConstraints.weighty = 0.2;
    add(chatPanel, chatPanelConstraints);
}

From source file:com.jostrobin.battleships.view.frames.GameFrame.java

private void addBattleField(int length, int width, String playerName, int gridX, int gridY) {
    battleFieldPanel = new BattleFieldPanel(playerName);
    battleFieldPanel.initializeFieldSize(length, width);
    battleFieldPanel.setSelectable(false);
    placementHelper = new PlacementHelper(battleFieldPanel);
    GridBagConstraints battlefieldConstraints = new GridBagConstraints();
    battlefieldConstraints.weightx = 1.0;
    battlefieldConstraints.weighty = 0.8;
    battlefieldConstraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    battlefieldConstraints.fill = GridBagConstraints.BOTH;
    battlefieldConstraints.gridy = gridY;
    battlefieldConstraints.gridx = gridX;
    add(battleFieldPanel, battlefieldConstraints);
}

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private void initUI() {
    setMinimumSize(new Dimension(550, 160));
    setLayout(new BorderLayout());
    setOpaque(true);//from  www.  j  av  a 2  s. co m
    setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR);

    JPanel mainPanel = new JPanel();
    mainPanel.setOpaque(false);

    String[] keys = new String[] { "fontChooser.fontName", "fontChooser.fontStyle", "fontChooser.fontSize",
            "showPreferencesPanel.ticker.exchange", "showPreferencesPanel.ticker.currency",
            "showPreferencesPanel.lookAndFeel", "showPreferencesPanel.oerLabel.text" };
    int stentWidth = MultiBitTitledPanel.calculateStentWidthForKeys(controller.getLocaliser(), keys, this)
            + STENT_DELTA;

    GridBagConstraints constraints = new GridBagConstraints();
    mainPanel.setLayout(new GridBagLayout());

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    // Disable language selection, uncomment to enable
    //        mainPanel.add(createLanguagePanel(stentWidth), constraints);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createAppearancePanel(stentWidth), constraints);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createMessagingServerPanel(stentWidth), constraints);

    /*
         constraints.fill = GridBagConstraints.HORIZONTAL;
         constraints.gridx = 0;
         constraints.gridy = 3;
         constraints.gridwidth = 2;
         constraints.weightx = 1;
         constraints.weighty = 1.6;
         constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
         mainPanel.add(createTickerPanel(stentWidth), constraints);
    */
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 4;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createBrowserIntegrationPanel(stentWidth), constraints);

    JLabel filler1 = new JLabel();
    filler1.setOpaque(false);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;
    constraints.gridy = 5;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 100;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(filler1, constraints);

    JScrollPane mainScrollPane = new JScrollPane(mainPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    mainScrollPane.setBorder(BorderFactory.createEmptyBorder());
    mainScrollPane.getViewport().setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR);
    mainScrollPane.getViewport().setOpaque(true);
    mainScrollPane.getHorizontalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT);
    mainScrollPane.getVerticalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT);

    add(mainScrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = createButtonPanel();
    buttonPanel.setMinimumSize(new Dimension(60, 60));
    add(buttonPanel, BorderLayout.SOUTH);
}