Java 8 GridBagLayout - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 GridBagLayout class.

This code example shows how to use the following methods:
	String title;
 
	public Chart (String title) {
		this.title = title;
 
		setLayout(new GridBagLayout());
 
		addMouseListener(new MouseAdapter() {
			public void mousePressed (MouseEvent event) {
				movingIndex = overIndex;
			} 
 
			public void mouseReleased (MouseEvent event) {
				movingIndex = -1;
			} 
 
			public void mouseClicked (MouseEvent event) {
				if (event.getClickCount() == 2) {
					if (overIndex <= 0 || overIndex >= points.size()) return;
					points.remove(overIndex);
8
CodeRank
This code example shows how to use the following methods:
        initializeComponent(); 
    } 
 
    private void initializeComponent() { 
        JPanel panel = new JPanel();
        panel.setLayout(new GridBagLayout());
        getRootPane().setLayout(new BorderLayout());
        getRootPane().add(panel, BorderLayout.CENTER);
 
        processIdTextField = new JTextField("com.sample.ruleflow");
        GridBagConstraints c = new GridBagConstraints();
        c.weightx = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.insets = new Insets(5, 5, 5, 5);
        panel.add(processIdTextField, c);
 
        startButton = new JButton("Start");
        startButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                start(); 
8
CodeRank
This code example shows how to use the following methods:
   private Icon fErrorIcon= SikuliIDE.getIconResource("/icons/error.gif");
 
   private int fTotal;
 
   public CounterPanel() { 
      super(new GridBagLayout());
      fNumberOfErrors= createOutputField(2);
      fNumberOfFailures= createOutputField(2);
      fNumberOfRuns= createOutputField(3);
 
      addToGrid(new JLabel("Runs:", SwingConstants.CENTER),
            0, 0, 1, 1, 0.0, 0.0, 
            GridBagConstraints.LINE_START, GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0));
      addToGrid(fNumberOfRuns,
            1, 0, 1, 1, 0.33, 0.0, 
            GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL,
            new Insets(0, 8, 0, 0));
 
      addToGrid(new JLabel("Errors:", fErrorIcon, SwingConstants.LEFT),
8
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
 
    private int rowCount;
    private int cellpadding;
 
    public TableLayout() { 
        setLayout(new GridBagLayout());
    } 
     
    public int getCellpadding() { 
        return cellpadding;
    } 
 
    public void setCellpadding(int cellpadding) {
        this.cellpadding = cellpadding;
    } 
 
    /** 
     * Adds a new cell to the current grid 
     * @param cell the td component 
     */ 
8
CodeRank
This code example shows how to use the following methods:
    public void setRecentURLsModel(final RecentURLsModel recentURLsModel) {
        this.autoCompletionComboBox.setRecentURLsModel(recentURLsModel);
    } 
 
    public void actionPerformed(final ActionEvent e) {
        final JPanel panel = new JPanel(new GridBagLayout());
        final GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.anchor = GridBagConstraints.WEST;
        panel.add(autoCompletionComboBox, gridBagConstraints);
        gridBagConstraints.gridy = 1;
 
        final JCheckBox addURLCheckBox = new JCheckBox(LocalisationHelper.getString("urlopen_dialog_add_checkbox"), false);
        final boolean aDocumentIsAlreadyOpen = gcViewer.getSelectedGCDocument() != null;
        addURLCheckBox.setVisible(aDocumentIsAlreadyOpen);
        addURLCheckBox.setEnabled(aDocumentIsAlreadyOpen);
        addURLCheckBox.setToolTipText(LocalisationHelper.getString("urlopen_dialog_hint_add_checkbox"));
        panel.add(addURLCheckBox, gridBagConstraints);
        final int result = JOptionPane.showConfirmDialog(gcViewer, panel, LocalisationHelper.getString("urlopen_dialog_title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
        if (JOptionPane.OK_OPTION == result) {
            try { 
7
CodeRank
This code example shows how to use the following methods:
    private JCheckBox cbWritePrefs;
    private JCheckBox cbReadPrefs;
    private JCheckBox cbModifyNotes;
 
    protected final void build() { 
        setLayout(new GridBagLayout());
        GridBagConstraints gc = new GridBagConstraints();
        setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
 
        // checkbox for "allow to upload map data" 
        // 
        gc.anchor = GridBagConstraints.NORTHWEST;
        gc.fill = GridBagConstraints.HORIZONTAL;
        gc.weightx = 1.0;
        gc.insets = new Insets(0,0,3,3);
        add(cbWriteApi = new JCheckBox(), gc);
        cbWriteApi.setText(tr("Allow to upload map data"));
        cbWriteApi.setToolTipText(tr("Select to grant JOSM the right to upload map data on your behalf"));
        cbWriteApi.setSelected(true);
 
7
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
 
    /** 
     * builds the UI 
     */ 
    protected final void build() { 
        setLayout(new GridBagLayout());
        GridBagConstraints gc = new GridBagConstraints();
 
        AuthenticationMethodChangeListener authChangeListener = new AuthenticationMethodChangeListener();
 
        // -- radio button for basic authentication 
        gc.anchor = GridBagConstraints.NORTHWEST;
        gc.fill = GridBagConstraints.HORIZONTAL;
        gc.weightx = 0.0;
        gc.insets = new Insets(0,0,0, 3);
        add(rbBasicAuthentication = new JRadioButton(), gc);
        rbBasicAuthentication.setText(tr("Use Basic Authentication"));
        rbBasicAuthentication.setToolTipText(tr("Select to use HTTP basic authentication with your OSM username and password"));
        rbBasicAuthentication.addItemListener(authChangeListener);
 
7
CodeRank
This code example shows how to use the following methods:
    /** 
     * @return true if it was confirmed and false otherwise 
     */ 
    public static boolean showStringAndConfirm(String strToShow) {
        final JDialog dialog = new JDialog(new JFrame(), true);
        dialog.setLayout(new GridBagLayout());
 
        //text area 
        JPanel panel = new JPanel(new BorderLayout());
        JTextArea field = new JTextArea();
        field.setText(strToShow);
        panel.add(field, BorderLayout.CENTER);
 
        GridBagConstraints g = new GridBagConstraints();
        g.weightx = 1;
        g.weighty = 0.9;
        g.fill = GridBagConstraints.BOTH;
        dialog.add(panel, g);
        final Boolean[] confirmed = new Boolean[] { false };
 
7
CodeRank
See Code Examples for Java 8 GridBagLayout Methods: