I'm trying to make a Java SWT table, with columns. What I'd like is the left most column to contain a checkbox. This is the code I've got so far.
panelSelector = new Composite(composite, SWT.H_SCROLL);
//panelSelector.setBackgroundImage(SWTResourceManager.getImage(UniverseAnalyzerItem.class, "/img/LandscapeTools/UniverseAnalyzer.png"));
panelSelector.setLayout(null);
ScrolledComposite scrolledComposite = new ScrolledComposite(panelSelector, SWT.BORDER | SWT.V_SCROLL|SWT.H_SCROLL);
scrolledComposite.setBounds(10, 30, 800, 500);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
//tableViewer = new TableViewer(scrolledComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.CHECK);
//table = tableViewer.getTable();
table = new Table(scrolledComposite,SWT.BORDER | SWT.CHECK);
table.setTouchEnabled(true);
table.setLinesVisible(true);
table.setHeaderVisible(true);
tableViewer = new TableViewer(table);
TableColumn uCheck = new TableColumn(table,SWT.CHECK);
uCheck.setWidth(50);
TableColumn uName = new TableColumn(table,SWT.CENTER);
uName.setText("Name");
uName.setWidth(150);
TableColumn uID = new TableColumn(table,SWT.CENTER);
uID.setText("ID");
uID.setWidth(50);
TableColumn uType = new TableColumn(table,SWT.CENTER);
uType.setText("Type");
uType.setWidth(50);
TableColumn uPath = new TableColumn(table,SWT.CENTER);
uPath.setText("Path");
uPath.setWidth(200);
scrolledComposite.setContent(table);
scrolledComposite.setMinSize(table.computeSize(SWT.DEFAULT,SWT.DEFAULT));
The problem is, when I run the application the checkboxes are not visible. Anyone know what I'm doing wrong?
Aucun commentaire:
Enregistrer un commentaire