Java Code Examples for javax.swing.JCheckBox#setBackground()
The following examples show how to use
javax.swing.JCheckBox#setBackground() .
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: SkillCalculator.java From plugins with GNU General Public License v3.0 | 6 votes |
private JPanel buildCheckboxPanel(SkillDataBonus bonus) { JPanel uiOption = new JPanel(new BorderLayout()); JLabel uiLabel = new JLabel(bonus.getName()); JCheckBox uiCheckbox = new JCheckBox(); uiLabel.setForeground(Color.WHITE); uiLabel.setFont(FontManager.getRunescapeSmallFont()); uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0)); uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR); // Adjust XP bonus depending on check-state of the boxes. uiCheckbox.addActionListener(event -> adjustCheckboxes(uiCheckbox, bonus)); uiCheckbox.setBackground(ColorScheme.MEDIUM_GRAY_COLOR); uiOption.add(uiLabel, BorderLayout.WEST); uiOption.add(uiCheckbox, BorderLayout.EAST); bonusCheckBoxes.add(uiCheckbox); return uiOption; }
Example 2
Source File: InstallerGUI.java From EasyMPermission with MIT License | 6 votes |
void addLocation(final IdeLocation location) { if (locations.contains(location)) return; Box box = Box.createHorizontalBox(); box.setBackground(Color.WHITE); final JCheckBox checkbox = new JCheckBox(location.getName()); checkbox.setBackground(Color.WHITE); box.add(new JLabel(new ImageIcon(location.getIdeIcon()))); box.add(checkbox); checkbox.setSelected(true); checkbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { location.selected = checkbox.isSelected(); fireSelectionChange(); } }); if (location.hasLombok()) { box.add(new JLabel(new ImageIcon(Installer.class.getResource("lombokIcon.png")))); } box.add(Box.createHorizontalGlue()); locations.add(location); add(box); getParent().doLayout(); fireSelectionChange(); }
Example 3
Source File: SkillCalculator.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private JPanel buildCheckboxPanel(SkillDataBonus bonus) { JPanel uiOption = new JPanel(new BorderLayout()); JLabel uiLabel = new JLabel(bonus.getName()); JCheckBox uiCheckbox = new JCheckBox(); uiLabel.setForeground(Color.WHITE); uiLabel.setFont(FontManager.getRunescapeSmallFont()); uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0)); uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR); // Adjust XP bonus depending on check-state of the boxes. uiCheckbox.addActionListener(event -> adjustCheckboxes(uiCheckbox, bonus)); uiCheckbox.setBackground(ColorScheme.MEDIUM_GRAY_COLOR); uiOption.add(uiLabel, BorderLayout.WEST); uiOption.add(uiCheckbox, BorderLayout.EAST); bonusCheckBoxes.add(uiCheckbox); return uiOption; }
Example 4
Source File: BooleanPropertyCellEditor.java From openAGV with Apache License 2.0 | 5 votes |
@Override public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { setValue(value); JCheckBox checkBox = (JCheckBox) getComponent(); checkBox.setBackground(table.getBackground()); if (property().getValue() instanceof Boolean) { checkBox.setSelected((boolean) property().getValue()); } return fComponent; }
Example 5
Source File: JPlagCreator.java From jplag with GNU General Public License v3.0 | 5 votes |
public static JCheckBox createCheckBox(String toolTip) { JCheckBox box = new JCheckBox(); box.setFont(JPlagCreator.SYSTEM_FONT); box.setPreferredSize(new java.awt.Dimension(20, 20)); box.setForeground(JPlagCreator.OPTION_PANEL_FOREGROUND); box.setBackground(JPlagCreator.SYSTEMCOLOR); if (toolTip != null && !toolTip.equals("")) box.setToolTipText(toolTip); return box; }
Example 6
Source File: CheckBoxList.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); checkbox.setEnabled(isEnabled()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); checkbox.setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder); return checkbox; }
Example 7
Source File: CustomCheckBoxList.java From tmc-intellij with MIT License | 5 votes |
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(false); checkbox.setBorder( isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : new EmptyBorder(1, 1, 1, 1)); return checkbox; }
Example 8
Source File: CorefEditor.java From gate-core with GNU Lesser General Public License v3.0 | 5 votes |
/** * Constructor. */ public CorefTreeCellRenderer() { setOpaque(true); check = new JCheckBox(); check.setBackground(Color.white); label = new JLabel(); setLayout(new BorderLayout(5, 10)); add(check, BorderLayout.WEST); add(label, BorderLayout.CENTER); }
Example 9
Source File: PoliciesVisualPanel.java From netbeans with Apache License 2.0 | 5 votes |
PoliciesListCellRenderer( Set<String> selected ){ JList list = new JList(new Object[]{""}); Component comp = new DefaultListCellRenderer(). getListCellRendererComponent( list, "", 0, true, true); mySelectedBckgrnd = comp.getBackground(); setOpaque( true ); setLayout( new FlowLayout(FlowLayout.LEFT) ); myCheckBox = new JCheckBox(); myCheckBox.setBackground( Color.WHITE ); add( myCheckBox ); myLbl = new JLabel( ); myLbl.setBackground( Color.WHITE ); add( myLbl ); setBackground( Color.WHITE ); mySelected = new boolean[ myPoliciesList.getModel().getSize()]; for( int i=0; i<mySelected.length ; i++ ){ String id = myPoliciesList.getModel().getElementAt(i).toString(); mySelected[ i] =selected.contains( id); } }
Example 10
Source File: EmitterList.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see javax.swing.DefaultListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean) */ public Component getListCellRendererComponent(JList list, final Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); final JCheckBox box = new JCheckBox(label.getText()); box.setBackground(label.getBackground()); box.setSelected(((ConfigurableEmitter) value).isEnabled()); checks.put(value, box); return box; }
Example 11
Source File: DefaultOutlineCellRenderer.java From netbeans with Apache License 2.0 | 5 votes |
final JCheckBox setUpCheckBox(CheckRenderDataProvider crendata, Object value, JCheckBox cb) { Boolean chSelected = crendata.isSelected(value); cb.setEnabled(true); cb.setSelected(!Boolean.FALSE.equals(chSelected)); // Third state is "selected armed" to be consistent with org.openide.explorer.propertysheet.ButtonModel3Way cb.getModel().setArmed(chSelected == null); cb.getModel().setPressed(chSelected == null); cb.setEnabled(crendata.isCheckEnabled(value)); cb.setBackground(getBackground()); return cb; }
Example 12
Source File: ProjectSelectionPanel.java From netbeans with Apache License 2.0 | 5 votes |
private JCheckBox createComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { EclipseProject project = projects[row]; JCheckBox chb = new JCheckBox(); chb.setSelected(selectedProjects.contains(project) || requiredProjects.contains(project)); chb.setToolTipText(null); if (project.isImportSupported() && !requiredProjects.contains(project)) { chb.setEnabled(true); } else { // required and non-java project are disabled chb.setEnabled(false); if (!project.isImportSupported()) { chb.setToolTipText(ProjectImporterWizard.getMessage( "MSG_NonJavaProject", project.getName())); // NOI18N } } if (isSelected) { chb.setOpaque(true); chb.setForeground(table.getSelectionForeground()); chb.setBackground(table.getSelectionBackground()); } else { chb.setOpaque(false); chb.setForeground(table.getForeground()); chb.setBackground(table.getBackground()); } return chb; }
Example 13
Source File: Query.java From opt4j with MIT License | 5 votes |
/** * Create an on-off check box. * * @param name * The name used to identify the entry (when calling get). * @param label * The label to attach to the entry. * @param defaultValue * The default value (true for on). */ public void addCheckBox(String name, String label, boolean defaultValue) { JLabel lbl = new JLabel(label + ": "); lbl.setBackground(_background); JCheckBox checkbox = new JCheckBox(); checkbox.setBackground(_background); checkbox.setOpaque(false); checkbox.setSelected(defaultValue); _addPair(name, lbl, checkbox, checkbox); // Add the listener last so that there is no notification // of the first value. checkbox.addItemListener(new QueryItemListener(name)); }
Example 14
Source File: JPanel_TaskManager.java From MobyDroid with Apache License 2.0 | 5 votes |
public JCheckBoxTableHeaderCellRenderer() { jCheckBox = new JCheckBox(); jCheckBox.setFont(UIManager.getFont("TableHeader.font")); jCheckBox.setBorder(UIManager.getBorder("TableHeader.cellBorder")); jCheckBox.setBackground(UIManager.getColor("TableHeader.background")); jCheckBox.setForeground(UIManager.getColor("TableHeader.foreground")); jCheckBox.setHorizontalAlignment(SwingConstants.CENTER); jCheckBox.setBorderPainted(true); }
Example 15
Source File: JPanel_AppManager.java From MobyDroid with Apache License 2.0 | 5 votes |
public JCheckBoxTableHeaderCellRenderer() { jCheckBox = new JCheckBox(); jCheckBox.setFont(UIManager.getFont("TableHeader.font")); jCheckBox.setBorder(UIManager.getBorder("TableHeader.cellBorder")); jCheckBox.setBackground(UIManager.getColor("TableHeader.background")); jCheckBox.setForeground(UIManager.getColor("TableHeader.foreground")); jCheckBox.setHorizontalAlignment(SwingConstants.CENTER); jCheckBox.setBorderPainted(true); }
Example 16
Source File: ColorizationFactor.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Creates the main frame for <code>this</code> sample. */ public ColorizationFactor() { super("Colorization factor"); this.setLayout(new BorderLayout()); final JPanel panel = new JPanel(new FlowLayout()); JButton button = new JButton("sample"); button.setBackground(Color.yellow); button.setForeground(Color.red); panel.add(button); JCheckBox checkbox = new JCheckBox("sample"); checkbox.setSelected(true); checkbox.setBackground(Color.green.brighter()); checkbox.setForeground(Color.blue.darker()); panel.add(checkbox); JRadioButton radiobutton = new JRadioButton("sample"); radiobutton.setSelected(true); radiobutton.setBackground(Color.yellow); radiobutton.setForeground(Color.green.darker()); panel.add(radiobutton); this.add(panel, BorderLayout.CENTER); JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final JSlider colorizationSlider = new JSlider(0, 100, 50); colorizationSlider.addChangeListener((ChangeEvent e) -> { double val = colorizationSlider.getValue() / 100.0; SubstanceCortex.ComponentOrParentChainScope.setColorizationFactor(panel, val); panel.repaint(); }); controls.add(colorizationSlider); this.add(controls, BorderLayout.SOUTH); this.setSize(400, 200); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
Example 17
Source File: FractionInfoPanel.java From ET_Redux with Apache License 2.0 | 4 votes |
private void initView() { this.setCursor(Cursor.getDefaultCursor()); Font checkBoxFont = new Font( "SansSerif", Font.BOLD, 10); toggleFractionCheckBox = new JCheckBox("include fraction", true); toggleFractionCheckBox.setBounds(2, 22, DEFAULT_WIDTH_OF_PANE - 2, 15); toggleFractionCheckBox.setFont(checkBoxFont); toggleFractionCheckBox.setSelected(tripoliFraction.isIncluded()); toggleFractionCheckBox.setBackground(this.getBackground()); toggleFractionCheckBox.addActionListener(// new ToggleFractionCheckBoxActionListener(tripoliFraction, rawDataModelView, sampleSessionDataView)); add(toggleFractionCheckBox, JLayeredPane.DEFAULT_LAYER); showLocalYAxisCheckBox = new JCheckBox("local Y axis", false); showLocalYAxisCheckBox.setBounds(2, 37, DEFAULT_WIDTH_OF_PANE - 2, 15); showLocalYAxisCheckBox.setFont(checkBoxFont); showLocalYAxisCheckBox.setSelected(tripoliFraction.isShowLocalYAxis()); showLocalYAxisCheckBox.setBackground(this.getBackground()); showLocalYAxisCheckBox.addActionListener(// new ShowLocalYAxisCheckBoxActionListener(tripoliFraction, sampleSessionDataView)); add(showLocalYAxisCheckBox, JLayeredPane.DEFAULT_LAYER); if ((rawDataModelView instanceof FitFunctionsOnRatioDataView) || (rawDataModelView instanceof FitFunctionsOnDownHoleRatioDataView)) { showLocalFitFunctionsCheckBox = new JCheckBox("local Fit Functions", false); showLocalFitFunctionsCheckBox.setBounds(2, 52, DEFAULT_WIDTH_OF_PANE - 2, 15); showLocalFitFunctionsCheckBox.setFont(checkBoxFont); showLocalFitFunctionsCheckBox.setSelected(tripoliFraction.isShowLocalInterceptFitPanel()); showLocalFitFunctionsCheckBox.setBackground(this.getBackground()); showLocalFitFunctionsCheckBox.addActionListener(// new ShowLocalInterceptFitFunctionsCheckBoxActionListener(tripoliFraction, sampleSessionDataView)); add(showLocalFitFunctionsCheckBox, JLayeredPane.DEFAULT_LAYER); add(buttonForODChoiceFactory(68, "w/ OD", true), DEFAULT_LAYER); add(buttonForODChoiceFactory(88, "w/out OD", false), DEFAULT_LAYER); add(buttonForSelectAllFactory(68, "Select All"), DEFAULT_LAYER); add(buttonForReFitFactory(88, "ReFit Functions"), DEFAULT_LAYER); } }
Example 18
Source File: AbstractDataMonitorView.java From ET_Redux with Apache License 2.0 | 4 votes |
/** * * @param inLiveMode the value of inLiveMode */ public void prepareConcordia(boolean inLiveMode) { if (concordiaGraphPanel != null) { this.remove(concordiaGraphPanel); } if (kwikiConcordiaToolBar != null) { this.remove(kwikiConcordiaToolBar); } if (savedCountOfFractions == 0) { concordiaGraphPanel = new ConcordiaGraphPanel(project.getSuperSample(), getuPbReduxFrame()); ((ConcordiaGraphPanel) concordiaGraphPanel).setCurrentGraphAxesSetup(new GraphAxesSetup("C", 2)); ((ConcordiaGraphPanel) concordiaGraphPanel).setShowTitleBox(false); ((ConcordiaGraphPanel) concordiaGraphPanel).// setYorkFitLine(null); ((ConcordiaGraphPanel) concordiaGraphPanel).// setFadedDeselectedFractions(true); project.getSuperSample().getSampleDateInterpretationGUISettings().// setConcordiaOptions(((ConcordiaPlotDisplayInterface) concordiaGraphPanel).getConcordiaOptions()); probabilityChartOptions = project.getSuperSample().getSampleDateInterpretationGUISettings().getProbabilityChartOptions(); ((ConcordiaGraphPanel) concordiaGraphPanel).// setFadedDeselectedFractions(false); ((ConcordiaGraphPanel) concordiaGraphPanel).setShowTightToEdges(true); } setConcordiaBounds(showSessions ? 725 : leftMargin + 135, showSessions ? 620 : 900, 625); kwikiConcordiaToolBar = new KwikiConcordiaToolBar(// 940, topMargin + concordiaGraphPanel.getHeight() + topMargin + 50, concordiaGraphPanel, null); ((ConcordiaGraphPanel) concordiaGraphPanel).setSample(project.getSuperSample()); ((ConcordiaGraphPanel) concordiaGraphPanel).setViewOptions(); ((ConcordiaGraphPanel) concordiaGraphPanel).setShowBestDateDivider206_238(true); add(concordiaGraphPanel, javax.swing.JLayeredPane.DEFAULT_LAYER); try { Vector<ETFractionInterface> selectedFractions = project.getSuperSample().getFractions(); ((AliquotDetailsDisplayInterface) concordiaGraphPanel).// setSelectedFractions(selectedFractions); ((PlottingDetailsDisplayInterface) concordiaGraphPanel).resetPanel(true, inLiveMode); } catch (Exception e) { } add(kwikiConcordiaToolBar, javax.swing.JLayeredPane.DEFAULT_LAYER); JCheckBox showFilteredFractions_checkbox = new JCheckBox(); showFilteredFractions_checkbox.setFont(new java.awt.Font("SansSerif", 1, 10)); showFilteredFractions_checkbox.setText("<html>Filtering ON<br> </html>"); showFilteredFractions_checkbox.setBounds(leftMargin + 1075, topMargin + 660, 120, 25); showFilteredFractions_checkbox.setOpaque(true); showFilteredFractions_checkbox.setBackground(Color.white); showFilteredFractions_checkbox.addActionListener((java.awt.event.ActionEvent evt) -> { boolean state = ((AliquotDetailsDisplayInterface) concordiaGraphPanel).isShowFilteredEllipses(); ((AliquotDetailsDisplayInterface) concordiaGraphPanel).setShowFilteredEllipses(!state); showFilteredFractions_checkbox.setSelected(!state); probabilityChartOptions.put("showFilteredEllipses", Boolean.toString(!state)); concordiaGraphPanel.repaint(); }); if (probabilityChartOptions.containsKey("showFilteredEllipses")) { showFilteredFractions_checkbox.setSelected(Boolean.valueOf(probabilityChartOptions.get("showFilteredEllipses"))); ((AliquotDetailsDisplayInterface) concordiaGraphPanel).setShowFilteredEllipses(showFilteredFractions_checkbox.isSelected()); } this.add(showFilteredFractions_checkbox, LAYER_FIVE); }
Example 19
Source File: CheckboxTreeCellEditor.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 4 votes |
@Override public Component getTreeCellEditorComponent(JTree aTree, Object aValue, boolean isSelected, boolean isExpanded, boolean isLeaf, int isRow) { final JCheckBox theEditor = new JCheckBox(); UIInitializer.getInstance().initializeComponent(theEditor); editingNode = (DefaultMutableTreeNode) aValue; if (editingNode.getUserObject() instanceof SelectableWrapper) { SelectableWrapper theWrapper = (SelectableWrapper) editingNode .getUserObject(); theEditor.setEnabled(true); theEditor.setText(objectToString(theWrapper.getValue())); theEditor.setSelected(theWrapper.isSelected()); if (isSelected) { theEditor.setBackground(initializer.getConfiguration() .getDefaultListSelectionBackground()); theEditor.setForeground(initializer.getConfiguration() .getDefaultListSelectionForeground()); } else { theEditor.setBackground(initializer.getConfiguration() .getDefaultListNonSelectionBackground()); theEditor.setForeground(initializer.getConfiguration() .getDefaultListNonSelectionForeground()); } ItemListener theItemListener = itemEvent -> { if (stopCellEditing()) { SelectableTableModel theModel = (SelectableTableModel) tree.getModel(); theModel.setSelected(editingNode, theEditor.isSelected()); fireEditingStopped(); } }; theEditor.addItemListener(theItemListener); return theEditor; } throw new IllegalArgumentException("Wrong object type"); }
Example 20
Source File: ListFrame.java From JavaMainRepo with Apache License 2.0 | 4 votes |
public ListFrame(String title) { super(title); SpringLayout slPane = new SpringLayout(); contentPanel.setLayout(slPane); // Description panel animalDescriptionLabels = new LinkedList<JLabel>(); animalDataLabels = new LinkedList<JLabel>(); // GridLayout for panel animalPlanet = new JPanel(); animalPlanet.setBackground(LIGHT_GREY); animalPlanet.setLayout(new GridLayout(8, 2, 5, 5)); // Adding the description fields for (int i = 0; i < 8; i++) { JLabel newDesc = new JLabel(); if (i < 6) { newDesc.setFont(DEFAULT_FONT); } else { newDesc.setFont(BOLD_FONT); } animalDescriptionLabels.add(newDesc); animalPlanet.add(newDesc); JLabel newData = new JLabel(); if (i < 6) { newData.setFont(DEFAULT_FONT); } else { newData.setFont(BOLD_FONT); } animalDataLabels.add(newData); animalPlanet.add(newData); } slPane.putConstraint(SpringLayout.WEST, animalPlanet, 0, SpringLayout.WEST, contentPanel); slPane.putConstraint(SpringLayout.EAST, animalPlanet, 0, SpringLayout.EAST, contentPanel); contentPanel.add(animalPlanet); // Delete button and check box btnDelete = new JButton("Delete"); btnDelete.setEnabled(false); btnDelete.setBackground(SOMETHING_REDISH); slPane.putConstraint(SpringLayout.NORTH, btnDelete, 5, SpringLayout.SOUTH, animalPlanet); slPane.putConstraint(SpringLayout.WEST, btnDelete, 0, SpringLayout.WEST, contentPanel); contentPanel.add(btnDelete); cbDelete = new JCheckBox("Enable Deletion"); cbDelete.setBackground(NOT_LIGHT_GREY); slPane.putConstraint(SpringLayout.NORTH, cbDelete, 5, SpringLayout.SOUTH, animalPlanet); slPane.putConstraint(SpringLayout.WEST, cbDelete, 5, SpringLayout.EAST, btnDelete); contentPanel.add(cbDelete); btnDeleteAll = new JButton("Delete All"); btnDeleteAll.setEnabled(false); btnDeleteAll.setBackground(SOMETHING_REDISH); slPane.putConstraint(SpringLayout.NORTH, btnDeleteAll, 5, SpringLayout.SOUTH, animalPlanet); slPane.putConstraint(SpringLayout.EAST, btnDeleteAll, 0, SpringLayout.EAST, contentPanel); contentPanel.add(btnDeleteAll); cbDeleteAll = new JCheckBox("Enable Complete Anihilation"); cbDeleteAll.setBackground(NOT_LIGHT_GREY); cbDeleteAll.setEnabled(false); slPane.putConstraint(SpringLayout.NORTH, cbDeleteAll, 5, SpringLayout.SOUTH, animalPlanet); slPane.putConstraint(SpringLayout.EAST, cbDeleteAll, -5, SpringLayout.WEST, btnDeleteAll); contentPanel.add(cbDeleteAll); // Selection list animalScrollPane = new JScrollPane(); if (ZooData.getAnimalListSize() > 0) { animalList = new JList<String>(ZooData.getAnimalListNames()); } else { animalList = new JList<String>(new String[] { "Empty" }); setEmptyDescription(); } animalList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); animalList.setBackground(LIGHT_GREY); animalScrollPane.setViewportView(animalList); slPane.putConstraint(SpringLayout.NORTH, animalScrollPane, 5, SpringLayout.SOUTH, btnDelete); slPane.putConstraint(SpringLayout.WEST, animalScrollPane, 0, SpringLayout.WEST, contentPanel); slPane.putConstraint(SpringLayout.EAST, animalScrollPane, 0, SpringLayout.EAST, contentPanel); slPane.putConstraint(SpringLayout.SOUTH, animalScrollPane, 0, SpringLayout.SOUTH, contentPanel); contentPanel.add(animalScrollPane); }