Skip to content

Tag: swt

Eclipse API Read all submodules/child modules

I am trying to read all submodules of project. Below is the code which I wrote it is working as expected but I am not sure if this is an efficient way of reading all submodules of project. Please advice. Answer children[i].FOLDER == IResource.FOLDER doesn’t do anything – FOLDER is a constant so it…

How to make SWT button Text BOLD

I am creating a checkbox button with text in SWT. In messages.properties, I have the value How can i show the text(ie. Answer) of this button in BOLD? Answer You can convert the currently assigned font for the button to be bold using something like: Note: You must call boldFont.dispose() when you are done wit…

Change the font size of the y-axis and x-axis values

In the following code, I want to reduce the font size of the y-axis and x-axis values. I searched and found these code: suppose you want to reduce the font size of number axis use the following code: suppose you want to reduce the font size of CategoryAxis use the following code: but unfortunately, the size o…

SWT Labels not displaying after disposal and recreation

In the following code, clicking on one of the three display list buttons will first dispose of any labels in a composite and then create labels for each row in a list of Strings. The problem is that if you click on the same button a second time the text all dispersal. When you switch to one of the other

How can I create a checkbox in a TableViewer of JFace?

I have created a tableViewer with two columns and I want to make one of them a checkbox. To do that I have created a CheckBoxCellEditor, but I don´t know why it isn´t working. The column called tableName displays it´s values OK. The column specification is the following. And the EditingSupport is the followin…

SWT DateTime – read date and time from two widgets

Imagine two widgets: and Would would be the most efficient way to read date and time from the two widgets into a single Date variable? Edit: The following solution that I have in mind is far from being elegant. I hope that there is a better way to do this. Answer For Java 8 and later you can use LocalDateTime…

Java SWT make a Label Scrollable

I have a Label in a Group in SWT and if it contains many lines of text, I would like to make it scrollable vertically. Setting the style parameter with SWT.V_SCROLL doesn’t seem to do it. How can I do this? Answer Label does not support scrolling. You could use a read only Text control which will scroll…