private void configureVerticalLayout(GroupLayout groupLayout) { groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(projectLbl, GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE) .addComponent(projectBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(editTagLbl, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE) .addComponent(tagSelectBox, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(tagEditLbl, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE) .addComponent(editTagTxtField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(saveBtn, GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE) .addComponent(removeBtn, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)) .addGap(11)) ); }
/** * Create the panel. */ public TextPanel(String text) { JLabel lblUpdateChangelog = new JLabel("Update description/change-log:"); JScrollPane scrollPane = new JScrollPane(); JLabel lblDoYouWant = new JLabel("Do you want to install this update?"); lblDoYouWant.setFont(new Font("Tahoma", Font.PLAIN, 15)); lblDoYouWant.setHorizontalAlignment(SwingConstants.CENTER); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE) .addComponent(lblUpdateChangelog, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE) .addComponent(lblDoYouWant, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)) .addContainerGap()) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addComponent(lblUpdateChangelog) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblDoYouWant) .addContainerGap()) ); JTextArea textArea = new JTextArea(); scrollPane.setViewportView(textArea); setLayout(groupLayout); textArea.setEditable(false); textArea.setText(text); }
@Override public int getPreferredGap(JComponent component1, JComponent component2, ComponentPlacement type, int position, Container parent) { if (component1 == null || component2 == null || type == null) { throw new NullPointerException(); } checkPosition(position); if (type == ComponentPlacement.INDENT && (position == SwingConstants.EAST || position == SwingConstants.WEST)) { int indent = getIndent(component1, position); if (indent > 0) { return indent; } } return (type == ComponentPlacement.UNRELATED) ? 12 : 6; }
private void initComponents() { digitalPanel = new JPanel(); analogPanel = new JPanel(); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(analogPanel, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE).addComponent(digitalPanel, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)) .addGap(0))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addComponent(analogPanel, GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(digitalPanel, GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE) .addGap(0))); setLayout(groupLayout); }
public JKeyBindingPanel(FrameKeyBindings parent, KeyBinding.Type type, KeyBinding binding) { this.parent = parent; JLabel label = new JLabel(" " + type.toString()); label.setPreferredSize(new Dimension(5000, 50)); label.setBorder(BorderFactory.createLineBorder(Color.gray)); btn = new JKeyBindingButton(this, type, binding); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addComponent(label, GroupLayout.PREFERRED_SIZE, 152, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btn, GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(label, GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE) .addComponent(btn, GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE) ); setLayout(groupLayout); }
@Override public int getPreferredGap(JComponent component1, JComponent component2, ComponentPlacement type, int position, Container parent) { if (component1 == null || component2 == null || type == null) { throw new NullPointerException(); } if (type == ComponentPlacement.INDENT && (position == SwingConstants.EAST || position == SwingConstants.WEST)) { int indent = getIndent(component1, position); if (indent > 0) { return indent; } } return (type == ComponentPlacement.UNRELATED) ? 12 : 6; }
public JPanel getPanelPregunta() { if (panelPregunta == null) { panelPregunta = new JPanel(); panelPregunta.setBorder(new EmptyBorder(4, 6, 4, 6)); GroupLayout gl_panelPregunta = new GroupLayout(panelPregunta); gl_panelPregunta .setHorizontalGroup(gl_panelPregunta.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelPregunta.createSequentialGroup() .addComponent(getPanelLetra(), GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(getScrollPane(), GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addGap(1))); gl_panelPregunta.setVerticalGroup(gl_panelPregunta.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelPregunta.createSequentialGroup() .addGroup(gl_panelPregunta.createParallelGroup(Alignment.LEADING) .addComponent(getPanelLetra(), GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE) .addComponent(getScrollPane(), GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panelPregunta.setLayout(gl_panelPregunta); } return panelPregunta; }
private void initialize() { setBorder(new TitledBorder(null, "RS422", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addComponent(getLblPort()) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(getComboBox(), 0, 404, Short.MAX_VALUE) .addContainerGap()) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(getLblPort()) .addComponent(getComboBox(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(280, Short.MAX_VALUE)) ); setLayout(groupLayout); }
public StaticShadowPanel() { TitledBorder border = new TitledBorder(new LineBorder(new Color(128, 128, 128)), Resources.get("panel_staticShadow"), TitledBorder.LEADING, TitledBorder.TOP, null, null); border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD)); setBorder(border); JLabel lblShadowType = new JLabel(Resources.get("panel_shadowType")); comboBoxShadowType = new JComboBox<>(); comboBoxShadowType.setModel(new DefaultComboBoxModel<StaticShadowType>(StaticShadowType.values())); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addComponent(lblShadowType, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addGap(10) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addComponent(comboBoxShadowType, 0, 95, Short.MAX_VALUE) .addGap(4))))); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(comboBoxShadowType, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE) .addComponent(lblShadowType, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); setLayout(groupLayout); this.setupChangedListeners(); }
public EmitterPanel() { TitledBorder border = new TitledBorder(new LineBorder(new Color(128, 128, 128)), Resources.get("panel_emitter"), TitledBorder.LEADING, TitledBorder.TOP, null, null); border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD)); setBorder(border); JLabel lblShadowType = new JLabel(Resources.get("panel_emitterType")); textFieldType = new JTextField(); textFieldType.setColumns(10); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addComponent(lblShadowType, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textFieldType, GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE) .addContainerGap())); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblShadowType, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldType, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); setLayout(groupLayout); this.setupChangedListeners(); }
public GridEditPanel(int rasterSize) { JLabel lblSize = new JLabel("size (px)"); lblSize.setFont(Program.TEXT_FONT.deriveFont(Font.BOLD).deriveFont(10f)); textField = new JFormattedTextField(NumberFormat.getIntegerInstance()); textField.setText("16"); textField.setFont(Program.TEXT_FONT.deriveFont(10f)); textField.setColumns(10); textField.setValue(rasterSize); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addComponent(lblSize, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textField, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE) .addGap(34))); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblSize, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(textField, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addContainerGap(46, Short.MAX_VALUE))); setLayout(groupLayout); }
WidthHeightPanel(boolean showWidth, boolean showHeight) { ResourceBundle bundle = NbBundle.getBundle(BoxFillerInitializer.class); JLabel widthLabel = new JLabel(bundle.getString("BoxFillerInitializer.width")); // NOI18N JLabel heightLabel = new JLabel(bundle.getString("BoxFillerInitializer.height")); // NOI18N widthField = new JSpinner(new SpinnerNumberModel()); heightField = new JSpinner(new SpinnerNumberModel()); GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(widthLabel) .addComponent(heightLabel)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(widthField) .addComponent(heightField)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(widthLabel) .addComponent(widthField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(heightLabel) .addComponent(heightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); widthLabel.setVisible(showWidth); heightLabel.setVisible(showHeight); widthField.setVisible(showWidth); heightField.setVisible(showHeight); }
static Component makeVerticalStrut(JComponent compA, JComponent compB, ComponentPlacement relatedUnrelated, JPanel parent) { int height = LayoutStyle.getInstance().getPreferredGap( compA, compB, relatedUnrelated, SOUTH, parent); return Box.createVerticalStrut(height); }
static Component makeHorizontalStrut(JComponent compA, JComponent compB, ComponentPlacement relatedUnrelated, JPanel parent) { int width = LayoutStyle.getInstance().getPreferredGap( compA, compB, relatedUnrelated, WEST, parent); return Box.createHorizontalStrut(width); }
/** * Create the dialog. */ public ProgressDialog() { setBounds(100, 100, 450, 141); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); lblStatus = new JLabel("Status: Initializing"); lblStatus.setFont(new Font("Tahoma", Font.PLAIN, 12)); pb = new JProgressBar(); GroupLayout gl_contentPanel = new GroupLayout(contentPanel); gl_contentPanel .setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, gl_contentPanel.createSequentialGroup().addContainerGap() .addGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING) .addComponent(pb, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE) .addComponent(lblStatus, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)) .addContainerGap())); gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap().addComponent(lblStatus) .addPreferredGap(ComponentPlacement.RELATED).addComponent(pb, GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE))); contentPanel.setLayout(gl_contentPanel); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
private void computeAll() { if (!_inited) { _baseline = ComponentHelper.maxValues(_children, BaselineExtractor.INSTANCE); _minWidth = ComponentHelper.sumValues(_children, MinWidthExtractor.INSTANCE); _prefWidth = ComponentHelper.sumValues(_children, PrefWidthExtractor.INSTANCE); _height = ComponentHelper.maxValues(_children, PrefHeightExtractor.INSTANCE); ComponentGapsHelper helper = ComponentGapsHelper.instance(); _gaps = new int[_children.size()]; _gap = 0; for (int nth = 0; nth < _children.size() - 1; nth++) { JComponent left = _children.get(nth).component(); JComponent right = _children.get(nth + 1).component(); int gap = helper.getHorizontalGap( left, right, ComponentPlacement.RELATED, _wrapper.parent()); _gaps[nth] = gap; _gap += gap; } _minWidth += _gap; _prefWidth += _gap; if (!_children.isEmpty()) { _gaps[_children.size() - 1] = 0; } _variableHeight = false; for (ComponentizerItem child: _children) { if (_heightTester.canGrowHeight(child.component())) { _variableHeight = true; break; } } _inited = true; } }
public int getHorizontalIndent() { if (_indent == -1) { JLabel label1 = new JLabel("Top label"); JLabel label2 = new JLabel("Bottom label"); _indent = _style.getPreferredGap( label1, label2, ComponentPlacement.INDENT, SwingConstants.SOUTH, null); } return _indent; }
/** * Create the panel. */ public TableCellPanel(Icon buttonIcon) { setMinimumSize(new Dimension(1, 1)); setAlignmentY(Component.TOP_ALIGNMENT); setAlignmentX(Component.LEFT_ALIGNMENT); setBackground(Color.WHITE); btnNewButton = new JButton(""); btnNewButton.setIcon(buttonIcon); btnNewButton.setMinimumSize(new Dimension(107, 1)); lblNewLabel = new JTextField(); lblNewLabel.setFont(new Font("Droid Sans", Font.PLAIN, 11)); lblNewLabel.setMinimumSize(new Dimension(4, 1)); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup() .addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(btnNewButton, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE) .addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE) ); setLayout(groupLayout); }
private GroupLayout makeTweaksLayout(List<JCheckBox> tweaks) { GroupLayout gl = new GroupLayout(miscTweaksPanel); int numTweaks = tweaks.size(); // Handle columns SequentialGroup columnsGroup = gl.createSequentialGroup().addContainerGap(); int numCols = Math.min(TWEAK_COLS, numTweaks); ParallelGroup[] colGroups = new ParallelGroup[numCols]; for (int col = 0; col < numCols; col++) { if (col > 0) { columnsGroup.addGap(18, 18, 18); } colGroups[col] = gl.createParallelGroup(GroupLayout.Alignment.LEADING); columnsGroup.addGroup(colGroups[col]); } for (int tweak = 0; tweak < numTweaks; tweak++) { colGroups[tweak % numCols].addComponent(tweaks.get(tweak)); } columnsGroup.addContainerGap(); gl.setHorizontalGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(columnsGroup)); // And rows SequentialGroup rowsGroup = gl.createSequentialGroup().addContainerGap(); int numRows = (numTweaks - 1) / numCols + 1; ParallelGroup[] rowGroups = new ParallelGroup[numRows]; for (int row = 0; row < numRows; row++) { if (row > 0) { rowsGroup.addPreferredGap(ComponentPlacement.UNRELATED); } rowGroups[row] = gl.createParallelGroup(GroupLayout.Alignment.BASELINE); rowsGroup.addGroup(rowGroups[row]); } for (int tweak = 0; tweak < numTweaks; tweak++) { rowGroups[tweak / numCols].addComponent(tweaks.get(tweak)); } rowsGroup.addContainerGap(); gl.setVerticalGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(rowsGroup)); return gl; }
private void createGroups() { GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addComponent(lblProjectName) .addComponent(lblProjectLocation)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) .addGroup(groupLayout.createSequentialGroup() .addComponent(btnSave) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnCancel)) .addComponent(text_projectLocation) .addComponent(text_projectName, GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)) .addContainerGap(56, Short.MAX_VALUE)) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGap(32) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblProjectName) .addComponent(text_projectName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblProjectLocation) .addComponent(text_projectLocation, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED, 31, Short.MAX_VALUE) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(btnSave) .addComponent(btnCancel)) .addGap(26)) ); getContentPane().setLayout(groupLayout); }
private JPanel getPanel() { if (panel == null) { panel = new JPanel(); GroupLayout groupLayout = new GroupLayout(panel); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(getLblSampledBy()) .addComponent(getLblSampleId())) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(getTextField(), GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE) .addComponent(getComboBox(), 0, 361, Short.MAX_VALUE)) .addContainerGap()) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(getLblSampledBy()) .addComponent(getComboBox(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(getLblSampleId()) .addComponent(getTextField(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(0, Short.MAX_VALUE)) ); panel.setLayout(groupLayout); } return panel; }
private JPanel getSearchPanel() { if (searchPanel == null) { searchPanel = new JPanel(); GroupLayout gl_searchPanel = new GroupLayout(searchPanel); gl_searchPanel.setHorizontalGroup( gl_searchPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_searchPanel.createSequentialGroup() .addContainerGap() .addGroup(gl_searchPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_searchPanel.createSequentialGroup() .addGroup(gl_searchPanel.createParallelGroup(Alignment.LEADING) .addComponent(getChckbxAssociation()) .addComponent(getChckbxConcept())) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_searchPanel.createParallelGroup(Alignment.LEADING) .addComponent(getConceptComboBox(), 0, 309, Short.MAX_VALUE) .addComponent(getAssociationComboBox(), 0, 309, Short.MAX_VALUE))) .addComponent(getBtnSearch(), Alignment.TRAILING)) .addContainerGap()) ); gl_searchPanel.setVerticalGroup( gl_searchPanel.createParallelGroup(Alignment.TRAILING) .addGroup(gl_searchPanel.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(gl_searchPanel.createParallelGroup(Alignment.BASELINE) .addComponent(getChckbxConcept()) .addComponent(getConceptComboBox(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_searchPanel.createParallelGroup(Alignment.BASELINE) .addComponent(getChckbxAssociation()) .addComponent(getAssociationComboBox(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(getBtnSearch())) ); searchPanel.setLayout(gl_searchPanel); } return searchPanel; }
private void initialize() { setBorder(new TitledBorder(null, "UDP", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(getLblHost()) .addComponent(getLblPort())) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(getPortTextField(), GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE) .addComponent(getHostTextField(), GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)) .addContainerGap()) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(getLblHost()) .addComponent(getHostTextField(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(getLblPort()) .addComponent(getPortTextField(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(248, Short.MAX_VALUE)) ); setLayout(groupLayout); }
public PanelFileSelect(String selectedPath, String btnBrowseText, JFileChooser fileChooser) { this.fileChooser = fileChooser; // text field for path inputFilePath = new JTextField(); inputFilePath.setText(selectedPath); inputFilePath.setToolTipText("The selected file"); inputFilePath.setColumns(10); // browse button JButton btnBrowse = new JButton(btnBrowseText); btnBrowse.setToolTipText("Choose a file"); btnBrowse.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { openFile(); } }); // layout GroupLayout layout = new GroupLayout(this); layout.setHorizontalGroup( layout.createParallelGroup(Alignment.LEADING) .addGroup(Alignment.LEADING, layout.createSequentialGroup() .addComponent(inputFilePath, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnBrowse)) ); layout.setVerticalGroup( layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(btnBrowse) .addComponent(inputFilePath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) ); this.setLayout(layout); }
public SpawnpointPanel() { TitledBorder border = new TitledBorder(new LineBorder(new Color(128, 128, 128)), Resources.get("panel_spawnPoint"), TitledBorder.LEADING, TitledBorder.TOP, null, null); border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD)); setBorder(border); JLabel lblShadowType = new JLabel(Resources.get("panel_entity")); textFieldType = new JTextField(); textFieldType.setColumns(10); JLabel lblDirection = new JLabel(Resources.get("panel_direction")); comboBoxDirection = new JComboBox<>(); comboBoxDirection.setModel(new DefaultComboBoxModel<Direction>(Direction.values())); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addComponent(lblShadowType, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textFieldType, GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)) .addGroup(groupLayout.createSequentialGroup() .addComponent(lblDirection, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(comboBoxDirection, 0, 371, Short.MAX_VALUE))) .addGap(4))); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblShadowType, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldType, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblDirection, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(comboBoxDirection, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addContainerGap(226, Short.MAX_VALUE))); setLayout(groupLayout); this.setupChangedListeners(); }
/** * Create the panel. */ public DecorMobPanel() { TitledBorder border = new TitledBorder(new LineBorder(new Color(128, 128, 128)), Resources.get("panel_decorMob"), TitledBorder.LEADING, TitledBorder.TOP, null, null); border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD)); setBorder(border); JLabel lblSprite = new JLabel(Resources.get("panel_sprite")); comboBoxSpriteSheets = new JComboBox<>(); comboBoxSpriteSheets.setRenderer(new MyComboRenderer()); JLabel lblBehaviour = new JLabel(Resources.get("panel_behavior")); comboBoxBehaviour = new JComboBox<>(); comboBoxBehaviour.setModel(new DefaultComboBoxModel<MovementBehavior>(MovementBehavior.values())); lblVvelocity = new JLabel(Resources.get("panel_velocity")); spinnerVelocity = new JSpinner(); spinnerVelocity.setModel(new SpinnerNumberModel(0, 0, 100, 1)); chckbxAttackable = new JCheckBox(Resources.get("panel_attackable")); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addComponent(lblSprite, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(comboBoxSpriteSheets, 0, 95, Short.MAX_VALUE) .addGap(10)) .addGroup(groupLayout.createSequentialGroup() .addComponent(lblBehaviour, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(comboBoxBehaviour, 0, 95, Short.MAX_VALUE) .addContainerGap()) .addGroup(groupLayout.createSequentialGroup() .addComponent(lblVvelocity, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addComponent(chckbxAttackable, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(28)) .addComponent(spinnerVelocity, GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)) .addContainerGap())))); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(lblSprite, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(comboBoxSpriteSheets, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblBehaviour, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(comboBoxBehaviour, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblVvelocity, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(spinnerVelocity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(chckbxAttackable) .addContainerGap(171, Short.MAX_VALUE))); setLayout(groupLayout); this.setupChangedListeners(); }
/** * Create the panel. */ public PropPanel() { TitledBorder border = new TitledBorder(new LineBorder(new Color(128, 128, 128)), Resources.get("panel_prop"), TitledBorder.LEADING, TitledBorder.TOP, null, null); border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD)); setBorder(border); JLabel lblHealth = new JLabel(Resources.get("panel_health")); spinnerHealth = new JSpinner(); spinnerHealth.setModel(new SpinnerNumberModel(100, 0, 1000000, 1)); JLabel lblMaterial = new JLabel(Resources.get("panel_material")); comboBoxMaterial = new JComboBox<>(); comboBoxMaterial.setModel(new DefaultComboBoxModel<Material>(Material.values())); JLabel lblSprite = new JLabel(Resources.get("panel_sprite")); comboBoxSpriteSheets = new JComboBox<>(); comboBoxSpriteSheets.setRenderer(new MyComboRenderer()); chckbxIndestructible = new JCheckBox(Resources.get("panel_destructible")); chckbxIsObstacle = new JCheckBox(Resources.get("panel_isObstacle")); chckbxShadow = new JCheckBox("shadow"); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(lblHealth, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addComponent(lblMaterial, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addComponent(lblSprite, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(chckbxShadow, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addComponent(comboBoxMaterial, 0, 365, Short.MAX_VALUE) .addComponent(spinnerHealth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(comboBoxSpriteSheets, 0, 365, Short.MAX_VALUE) .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false) .addComponent(chckbxIsObstacle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(chckbxIndestructible, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap())); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblHealth, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(spinnerHealth, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(lblMaterial, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE) .addComponent(comboBoxMaterial, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(comboBoxSpriteSheets, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblSprite, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxIndestructible) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(chckbxIsObstacle, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxShadow, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addContainerGap(138, Short.MAX_VALUE))); setLayout(groupLayout); this.setupChangedListeners(); }