swt

Resize the column of a table to fill all the available space

拟墨画扇 提交于 2019-11-28 13:53:48
I have this table in Eclipse SWT, with 5 columns. I resize the window and together with that the whole table but the columns don't get resized to fill all the available space. Is there a layout method I can use in order to make a column resize itself to fill all the available space? I found some code that makes the columns resize when the client space has been resized but that seems like a small hack to me. There surely must be a decent elegant way of doing this by using the layout itself. This might come in handy: Composite tableComposite = new Composite(parent, SWT.NONE); TableViewer

SWT Cross-Platform Enter Detection

六月ゝ 毕业季﹏ 提交于 2019-11-28 13:37:53
I have a global filter ( Display.addFilter ) in SWT in which I want to detect Enter key. In Windows, pressing Enter generates SWT.CR in 'keyCode' part of KeyListener event. Is this assumption safe for all platforms, or should I check if keyCode == SWT.CR || keyCode == SWT.LF? Thanks. If you want to catch the event when the user presses the Enter key while a widget is in focus, use a TraverseListener or a Listener with type SWT.Traverse . Then, you check if (event.detail == SWT.TRAVERSE_RETURN) { // The user pressed Enter } 来源: https://stackoverflow.com/questions/1688266/swt-cross-platform

SDK manager does not find java

孤街醉人 提交于 2019-11-28 13:31:41
Hey guys, I seem to continually be unable to fix the issue at hand and my head is continually becoming balder or balder. The issue at hand is that my SDK manager won't find my Java, nor my SWT file. I'm running Windows 7 64-bit and my SDK, Java, SWT are located as the following. Java JDK - C:\Program Files\Java\jdk1.6.0_24 Java location - C:\Program Files\Java\jdk1.6.0_24\jre\bin SDK manager - C:\android-sdk-windows I'm learning coding for the very first time, i've tried everything so far. Set the correct paths that the SDK manager specifies, even tried setting multiple ones, changing the

How to remove views from Windows-->Show View list?

南笙酒味 提交于 2019-11-28 12:37:12
问题 I have view which I am setting permanently on my perspective. This view can not be closed and can not be opened from Windows --> show views I struct to remove View from Windows --> view list. How would I achieve this? I tried your solution it is doing the things but it is also removing the view from perspective. Below are the steps I followed.. I have added the following view in plugin.XML <view allowMultiple="false" category="org.view.ui.IDECategory" class="org.view.ui.BannerInformationView"

Adding background image to button in SWT

耗尽温柔 提交于 2019-11-28 12:32:19
问题 Can anyone please tell me how to add background image to a button in SWT? I need something like in the attachment. 回答1: Alright, Button isn't the best starting point if you basically want to draw a completely different type of button. You can however, create your own widget using this tutorial. I wrote an example here: public class ImageButton extends Composite { private Color textColor; private Image image; private String text; private int width; private int height; public ImageButton

How to align image to center of table cell (SWT Table)

做~自己de王妃 提交于 2019-11-28 12:22:30
I develop Eclipse RCP application and got a problem with a Table . We have some data in database in boolean format and users wants to see that field using checkbox . I tried to implement it using Button(SWT.CHECK) as Table-Editor , but it worked too slow :( I tried to use 2 images - checked and unchecked check-boxes, it works, but I can't align them to center, they are aligned to left automatically. I even found how to catch SWT.MeasureItem and SWT.PaintItem events and process them manually by change event.x field, but I got a problem - I can't get what column measuring or painting at the

How to stop JFace combo box from re sizing on a window re size?

社会主义新天地 提交于 2019-11-28 12:13:54
问题 I have a Java Eclipse RCP program in which I have a a long string inside a JFace combobox. Now when I am in the same view,The combobox attaches a scroll over it to show the full name. but as soon as I re size the window of the application, the combobox stretches itself to accommodate the lengthy string. How do i make the combobox stay the same size. Like the size of it should remain fixed even after I resize the window. Here are two screen shots to demonstrate the issue. P.S. I am using a

How to hide an SWT composite so that it takes no space?

牧云@^-^@ 提交于 2019-11-28 11:54:21
I need to hide a composite (and all children inside). Just setting setVisible(false) will keep the space of the composite. Composite outer = new Composite(parent, SWT.NONE); outer.setLayout(new GridLayout(1,false)); outer.setLayoutData(new GridData(GridData.FILL_BOTH) ); Composite compToHide = new MyComposite(outer, SWT.NONE); compToHide.setLayout(new GridLayout()); compToHide.setVisible(false); Here is some code that does what you want. I basically use GridData#exclude in combination with Control#setVisible(boolean) to hide/unhide the Composite : public static void main(String[] args) {

Why is subclassing not allowed for many of the SWT Controls?

早过忘川 提交于 2019-11-28 10:53:59
I often find myself wanting to do it. It can be very useful when you want to store some useful information or extra states. So my question is, is there a very good/strong reason why this is forbidden? Thanks EDIT: Thanks a lot for all these answers. So it sounds like there's no right-or-wrong answer to this. Assuming I accept the fact that these classes are not to be subclassed, what's the point of not marking a Control class final, but prohibiting subclassing - effectively demoting the exception/error from compile-time to run-time? EDIT^2: See my own answer to this: apparently, these classes

Controls (Combo, Radio, Text) in column header SWT

安稳与你 提交于 2019-11-28 10:34:59
问题 I've been searching everywhere, but I can't find a solution, nor an answer. Can custom controls/widgets be placed in a column header of a table in SWT? I can put those controls in the first row, but that is not the solution, because of the scrolling. The reason for the need is because I'm importing a CSV file, but sometimes the columns in it aren't in the same order as before, so I want to give the user an option to set which column is for what (Radio Buttons or Combo). Thank you. 回答1: No,