protected GridBagConstraints getDefaultConstraints() { GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.gridheight = 1; // One row high // Insets() args are top, left, bottom, right constraints.insets = new Insets(4, 4, 4, 4); // fill of NONE means do not change size constraints.fill = GridBagConstraints.NONE; // WEST means align left constraints.anchor = GridBagConstraints.WEST; return constraints; }
public static void addContent( JPanel panel, int row, int column, JComponent component, boolean addBorders, int anchor, int fill, float wx, float wy){ if(addBorders) component.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, java.awt.Color.black)); panel.add(component, new GridBagConstraints(column, row, 1, 1, wx, wy, anchor, fill, new Insets(0, 0, 0, 0), 0, 0)); }
private void uiLayout () { title.setLayout(new GridLayout(1, 2)); minimize.setPreferredSize(new Dimension(50, 26)); exit.setPreferredSize(new Dimension(50, 26)); title.add(minimize); title.add(exit); topBar.setLayout(new GridLayout(1, 1)); topBar.add(windowLabel, new GridBagConstraints(0, 0, 0, 0, 0, 0, NORTHWEST, VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); setLayout(new GridBagLayout()); add(topBar, new GridBagConstraints(0, 0, 0, 0, 0, 0, NORTH, HORIZONTAL, new Insets(0, 0, 0, 100), 0, 10)); add(title, new GridBagConstraints(0, 0, 0, 0, 0, 0, NORTHEAST, NONE, new Insets(0, 0, 0, 0), 0, 0)); add(logo, new GridBagConstraints(0, 0, 1, 1, 1, 0, CENTER, HORIZONTAL, new Insets(40, 6, 6, 6), 0, 0)); add(form, new GridBagConstraints(0, 1, 1, 1, 1, 0, CENTER, HORIZONTAL, new Insets(6, 6, 0, 6), 0, 0)); add(buttonPanel, new GridBagConstraints(0, 2, 1, 1, 0, 0, CENTER, NONE, new Insets(0, 0, 0, 0), 0, 0)); add(scrollPane, new GridBagConstraints(0, 3, 1, 1, 1, 1, CENTER, BOTH, new Insets(6, 6, 6, 6), 0, 0)); }
GridBagLayout gridBag = new GridBagLayout(); GridBagConstraints constraints; Insets insets; JLabel filenameLabel = new JLabel("Filename:"); filenameLabel.setLabelFor(filename); insets = new Insets(12, 12, 0, 0); // top, left, bottom, right constraints = new GridBagConstraints( 0, 0, 1, 1, // x, y, width, height 0.0, 0.0, // weightx, weighty contentPane.add(filenameLabel); insets = new Insets(12, 7, 0, 12); // top, left, bottom, right constraints = new GridBagConstraints( 1, 0, 1, 1, // x, y, width, height 1.0, 1.0, // weightx, weighty insets = new Insets(0, 12, 12, 12); // top, left, bottom, right constraints = new GridBagConstraints( 0, 2, 2, 1, // x, y, width, height 1.0, 1.0, // weightx, weighty
public SettingsGroup(String title) { setBorder(BorderFactory.createTitledBorder(title)); setLayout(new GridBagLayout()); c = new GridBagConstraints(); c.insets = new Insets(5, 5, 5, 5); c.weighty = 1.0; }
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { rootPanel = new JPanel(); rootPanel.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); repositoriesLabel = new JLabel(); repositoriesLabel.setText("Additional repositories"); rootPanel.add(repositoriesLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); rootPanel.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); rootPanel.add(spacer2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JScrollPane scrollPane1 = new JScrollPane(); rootPanel.add(scrollPane1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); repositoriesTextArea = new JTextArea(); repositoriesTextArea.setMaximumSize(new Dimension(420, 2147483647)); repositoriesTextArea.setMinimumSize(new Dimension(300, 10)); repositoriesTextArea.setPreferredSize(new Dimension(300, 50)); repositoriesTextArea.setText(ResourceBundle.getBundle("com/github/gtache/lsp/LSPBundle").getString("coursier.settings.textarea.basetext")); repositoriesTextArea.setToolTipText("Insert one resolver by line"); scrollPane1.setViewportView(repositoriesTextArea); }
private void initializeComponents () { JPanel contentPanel = getContentPanel(); { JLabel label = new JLabel("Value:"); contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0)); } { valueSpinner = new JSpinner(new SpinnerNumberModel(new Float(0), new Float(-99999), new Float(99999), new Float(0.1f))); contentPanel.add(valueSpinner, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } } }
void addEditorRow (JPanel row) { row.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, java.awt.Color.black)); editRowsPanel.add(row, new GridBagConstraints(0, -1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); }
private static final Insets WEST_INSETS = new Insets(5, 0, 5, 5); private static final Insets EAST_INSETS = new Insets(5, 5, 5, 0); private Map<FieldTitle, JTextField> fieldMap = new HashMap<FieldTitle, JTextField>(); setLayout(new GridBagLayout()); setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Player Editor"), FieldTitle fieldTitle = FieldTitle.values()[i]; gbc = createGbc(0, i); add(new JLabel(fieldTitle.getTitle() + ":", JLabel.LEFT), gbc); gbc = createGbc(1, i); JTextField textField = new JTextField(10); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = x; gbc.gridy = y;
public GridBagHelper(Container container, double[] weights) { this.container = container; this.weights = weights; gridbag = new GridBagLayout(); container.setLayout(gridbag); c = new GridBagConstraints(); c.insets = new Insets(2, 2, 2, 2); c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; }
rootPanel = new JPanel(); rootPanel.setLayout(new GridLayoutManager(9, 4, new Insets(5, 5, 0, 0), -1, -1)); final Spacer spacer1 = new Spacer(); rootPanel.add(spacer1, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JLabel label1 = new JLabel(); Font label1Font = this.$$$getFont$$$(null, Font.BOLD, 20, label1.getFont()); if (label1Font != null) label1.setFont(label1Font); rootPanel.add(spacer10, new GridConstraints(6, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); alwaysSendRequestsCheckBox = new JCheckBox(); alwaysSendRequestsCheckBox.setMargin(new Insets(2, 2, 2, 2)); alwaysSendRequestsCheckBox.setText("Always send requests"); alwaysSendRequestsCheckBox.setToolTipText("Send requests even if a language plugin already supports it");
private void initializeComponents () { JPanel contentPanel = getContentPanel(); { JLabel label = new JLabel("Value:"); contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0)); } { valueSpinner = new JSpinner(new SpinnerNumberModel(new Float(0), new Float(-99999), new Float(99999), new Float(0.1f))); contentPanel.add(valueSpinner, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } } }
void addRow(JPanel panel, JPanel row, float wx, float wy) { row.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, java.awt.Color.black)); panel.add(row, new GridBagConstraints(0, -1, 1, 1, wx, wy, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); }
lStatus = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); cbSelected.setMargin(new java.awt.Insets(0, 0, 0, 0)); cbSelected.setPreferredSize(new java.awt.Dimension(200, 18)); cbSelected.addItemListener(new java.awt.event.ItemListener() { gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.5; gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0); add(cbSelected, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(bDetails, gridBagConstraints); lStatus.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lStatus.setText((desc.isUpdateAvailable() ? "Update available" : desc.getStatus().toString())); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 5); add(lStatus, gridBagConstraints);
public ColorSlider (Color[] paletteColors) { this.paletteColors = paletteColors; setLayout(new GridBagLayout()); { slider = new JSlider(0, 1000, 0); slider.setPaintTrack(false); add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0)); } { colorPicker = new ColorPicker(); add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0)); } slider.addChangeListener(new ChangeListener() { public void stateChanged (ChangeEvent event) { colorPicked(); } }); }
private void initializeComponents () { JPanel contentPanel = getContentPanel(); { JLabel label = new JLabel("Min:"); contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0)); } { minSlider = new Slider(0, 0, 99999, 1, 0, 500); contentPanel.add(minSlider, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } { JLabel label = new JLabel("Max:"); contentPanel.add(label, new GridBagConstraints(2, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 0, 6), 0, 0)); } { maxSlider = new Slider(0, 0, 99999, 1, 0, 500); contentPanel.add(maxSlider, new GridBagConstraints(3, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } } }
void addRow(JPanel panel, JPanel row, float wx, float wy) { row.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, java.awt.Color.black)); panel.add(row, new GridBagConstraints(0, -1, 1, 1, wx, wy, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); }
lStatus = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); cbSelected.setMargin(new java.awt.Insets(0, 0, 0, 0)); cbSelected.setPreferredSize(new java.awt.Dimension(200, 18)); cbSelected.addItemListener(new java.awt.event.ItemListener() { gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.5; gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0); add(cbSelected, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5); add(bDetails, gridBagConstraints); lStatus.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lStatus.setText((desc.isUpdateAvailable() ? "Update available" : desc.getStatus().toString())); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 5); add(lStatus, gridBagConstraints);
public ColorSlider (Color[] paletteColors) { this.paletteColors = paletteColors; setLayout(new GridBagLayout()); { slider = new JSlider(0, 1000, 0); slider.setPaintTrack(false); add(slider, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0)); } { colorPicker = new ColorPicker(); add(colorPicker, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 6), 0, 0)); } slider.addChangeListener(new ChangeListener() { public void stateChanged (ChangeEvent event) { colorPicked(); } }); }
private void initializeComponents () { JPanel contentPanel = getContentPanel(); { JLabel label = new JLabel("Min:"); contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0)); } { minSlider = new Slider(0, 0, 99999, 1, 0, 500); contentPanel.add(minSlider, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } { JLabel label = new JLabel("Max:"); contentPanel.add(label, new GridBagConstraints(2, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 0, 6), 0, 0)); } { maxSlider = new Slider(0, 0, 99999, 1, 0, 500); contentPanel.add(maxSlider, new GridBagConstraints(3, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } } }