protected Component createCustomEditorGUI(Component resourcePanelGUI) { if (resourcePanelGUI == null) return delegateEditor.getCustomEditor(); JPanel panel = new JPanel(); Component delComp = delegateEditor.getCustomEditor(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setAutoCreateGaps(true); layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(delComp) .addGroup(layout.createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(resourcePanelGUI) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED))); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(delComp).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(resourcePanelGUI)); return panel; }
private GroupLayout.ParallelGroup getVerticalGroup (GroupLayout layout, boolean hasPrimary, boolean hasRequired) { GroupLayout.ParallelGroup res = layout.createParallelGroup (/* XXX huh? GroupLayout.PREFERRED_SIZE*/); GroupLayout.SequentialGroup seq = layout.createSequentialGroup (); if (hasPrimary) { seq.addComponent (tpPrimaryTitle, GroupLayout.DEFAULT_SIZE, 40, 40) .addPreferredGap (LayoutStyle.ComponentPlacement.RELATED) .addComponent (tpPrimaryPlugins, GroupLayout.PREFERRED_SIZE, tpPrimaryPlugins.getPreferredSize ().height, GroupLayout.PREFERRED_SIZE) .addPreferredGap (LayoutStyle.ComponentPlacement.RELATED) .addGap (0, 30, 30); } if (hasRequired) { seq.addComponent (tpDependingTitle, GroupLayout.DEFAULT_SIZE, 80, 80) .addPreferredGap (LayoutStyle.ComponentPlacement.RELATED) .addComponent (tpDependingPlugins, GroupLayout.PREFERRED_SIZE, tpDependingPlugins.getPreferredSize ().height, GroupLayout.PREFERRED_SIZE) .addPreferredGap (LayoutStyle.ComponentPlacement.RELATED); } res.addGroup (seq); return res; }
private void init() { errorLabel.setText(" "); // NOI18N GroupLayout containerPanelLayout = new GroupLayout(containerPanel); containerPanel.setLayout(containerPanelLayout); GroupLayout.ParallelGroup horizontalGroup = containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); GroupLayout.SequentialGroup verticalGroup = containerPanelLayout.createSequentialGroup(); containerPanelLayout.setHorizontalGroup(horizontalGroup); containerPanelLayout.setVerticalGroup( containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(verticalGroup) ); for (CssPreprocessorUIImplementation.Options options : allOptions) { JComponent component = options.getComponent(); Parameters.notNull("component", component); // NOI18N horizontalGroup.addComponent(component, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); verticalGroup.addComponent(component, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED); } }
private static JPanel searchingPanel(JLabel progressLabel, JComponent progressComponent) { JPanel panel = new JPanel(); progressLabel.setLabelFor(progressComponent); javax.swing.GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(progressLabel, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(progressComponent, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(96, 96, 96) .addComponent(progressLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(progressComponent, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(109, Short.MAX_VALUE)) ); return panel; }
void layoutDisplay( int clockTop ) { displayLayout.setHorizontalGroup( displayLayout.createParallelGroup( GroupLayout.Alignment.CENTER) .addComponent(piePanel) .addComponent( ((clockTop==1)?timePanel:messagePanel) ) .addComponent(datePanel) .addComponent(((clockTop==1)?messagePanel:timePanel))); displayLayout.setVerticalGroup( displayLayout.createSequentialGroup() .addComponent(piePanel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(((clockTop==1)?timePanel:messagePanel)) .addComponent(datePanel) .addComponent(((clockTop==1)?messagePanel:timePanel))); displayPanel.validate(); }
private void setButtonPanelLayout() { GroupLayout buttonPanelLayout = new GroupLayout( buttonPanel ); buttonPanel.setLayout( buttonPanelLayout ); buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createParallelGroup( GroupLayout.Alignment.LEADING ) .addGroup( GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap( 248, Short.MAX_VALUE ).addComponent( okButton ).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED ).addComponent( detailsButton ).addGap( 20, 20, 20 ) ) ); buttonPanelLayout.setVerticalGroup( buttonPanelLayout.createParallelGroup( GroupLayout.Alignment.LEADING ) .addGroup( GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap( GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addGroup( buttonPanelLayout.createParallelGroup( GroupLayout.Alignment.BASELINE ).addComponent( okButton ).addComponent( detailsButton ) ).addContainerGap() ) ); }
private void initGUI() { // Fill dropdown. String[] items = this.classnames.keySet().toArray(new String[0]); this.dropdown = new JComboBox<String>(items); // Select current generator in dropdown. for(int i = 0; i < items.length; i++) { if (this.generator.getName().equals(items[i])) { this.dropdown.setSelectedIndex(i); } } // Create label. JLabel dropdownLabel = new JLabel("Generator:"); dropdownLabel.setLabelFor(this.dropdown); dropdownLabel.setHorizontalAlignment(JLabel.TRAILING); // Initialize layout and add components to GUI. GroupLayout layout = new GroupLayout(this.panel); this.panel.setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout .createSequentialGroup() .addComponent(dropdownLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(this.dropdown) ); layout.setVerticalGroup(layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(dropdownLabel) .addComponent(this.dropdown) ); }
private void createAttachment (AttachmentInfo newAttachment) { AttachmentPanel attachment = new AttachmentPanel(nbCallback); attachment.setBackground(UIUtils.getSectionPanelBackground()); horizontalGroup.addComponent(attachment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); verticalGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); verticalGroup.addComponent(attachment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); if (noneLabel.isVisible()) { noneLabel.setVisible(false); switchHelper(); updateButtonText(false); } attachment.addPropertyChangeListener(getDeletedListener()); if (newAttachment != null) { attachment.setAttachment(newAttachment.getFile(), newAttachment.getDescription(), newAttachment.getContentType(), newAttachment.isPatch()); } if(nbCallback != null) { File f = new File(Places.getUserDirectory(), nbCallback.getLogFilePath()); if(f.exists()) { attachment.setAttachment(f, nbCallback.getLogFileDescription(), nbCallback.getLogFileContentType(), false); // NOI18N } attachment.browseButton.setEnabled(false); attachment.fileField.setEnabled(false); attachment.fileTypeCombo.setEnabled(false); attachment.patchChoice.setEnabled(false); } else { attachment.viewButton.setVisible(false); } newAttachments.add(attachment); UIUtils.keepFocusedComponentVisible(attachment, parentPanel); revalidate(); attachment.addChangeListener(getChangeListener()); attachment.fileField.requestFocus(); if (nbCallback != null) { supp.fireChange(); } }
@Override protected Component createCustomEditorGUI(Component resourcePanelGUI) { if (resourcePanelGUI == null && ResourceSupport.isResourceableProperty(property)) { // not usable for full resourcing, only for internationalization // add a NOI18N checkbox so the user can mark the property as not to be internationalized Component customEd = delegateEditor.getCustomEditor(); JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); noI18nCheckbox = new JCheckBox(); Mnemonics.setLocalizedText(noI18nCheckbox, NbBundle.getMessage(StringEditor.class, "CTL_NOI18NCheckBox")); // NOI18N noI18nCheckbox.getAccessibleContext().setAccessibleDescription( NbBundle.getBundle( StringEditor.class).getString("ACD_NOI18NCheckBox")); //NOI18N layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(customEd) .addGroup(layout.createSequentialGroup() .addContainerGap().addComponent(noI18nCheckbox).addContainerGap())); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(customEd).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(noI18nCheckbox)); return panel; } else { noI18nCheckbox = null; return super.createCustomEditorGUI(resourcePanelGUI); } }
private Component makeVerticalStrut(JComponent compA, JComponent compB, LayoutStyle.ComponentPlacement relatedUnrelated) { int height = LayoutStyle.getInstance().getPreferredGap( compA, compB, relatedUnrelated, SOUTH, this); return Box.createVerticalStrut(height); }
private Component makeHorizontalStrut(JComponent compA, JComponent compB, LayoutStyle.ComponentPlacement relatedUnrelated) { int width = LayoutStyle.getInstance().getPreferredGap( compA, compB, relatedUnrelated, WEST, this); return Box.createHorizontalStrut(width); }
private static Component makeVerticalStrut(JComponent compA, JComponent compB) { LayoutStyle layoutStyle = LayoutStyle.getInstance(); return Box.createVerticalStrut( layoutStyle.getPreferredGap(compA, compB, UNRELATED, SOUTH, compA.getParent())); }
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); }
private void layoutHeaderPanel(JPanel headerPanel, JLabel iconLabel, JLabel leftLabel, JLabel commentLabel, JLabel rightLabel, LinkButton replyButton, LinkButton mailtoButton, JLabel stateLabel) { GroupLayout layout = new GroupLayout(headerPanel); headerPanel.setLayout(layout); GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup() .addComponent(iconLabel) .addComponent(leftLabel); if (stateLabel != null) { hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(stateLabel); } hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(commentLabel,0, 0, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(rightLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(replyButton); if (mailtoButton != null) { hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(mailtoButton); } layout.setHorizontalGroup(hGroup); GroupLayout.ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(iconLabel) .addComponent(leftLabel); if (stateLabel != null) { vGroup.addComponent(stateLabel); } vGroup.addComponent(commentLabel) .addComponent(rightLabel) .addComponent(replyButton); if (mailtoButton != null) { vGroup.addComponent(mailtoButton); } layout.setVerticalGroup(vGroup); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { configureButton = new JButton(); mainTabbedPane = new JTabbedPane(); Mnemonics.setLocalizedText(configureButton, NbBundle.getMessage(CssPreprocessorsCustomizerPanel.class, "CssPreprocessorsCustomizerPanel.configureButton.text")); // NOI18N configureButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { configureButtonActionPerformed(evt); } }); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(mainTabbedPane, GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(configureButton)) ); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(configureButton) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(mainTabbedPane, GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE)) ); }
public static JComponent addContainerBorder(JComponent comp) { final LayoutStyle layoutStyle = LayoutStyle.getInstance(); JPanel panel = new JPanel(); panel.add(comp); panel.setBorder(BorderFactory.createEmptyBorder( layoutStyle.getContainerGap(comp, SwingConstants.NORTH, null), layoutStyle.getContainerGap(comp, SwingConstants.WEST, null), layoutStyle.getContainerGap(comp, SwingConstants.SOUTH, null), layoutStyle.getContainerGap(comp, SwingConstants.EAST, null))); return panel; }
private JPanel createControllerPanel() { JPanel controllerPanel = new JPanel(); JLabel pane = new JLabel(); pane.setText(NbBundle.getMessage(FakeJiraConnector.class, "MSG_NOT_YET_INSTALLED")); // NOI18N JButton downloadButton = new JButton(); downloadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JiraUpdater.getInstance().downloadAndInstall(null); } }); org.openide.awt.Mnemonics.setLocalizedText(downloadButton, org.openide.util.NbBundle.getMessage(FakeJiraConnector.class, "MissingJiraSupportPanel.downloadButton.text")); // NOI18N GroupLayout layout = new GroupLayout(controllerPanel); controllerPanel.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(pane, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(downloadButton)) ); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(pane) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(downloadButton)) .addContainerGap()) ); return controllerPanel; }
private static void addInsetsToPanel(JComponent comp) { LayoutStyle layoutStyle = LayoutStyle.getInstance(); comp.setBorder(BorderFactory.createEmptyBorder( layoutStyle.getContainerGap(comp, NORTH, null), layoutStyle.getContainerGap(comp, WEST, null), layoutStyle.getContainerGap(comp, SOUTH, null), layoutStyle.getContainerGap(comp, EAST, null))); }
private int getSpace(JComponent parent, JComponent compA, JComponent compB, LayoutStyle.ComponentPlacement related, int horizontal) { return LayoutStyle.getInstance() .getPreferredGap(compA, compB, related, (horizontal == HORIZONTAL) ? EAST : SOUTH, parent); }
private void initComponents() { nameLabel = new EditableJLabel("Name"); separatorLabel = new JLabel(); valueLabel = new EditableJLabel("Value"); iconLabel = new JLabel(); nameLabel.getLabel().setFont(nameLabel.getLabel().getFont().deriveFont(nameLabel.getLabel().getFont().getStyle() | Font.BOLD)); separatorLabel.setText(":"); iconLabel.setText(" "); iconLabel.setIconTextGap(0); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addGap(5, 5, 5) .addComponent(nameLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(separatorLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(valueLabel) .addGap(0, 0, 0)) ); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(nameLabel) .addComponent(separatorLabel) .addComponent(valueLabel) .addComponent(iconLabel)) ); }
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { nameLabel = new JLabel(); separatorLabel = new JLabel(); valueLabel = new JLabel(); nameLabel.setFont(nameLabel.getFont().deriveFont(nameLabel.getFont().getStyle() | Font.BOLD)); nameLabel.setText("Name"); separatorLabel.setText(":"); valueLabel.setText("Value"); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(0, 0, 0) .addComponent(nameLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(separatorLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(valueLabel) .addGap(0, 0, 0)) ); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(nameLabel) .addComponent(separatorLabel) .addComponent(valueLabel)) ); }
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { footerMessage = new JLabel(); messageIconLabel = new JLabel(); setBorder(BorderFactory.createEtchedBorder()); footerMessage.setHorizontalAlignment(SwingConstants.RIGHT); footerMessage.setText(" "); footerMessage.setHorizontalTextPosition(SwingConstants.RIGHT); messageIconLabel.setText(" "); messageIconLabel.setIconTextGap(0); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(footerMessage, GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(messageIconLabel) .addContainerGap()) ); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, 0) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(footerMessage) .addComponent(messageIconLabel, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))) ); }
private void initComponents() { this.jScrollPane1 = new JScrollPane(); this.jTextArea1 = new JTextArea(); this.jButton1 = new JButton(); this.jLabel1 = new JLabel(); setDefaultCloseOperation(2); setTitle("调试窗口"); setResizable(false); this.jTextArea1.setColumns(20); this.jTextArea1.setLineWrap(true); this.jTextArea1.setRows(5); this.jScrollPane1.setViewportView(this.jTextArea1); this.jButton1.setText("测试封包"); this.jButton1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { DebugWindow.this.jButton1ActionPerformed(evt); } }); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(this.jScrollPane1, -1, 446, 32767).addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(this.jLabel1, -1, -1, 32767).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.jButton1))).addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.jScrollPane1, -1, 253, 32767).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false).addComponent(this.jButton1).addGroup(layout.createSequentialGroup().addGap(0, 0, 0).addComponent(this.jLabel1, -1, -1, 32767))).addContainerGap())); pack(); }
private void setDetailsLayout() { mainFrame.setPreferredSize( new Dimension( 450, 480 ) ); GroupLayout mainFrameLayout = new GroupLayout( mainFrame.getContentPane() ); mainFrame.getContentPane().setLayout( mainFrameLayout ); mainFrameLayout.setHorizontalGroup( mainFrameLayout.createParallelGroup( GroupLayout.Alignment.LEADING ) .addGroup( mainFrameLayout.createSequentialGroup().addContainerGap().addGroup( mainFrameLayout.createParallelGroup( GroupLayout.Alignment.LEADING ).addComponent( detailsTextAreaPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addComponent( errorTablePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ).addComponent( buttonPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ) ).addContainerGap() ) ); mainFrameLayout.setVerticalGroup( mainFrameLayout.createParallelGroup( GroupLayout.Alignment.LEADING ) .addGroup( mainFrameLayout.createSequentialGroup().addContainerGap().addComponent( errorTablePanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE ) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent( detailsTextAreaPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE ).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent( buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE ).addContainerGap() ) ); }
private JPanel buildDirectionalityPanel() { JLabel directionalityLabel = new JLabel("Directionality"); undirButton = new JRadioButton("Undirected"); dirButton = new JRadioButton("Directed"); dirButton.setEnabled(false); ButtonGroup directionality = new ButtonGroup(); directionality.add(undirButton); directionality.add(dirButton); undirButton.setSelected(true); JPanel res = new JPanel(); GroupLayout layout = new GroupLayout(res); layout.setHorizontalGroup( layout.createParallelGroup() .addComponent(directionalityLabel) .addComponent(undirButton) .addComponent(dirButton) ); layout.setVerticalGroup( layout.createSequentialGroup() .addComponent(directionalityLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(undirButton) .addComponent(dirButton) ); res.setLayout(layout); return res; }
private void getPanel() { // Info btnInfo = Formats.getFormattedBoldButton(sInfo); // Info btnInfo.addActionListener(this); // Exit btnExit = Formats.getFormattedBoldButton(sExit); // Exit btnExit.addActionListener(this); // layout GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createSequentialGroup() .addGap(5, 5, 5) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnInfo, 110, 110, 110) .addGap(3, 3, 3) .addComponent(btnExit, 110, 110, 110) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(5, 5, 5)); layout.setVerticalGroup( layout.createSequentialGroup() .addGap(8, 8, 8) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(btnInfo) .addComponent(btnExit)) .addGap(8, 8, 8)); }
private void createLayout() { this.setLayout(layout = new GroupLayout(this)); setFloatable(false); SequentialGroup hGroup = layout.createSequentialGroup(); ParallelGroup pGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); boolean isSubst = LookAndFeelManager.isSubstance(); for(int i = 0; i < BUTTONCOUNT; i++) { if (isSubst) { hGroup.addComponent(buttons[i], sizes[i], buttons[i].getPreferredSize().width, Short.MAX_VALUE); pGroup.addComponent(buttons[i], 0, buttons[i].getPreferredSize().height, Short.MAX_VALUE); } else { hGroup.addComponent(buttons[i]); pGroup.addComponent(buttons[i]); } hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE); final int fi = i; buttons[i].addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { onClick(fi); } }); } if (isSubst) { hGroup.addGap(4); } layout.setHorizontalGroup(hGroup); layout.setVerticalGroup(pGroup); }
private JPanel getSearchPanel() { if (searchPanel == null) { searchPanel = new JPanel(); GroupLayout gl_searchPanel = new GroupLayout(searchPanel); gl_searchPanel .setHorizontalGroup(gl_searchPanel.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(gl_searchPanel.createSequentialGroup().addContainerGap() .addGroup(gl_searchPanel.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(gl_searchPanel.createSequentialGroup() .addGroup(gl_searchPanel.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(getChckbxAssociation()).addComponent(getChckbxConcept())) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(gl_searchPanel.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(getConceptComboBox(), 0, 309, Short.MAX_VALUE) .addComponent(getAssociationComboBox(), 0, 309, Short.MAX_VALUE))) .addComponent(getBtnSearch(), GroupLayout.Alignment.TRAILING)) .addContainerGap())); gl_searchPanel .setVerticalGroup(gl_searchPanel.createParallelGroup(GroupLayout.Alignment.TRAILING) .addGroup(gl_searchPanel.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(gl_searchPanel.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getChckbxConcept()) .addComponent(getConceptComboBox(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(gl_searchPanel .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getChckbxAssociation()) .addComponent(getAssociationComboBox(), GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement .RELATED).addComponent(getBtnSearch()))); searchPanel.setLayout(gl_searchPanel); } return searchPanel; }
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JPanel panel = new JPanel(); if (value instanceof String[]) { String[] valueArray = (String[]) value; if (valueArray.length == 0) return panel; GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); SequentialGroup cols = layout.createSequentialGroup(); layout.setHorizontalGroup(cols); ParallelGroup col1 = layout .createParallelGroup(GroupLayout.Alignment.LEADING); ParallelGroup col2 = layout .createParallelGroup(GroupLayout.Alignment.TRAILING); cols.addGroup(col1) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(col2); SequentialGroup rows = layout.createSequentialGroup(); layout.setVerticalGroup(rows); for (int i = 0; i < valueArray.length; i++) { // the value array has null elements for // IdResource/Demand if (valueArray[i] != null) { /* TODO: Fix ArrayIndexOutofBounds Exception here * Update: Problem is actually above. Probably linked to resources without setters. */ //System.out.println("ValueArray: " + valueArray[i]); //for (int j = 0; j < resParamNames.size(); j++) { System.out.println("resParamNames: " + resParamNames.get(j)); } JLabel label = new JLabel(); if (resParamNames.get(row).length == 0) label.setText("max. param"); else label.setText("max. " + resParamNames.get(row)[i]); JTextField tf = new JTextField(3); tf.setText(valueArray[i]); col1.addComponent(label); col2.addComponent(tf, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); rows.addGroup(layout .createParallelGroup( GroupLayout.Alignment.CENTER) .addComponent(label).addComponent(tf)); } } } table.setRowHeight(row, Math.max(table.getRowHeight(row), (int) panel.getPreferredSize().getHeight())); TableColumn cm = table.getColumnModel().getColumn(column); cm.setMinWidth(Math.max(cm.getMinWidth(), (int) panel .getPreferredSize().getWidth())); return panel; }
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { panel = new JPanel(); if (value instanceof String[]) { String[] valueArray = (String[]) value; if (valueArray.length == 0) return panel; GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); SequentialGroup cols = layout.createSequentialGroup(); layout.setHorizontalGroup(cols); ParallelGroup col1 = layout .createParallelGroup(GroupLayout.Alignment.LEADING); ParallelGroup col2 = layout .createParallelGroup(GroupLayout.Alignment.TRAILING); cols.addGroup(col1) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(col2); SequentialGroup rows = layout.createSequentialGroup(); layout.setVerticalGroup(rows); for (int i = 0; i < valueArray.length; i++) { // create the label. use the resource param name for both // resource and demand params as it should be the same. TODO JLabel label = new JLabel(); if (resParamNames.get(row).length == 0) label.setText("max. param"); else label.setText("max. " + resParamNames.get(row)[i]); JTextField tf = new JTextField(3); tf.setText(valueArray[i]); tf.setEditable(true); col1.addComponent(label); col2.addComponent(tf, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); rows.addGroup(layout .createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(label).addComponent(tf)); } } table.setRowHeight(row, Math.max(table.getRowHeight(row), (int) panel.getPreferredSize().getHeight())); TableColumn cm = table.getColumnModel().getColumn(column); cm.setMinWidth(Math.max(cm.getMinWidth(), (int) panel .getPreferredSize().getWidth())); return panel; }
private static JPanel createNotificationPanel(final URL url) { JPanel panel = new JPanel(); JLabel msgLabel = new JLabel("<html>" + NbBundle.getMessage(JiraUpdater.class, "MSG_PROJECT_NEEDS_JIRA")); // NOI18N JButton linkButton = new org.netbeans.modules.bugtracking.commons.LinkButton(); org.openide.awt.Mnemonics.setLocalizedText(linkButton, NbBundle.getMessage(JiraUpdater.class, "MSG_PROJECT_NEEDS_JIRA_LINK")); // NOI18N if (url != null) { linkButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { HtmlBrowser.URLDisplayer displayer = HtmlBrowser.URLDisplayer.getDefault (); if (displayer != null) { displayer.showURL(url); } else { // XXX nice error message? Support.LOG.warning("No URLDisplayer found."); // NOI18N } } }); } else { linkButton.setVisible(false); } GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setHorizontalGroup( layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(msgLabel, GroupLayout.PREFERRED_SIZE, 470, Short.MAX_VALUE) .addComponent(linkButton)) .addContainerGap() ); layout.setVerticalGroup( layout.createSequentialGroup() .addContainerGap() .addComponent(msgLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(linkButton) .addContainerGap(25, Short.MAX_VALUE) ); return panel; }
private int getContainerGap(int direction) { return LayoutStyle.getInstance().getContainerGap(this, direction, null); }
int getContainerGap(int direction) { return LayoutStyle.getInstance().getContainerGap(this, direction, null); }
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { tpPrimaryTitle = new javax.swing.JTextPane(); tpPrimaryPlugins = new javax.swing.JTextPane(); tpDependingTitle = new javax.swing.JTextPane(); tpDependingPlugins = new javax.swing.JTextPane(); tpPrimaryTitle.setContentType("text/html"); // NOI18N tpPrimaryTitle.setEditable(false); tpPrimaryPlugins.setContentType("text/html"); // NOI18N tpPrimaryPlugins.setEditable(false); tpDependingTitle.setContentType("text/html"); // NOI18N tpDependingTitle.setEditable(false); tpDependingPlugins.setContentType("text/html"); // NOI18N tpDependingPlugins.setEditable(false); tpPrimaryTitle.setText(tpPrimaryTitleText); tpPrimaryPlugins.setText(tpPrimaryPluginsText); tpDependingTitle.setText(tpDependingTitleText); tpDependingPlugins.setText(tpDependingPluginsText); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(49, 49, 49) .addComponent(tpDependingPlugins, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addContainerGap() .addComponent(tpDependingTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(49, 49, 49) .addComponent(tpPrimaryPlugins, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addContainerGap() .addComponent(tpPrimaryTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(tpPrimaryTitle) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tpPrimaryPlugins) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tpDependingTitle) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tpDependingPlugins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(90, 90, 90)) ); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form * Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { containerPanel = new JPanel(); jPanel1 = new JPanel(); jPanel2 = new JPanel(); errorLabel = new JLabel(); GroupLayout jPanel1Layout = new GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); GroupLayout jPanel2Layout = new GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); GroupLayout containerPanelLayout = new GroupLayout(containerPanel); containerPanel.setLayout(containerPanelLayout); containerPanelLayout.setHorizontalGroup(containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); containerPanelLayout.setVerticalGroup(containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(containerPanelLayout.createSequentialGroup() .addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 166, Short.MAX_VALUE)) ); Mnemonics.setLocalizedText(errorLabel, "ERROR"); // NOI18N GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(errorLabel) .addGap(0, 380, Short.MAX_VALUE)) .addComponent(containerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(containerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(errorLabel)) ); }