Java Code Examples for javax.swing.GroupLayout#setHonorsVisibility()

The following examples show how to use javax.swing.GroupLayout#setHonorsVisibility() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DependenciesPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@code DependenciesPanel}.
 */
public DependenciesPanel() {
    tableModel = new DependencyTableModel();
    initComponents();
    table.getSelectionModel().addListSelectionListener(new Listener());
    TableCellRenderer versionColumnRenderer = new VersionColumnRenderer();
    TableColumnModel tableColumnModel = table.getColumnModel();
    tableColumnModel.getColumn(1).setCellRenderer(versionColumnRenderer);
    tableColumnModel.getColumn(2).setCellRenderer(versionColumnRenderer);
    tableColumnModel.getColumn(3).setCellRenderer(versionColumnRenderer);
    GroupLayout layout = (GroupLayout)getLayout();
    layout.setHonorsVisibility(dummyButton, false);
    updateButtons();
}
 
Example 2
Source File: DependenciesPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@code DependenciesPanel}.
 */
public DependenciesPanel() {
    tableModel = new DependencyTableModel();
    initComponents();
    table.getSelectionModel().addListSelectionListener(new Listener());
    TableCellRenderer versionColumnRenderer = new VersionColumnRenderer();
    TableColumnModel tableColumnModel = table.getColumnModel();
    tableColumnModel.getColumn(1).setCellRenderer(versionColumnRenderer);
    tableColumnModel.getColumn(2).setCellRenderer(versionColumnRenderer);
    tableColumnModel.getColumn(3).setCellRenderer(versionColumnRenderer);
    GroupLayout layout = (GroupLayout)getLayout();
    layout.setHonorsVisibility(dummyButton, false);
    updateButtons();
}
 
Example 3
Source File: CEValueBox.java    From open-ig with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Construct the box with the given label and editor component.
 * @param displayText the exact text to display
 * @param component the component
 */
protected CEValueBox(String displayText, C component) {
	label = new JLabel(displayText);
	this.component = component;
	valid = new JLabel();
	valid.setPreferredSize(new Dimension(20, 20));
	
	GroupLayout gl = new GroupLayout(this);
	setLayout(gl);
	
	gl.setHorizontalGroup(
		gl.createSequentialGroup()
		.addComponent(label)
		.addGap(10)
		.addComponent(component)
		.addGap(5)
		.addComponent(valid, 20, 20, 20)
		.addGap(20)
	);
	gl.setVerticalGroup(
		gl.createParallelGroup(Alignment.BASELINE)
		.addComponent(label)
		.addComponent(component, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
		.addComponent(valid, 20, 20, 20)
	);

	gl.setHonorsVisibility(valid, false);
}
 
Example 4
Source File: WizardStepProgressSupport.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private JComponent createProgressComponent() {
    progressLabel = new JLabel(getDisplayName());

    progressBar = super.getProgressComponent();

    stopButton = new JButton(NbBundle.getMessage(WizardStepProgressSupport.class, "BK2022")); // NOI18N
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cancel();
        }
    });

    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);

    progressLine = new JPanel();
    progressLine.add(progressBar);
    progressLine.add(Box.createHorizontalStrut(
                            LayoutStyle.getInstance()
                            .getPreferredGap(progressBar,
                                             stopButton,
                                             RELATED,
                                             SwingConstants.EAST,
                                             progressLine)));
    progressLine.add(stopButton);

    progressLine.setLayout(new BoxLayout(progressLine, BoxLayout.X_AXIS));
    progressBar.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    stopButton.setAlignmentX(JComponent.CENTER_ALIGNMENT);

    layout.setHorizontalGroup(
            layout.createParallelGroup(LEADING)
            .addComponent(progressLabel)
            .addComponent(progressLine));
    layout.setVerticalGroup(
            layout.createSequentialGroup()
            .addComponent(progressLabel)
            .addPreferredGap(RELATED)
            .addComponent(progressLine));
    panel.setLayout(layout);

    layout.setHonorsVisibility(false);   //hiding should not affect prefsize

    progressLabel.setVisible(false);
    progressLine.setVisible(false);

    return panel;
}
 
Example 5
Source File: RepositoryFormPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initComponents() {
    cardsPanel = new JPanel(new CardLayout());

    errorLabel = new JLabel();
    errorLabel.setForeground(ERROR_COLOR);
    errorLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(
            "org/netbeans/modules/bugtracking/ui/resources/error.gif")));   //NOI18N
    errorText = new JTextArea();
    errorText.setForeground(ERROR_COLOR);
    errorText.setBackground(errorLabel.getBackground());
    errorText.setEditable(false);
    
    errorScrollPane = new javax.swing.JScrollPane();
    errorScrollPane.setBorder(null);
    errorScrollPane.setViewportView(errorText);
    
    updateErrorMessage(" ");                                        //NOI18N
    
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    
    int height = errorText.getFont().getSize() * 3;
    
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(cardsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(errorLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(errorScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE)))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(cardsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGap(6, 14, 14)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(errorScrollPane, height, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(errorLabel))
            )
    );
    layout.setHonorsVisibility(false);  //keep space for errorLabel
}