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:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java

/**
 * This method initializes this//ww  w. ja  v  a 2  s  .c  o  m
 * 
 * @return void
 */
private void initialize() {
    GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
    gridBagConstraints41.gridx = 0;
    gridBagConstraints41.gridwidth = 2;
    gridBagConstraints41.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints41.weighty = 0.01;
    gridBagConstraints41.weightx = 1.0;
    gridBagConstraints41.gridy = 1;
    GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
    gridBagConstraints3.gridx = 0;
    gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints3.gridwidth = 2;
    gridBagConstraints3.weighty = 1.0;
    gridBagConstraints3.insets = new Insets(0, 20, 0, 0);
    gridBagConstraints3.gridy = 3;
    jLabelLicense = new JLabel();
    jLabelLicense.setText("License :");
    jLabelLicense.setFont(new Font("Dialog", Font.PLAIN, 12));
    jLabelComponent = new JLabel();
    jLabelComponent.setText("Component :");
    jLabelComponent.setFont(new Font("Dialog", Font.PLAIN, 12));
    jLabelBinding = new JLabel();
    jLabelBinding.setText("Binding Type :");
    jLabelBinding.setFont(new Font("Dialog", Font.PLAIN, 12));
    this.setLayout(new GridBagLayout());
    this.setSize(570, 480);
    this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
            new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
    this.setLocation(new Point(0, 0));
    this.add(getJScrollPaneFolder(), gridBagConstraints3);
    this.add(getJScrollPanePanel(), gridBagConstraints41);

    getJRadioButtonNotContain().setSelected(false);
    getJRadioButtonThird().setSelected(false);
    getJRadioButtonIKnow().setSelected(true);
    getJScrollPaneFolder().setVisible(true);
}

From source file:algorithm.MetsSubmissionInformationPackage.java

private void createConfigurationPanel() {
    panel = new GUIPanel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;/* ww w .j  av  a2  s.co m*/
    constraints.gridy = 0;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    panel.add(new JLabel("<html><h2>Add information to mets file</h2></html>"), constraints);
    constraints.gridy++;
    panel.add(new JLabel("Add person: "), constraints);
    constraints.gridx++;
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(truePersonButton);
    panel.add(truePersonButton, constraints);
    constraints.gridx++;
    buttonGroup.add(falsePersonButton);
    falsePersonButton.setSelected(true);
    panel.add(falsePersonButton, constraints);
    constraints.gridy++;
    constraints.gridx = 0;
    panel.add(new JLabel("Name:"), constraints);
    constraints.gridx++;
    constraints.gridwidth = 2;
    panel.add(personField, constraints);
    constraints.gridwidth = 1;
    constraints.gridx = 0;
    constraints.gridy++;
    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:net.daboross.outputtablesclient.gui.OutputInterface.java

public OutputInterface(final Application application) {
    this.application = application;

    // persistEnabled
    JSONObject parentObj = application.getPersist().getStorageObject();
    JSONObject tempPersistEnabled = parentObj.optJSONObject("last-shown-panels");
    if (tempPersistEnabled == null) {
        tempPersistEnabled = new JSONObject();
        parentObj.put("last-shown-panels", tempPersistEnabled);
    }//  w  w w .jav  a  2  s .  c om
    persistEnabled = tempPersistEnabled;

    // constraints
    toggleButtonConstraints = new GBC().ipadx(2).ipady(2).gridx(0).gridy(-1)
            .fill(GridBagConstraints.HORIZONTAL);
    tablePanelConstraints = new GBC().gridx(0).gridy(-1).weightx(1).weighty(0).anchor(GridBagConstraints.EAST)
            .fill(GridBagConstraints.HORIZONTAL);

    // mainTabPanel
    mainTabPanel = new JPanel();
    mainTabPanel.setLayout(new GridBagLayout());
    application.getRoot().getMainPanel().add(mainTabPanel,
            new GBC().weightx(1).weighty(1).fill(GridBagConstraints.BOTH).gridx(0).gridy(1));

    // toggleButtonPanel
    toggleButtonPanel = new JPanel();
    toggleButtonPanel.setLayout(new GridBagLayout());
    mainTabPanel.add(toggleButtonPanel, new GBC().weightx(0).weighty(0).gridx(0).gridy(0)
            .insets(new Insets(0, 0, 10, 10)).anchor(GridBagConstraints.NORTHWEST));

    // tableRootPanel
    tableRootPanel = new JPanel(new GridBagLayout());
    mainTabPanel.add(tableRootPanel, new GBC().weightx(1).weighty(1).fill(GridBagConstraints.BOTH).gridx(2)
            .gridy(0).anchor(GridBagConstraints.EAST));

    // maps
    tableKeyToTableButton = new TreeMap<>();
    tableKeyToTableEnabled = new TreeMap<>();
    tableKeyToTablePanel = new HashMap<>();
    tableKeyAndKeyToValuePanel = new HashMap<>();
    tableKeyAndKeyToValueLabel = new HashMap<>();
    tableKeyToTableTitledBoarder = new HashMap<>();
}

From source file:org.rapidcontext.app.ui.ControlPanel.java

/**
 * Initializes the panel UI./* w  w  w .  jav  a2s.c  o  m*/
 */
private void initialize() {
    Rectangle bounds = new Rectangle();
    GridBagConstraints c;
    JLabel label;
    Font font;
    Properties info;
    String str;

    // Set system UI looks
    if (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_WINDOWS) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception ignore) {
            // Ah well... at least we tried.
        }
    }

    // Set title, menu & layout
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setTitle("RapidContext Server");
    setMenuBar(menuBar);
    initializeMenu();
    getContentPane().setLayout(new GridBagLayout());
    try {
        logotype = ImageIO.read(getClass().getResource("logotype.png"));
        Image img = ImageIO.read(getClass().getResource("logotype-icon-256x256.png"));
        setIconImage(img);
        if (SystemUtils.IS_OS_MAC_OSX) {
            MacApplication.get().setDockIconImage(img);
        }
    } catch (Exception ignore) {
        // Again, we only do our best effort here
    }

    // Add logotype
    c = new GridBagConstraints();
    c.gridheight = 5;
    c.insets = new Insets(6, 15, 10, 10);
    c.anchor = GridBagConstraints.NORTHWEST;
    Image small = logotype.getScaledInstance(128, 128, Image.SCALE_SMOOTH);
    getContentPane().add(new JLabel(new ImageIcon(small)), c);

    // Add link label
    c = new GridBagConstraints();
    c.gridx = 1;
    c.insets = new Insets(10, 10, 2, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(new JLabel("Server URL:"), c);
    serverLink.setText("http://localhost:" + server.port + "/");
    serverLink.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            try {
                AppUtils.openURL(serverLink.getText());
            } catch (Exception e) {
                error(e.getMessage());
            }
        }
    });
    c = new GridBagConstraints();
    c.gridx = 2;
    c.weightx = 1.0;
    c.insets = new Insets(10, 0, 2, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(serverLink, c);

    // Add login info label
    label = new JLabel("Login as 'admin' on a new server.");
    font = label.getFont();
    font = font.deriveFont(Font.ITALIC, font.getSize() - 2);
    label.setFont(font);
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 1;
    c.gridwidth = 2;
    c.insets = new Insets(0, 0, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(label, c);

    // Add status label
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 2;
    c.insets = new Insets(0, 10, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(new JLabel("Status:"), c);
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 2;
    c.insets = new Insets(0, 0, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(statusLabel, c);

    // Add version label
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 3;
    c.insets = new Insets(0, 10, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    getContentPane().add(new JLabel("Version:"), c);
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 3;
    c.insets = new Insets(0, 0, 6, 10);
    c.anchor = GridBagConstraints.WEST;
    info = Main.buildInfo();
    str = info.getProperty("build.version") + " (built " + info.getProperty("build.date") + ")";
    getContentPane().add(new JLabel(str), c);

    // Add buttons
    startButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            start();
        }
    });
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 4;
    c.weighty = 1.0;
    c.insets = new Insets(0, 10, 10, 10);
    c.anchor = GridBagConstraints.SOUTH;
    getContentPane().add(startButton, c);
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            stop();
        }
    });
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 4;
    c.weighty = 1.0;
    c.insets = new Insets(0, 0, 10, 0);
    c.anchor = GridBagConstraints.SOUTHWEST;
    getContentPane().add(stopButton, c);

    // Set size & position
    pack();
    bounds = this.getBounds();
    bounds.width = 470;
    bounds.x = 100;
    bounds.y = 100;
    setBounds(bounds);
}

From source file:io.github.tavernaextras.biocatalogue.integration.config.BioCataloguePluginConfigurationPanel.java

private void initialiseUI() {
    this.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.weightx = 1.0;/* ww  w.j av a  2  s .co  m*/

    c.gridx = 0;
    c.gridy = 0;
    JTextArea taDescription = new JTextArea("Configure the Service Catalogue integration functionality");
    taDescription.setFont(taDescription.getFont().deriveFont(Font.PLAIN, 11));
    taDescription.setLineWrap(true);
    taDescription.setWrapStyleWord(true);
    taDescription.setEditable(false);
    taDescription.setFocusable(false);
    taDescription.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    this.add(taDescription, c);

    c.gridy++;
    c.insets = new Insets(20, 0, 0, 0);
    JLabel jlBioCatalogueAPIBaseURL = new JLabel("Base URL of the Service Catalogue instance to connect to:");
    this.add(jlBioCatalogueAPIBaseURL, c);

    c.gridy++;
    c.insets = new Insets(0, 0, 0, 0);
    tfBioCatalogueAPIBaseURL = new JTextField();
    this.add(tfBioCatalogueAPIBaseURL, c);

    c.gridy++;
    c.insets = new Insets(30, 0, 0, 0);
    // We are not removing BioCatalogue services from its config panel any more - 
    // they are being handled by the Taverna's Service Registry
    //    JButton bForgetStoredServices = new JButton("Forget services added to Service Panel by BioCatalogue Plugin");
    //    bForgetStoredServices.addActionListener(new ActionListener() {
    //      public void actionPerformed(ActionEvent e)
    //      {
    //        int response = JOptionPane.showConfirmDialog(null, // no way T2ConfigurationFrame instance can be obtained to be used as a parent...
    //                                       "Are you sure you want to clear all SOAP operations and REST methods\n" +
    //                                       "that were added to the Service Panel by the BioCatalogue Plugin?\n\n" +
    //                                       "This action is permanent is cannot be undone.\n\n" +
    //                                       "Do you want to proceed?", "BioCatalogue Plugin", JOptionPane.YES_NO_OPTION);
    //        
    //        if (response == JOptionPane.YES_OPTION)
    //        {
    //          BioCatalogueServiceProvider.clearRegisteredServices();
    //          JOptionPane.showMessageDialog(null,  // no way T2ConfigurationFrame instance can be obtained to be used as a parent...
    //                          "Stored services have been successfully cleared, but will remain\n" +
    //                          "being shown in Service Panel during this session.\n\n" +
    //                          "They will not appear in the Service Panel after you restart Taverna.",
    //                          "BioCatalogue Plugin", JOptionPane.INFORMATION_MESSAGE);
    //        }
    //      }
    //    });
    //    this.add(bForgetStoredServices, c);

    JButton bLoadDefaults = new JButton("Load Defaults");
    bLoadDefaults.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            loadDefaults();
        }
    });

    JButton bReset = new JButton("Reset");
    bReset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            resetFields();
        }
    });

    JButton bApply = new JButton("Apply");
    bApply.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            applyChanges();
        }
    });

    JPanel jpActionButtons = new JPanel();
    jpActionButtons.add(bLoadDefaults);
    jpActionButtons.add(bReset);
    jpActionButtons.add(bApply);
    c.insets = new Insets(30, 0, 0, 0);
    c.gridy++;
    c.weighty = 1.0;
    this.add(jpActionButtons, c);
}

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

public void resetContainer() {

    container.removeAll();/* w w  w.java  2 s .  c  om*/

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

}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanProjectAnalysisSetting.java

/**
 * This method initializes this/*from   w w w  .jav  a2s .com*/
 * 
 * @return void
 */
private void initialize() {
    GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
    gridBagConstraints71.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints71.weightx = 1.0;
    gridBagConstraints71.weighty = 1.0;
    gridBagConstraints71.insets = new Insets(0, 0, 0, 0);
    gridBagConstraints71.fill = GridBagConstraints.BOTH;
    GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
    gridBagConstraints14.gridx = -1;
    gridBagConstraints14.anchor = GridBagConstraints.NORTH;
    gridBagConstraints14.insets = new Insets(10, 10, 0, 10);
    gridBagConstraints14.gridy = -1;
    this.setLayout(new GridBagLayout());
    this.add(getJIntMainPanel(), gridBagConstraints71);
    this.add(getJPanel(), gridBagConstraints14);
}

From source file:net.datacrow.console.windows.charts.ChartPanel.java

private void install() {
    add(chartPanel, Layout.getGBC(0, 1, 2, 1, 40.0, 40.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
            new Insets(5, 5, 5, 5), 0, 0));

    setEnabled(true);// ww  w  .j a va2s.co  m
    revalidate();
}

From source file:net.chaosserver.timelord.swingui.SummaryPanel.java

/**
 * Constructs the panel./*ww  w  . ja v a 2  s.  c  om*/
 */
protected void buildSummaryPanel() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    setLayout(gridBagLayout);

    if (isToday()) {
        JLabel remainderName = new JLabel("Remainder");
        gridBagConstraints.anchor = GridBagConstraints.SOUTHWEST;
        gridBagConstraints.weightx = LayoutConstants.HEAVY_WEIGHT;
        gridBagConstraints.insets = new Insets(0, LayoutConstants.SMALL_INSET, 0, LayoutConstants.BIG_INSET);
        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints.gridwidth = 1;
        gridBagLayout.addLayoutComponent(remainderName, gridBagConstraints);
        add(remainderName);

        timeLeftLabel = new JLabel();
        gridBagConstraints.anchor = GridBagConstraints.SOUTHEAST;
        gridBagConstraints.fill = GridBagConstraints.NONE;
        gridBagConstraints.weightx = 0;
        gridBagConstraints.insets = new Insets(0, LayoutConstants.BIG_INSET, 0, LayoutConstants.SMALL_INSET);
        gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
        gridBagLayout.addLayoutComponent(timeLeftLabel, gridBagConstraints);
        add(timeLeftLabel);
    }

    JLabel taskName = new JLabel("Total");
    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = LayoutConstants.HEAVY_WEIGHT;
    gridBagConstraints.insets = new Insets(0, LayoutConstants.SMALL_INSET, 0, LayoutConstants.BIG_INSET);
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.gridwidth = 1;
    gridBagLayout.addLayoutComponent(taskName, gridBagConstraints);
    add(taskName);

    totalTimeLabel = new JLabel();
    gridBagConstraints.anchor = GridBagConstraints.NORTHEAST;
    gridBagConstraints.fill = GridBagConstraints.NONE;
    gridBagConstraints.weightx = 0;
    gridBagConstraints.insets = new Insets(0, LayoutConstants.BIG_INSET, 0, LayoutConstants.SMALL_INSET);
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.addLayoutComponent(totalTimeLabel, gridBagConstraints);
    add(totalTimeLabel);

    updateTotalTimeLabel();
    updateTimeLeftLabel();
}

From source file:com.game.ui.views.ItemPanel.java

public void doCommonStuffForContent() {
    JPanel panel1 = new JPanel();
    panel1.setAlignmentX(0);//w w  w.  j a  v  a 2 s .  c o  m
    panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel1.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0.2;
    c.gridwidth = 2;
    JLabel dtlLbl = new JLabel(type + "Details : ");
    dtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    panel1.add(dtlLbl, c);
    c.gridwidth = 1;
    c.gridy = 1;
    JLabel nameLbl = new JLabel("Name : ");
    panel1.add(nameLbl, c);
    c.gridx = 1;
    JTextField name = new JTextField("");
    name.setColumns(20);
    panel1.add(name, c);
    if (ringPanel) {
        createComponentsForRing(panel1, c);
    } else if (armourPanel) {
        createComponentsForArmour(panel1, c);
    } else if (potionPanel) {
        createComponentsForPotion(panel1, c);
    } else if (treasurePanel) {
        createComponentsForTreasure(panel1, c);
    }
    c.gridx = 0;
    c.gridy = c.gridy + 1;
    c.gridwidth = 2;
    JButton submit = new JButton("Save");
    submit.addActionListener(this);
    submit.setActionCommand("button");
    panel1.add(submit, c);
    c.gridx = 0;
    c.gridy = c.gridy + 1;
    c.gridwidth = 2;
    c.weighty = 0;
    c.weightx = 1;
    validationMess = new JLabel("Pls enter all the fields or pls choose a " + type + " from the drop down");
    validationMess.setForeground(Color.red);
    validationMess.setVisible(false);
    panel1.add(validationMess, c);
    c.gridy++;
    c.weighty = 1;
    c.weightx = 1;
    panel1.add(new JPanel(), c);
    panel1.setBorder(LineBorder.createGrayLineBorder());
    add(panel1);
    add(Box.createVerticalGlue());
}