Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9249587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:14:07+00:00 2026-06-18T10:14:07+00:00

I try to create a Eclipse wizard page with an checkboxlist. First I created

  • 0

I try to create a Eclipse wizard page with an checkboxlist.

First I created a JList with JCheckBoxes :

import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;

public class CheckBoxList extends JList<JCheckBox> {

private static final long serialVersionUID = 1L;
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);

public CheckBoxList() {
    setCellRenderer(new CellRenderer());

    addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            int index = locationToIndex(e.getPoint());

            if (index != -1) {
                JCheckBox checkbox = (JCheckBox) getModel().getElementAt(
                        index);
                checkbox.setSelected(!checkbox.isSelected());
                repaint();
            }
        }
    });

    setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}


protected class CellRenderer implements ListCellRenderer<JCheckBox> {
    public Component getListCellRendererComponent(
            JList<? extends JCheckBox> list, JCheckBox value, int index,
            boolean isSelected, boolean cellHasFocus) {
        JCheckBox checkbox = 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;
    }

}
}

And then I try to view it on the wizard page:

SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL | SWT.NULL);  

TableViewer tableViewer = new TableViewer(sashForm, SWT.V_SCROLL | SWT.WRAP);
tableViewer.setContentProvider(ArrayContentProvider.getInstance()); 
Table table = tableViewer.getTable();
table.setLinesVisible(true);


CheckBoxList cbl = new CheckBoxList();
cbl.add(new JCheckBox("Box1"));
cbl.add(new JCheckBox("Box2"));

tableViewer.setInput(cbl);

but all I see is an empty white box.

What is wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:14:08+00:00Added an answer on June 18, 2026 at 10:14 am

    There is much easier solution as expected and suggested in different postings.

    Adding the flag SWT.CHECK to TableViewer creates a List with checkboxed Items out of an ArrayList.

    So the wrapper with a CheckBoxList is not needed any longer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to create a new Java project in eclipse indigo on Windows
i try to use an org.eclipse.jface.viewers.CheckboxTableViewer, as a component of a org.eclipse.jface.wizard.WizardPage. I created
I try to create styles with first-child and last-child items but I encountered a
I just created a new activity from eclipse new Android-file wizard. I created the
I'm not able to create a new android project in eclipse. Whenever I try
When I try to create a new class in Eclipse using the CDT plugin
I try to create simple project with JSF, Eclipse and Maven. I used <dependency>
i try create my first android application for android 2.1 api level 7 in
When I try to create a PlugIn Project in eclipse it keeps telling me,
i have try to create new ndk project in eclipse i have done all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.