swt

How to check if the SWT combo is currently opened?

醉酒当歌 提交于 2019-12-10 14:06:20
问题 I have an SWT combo box in my GUI. Is it possible to check if the combo box has been opened? (I've a mechanism which refreshes the state shown in the combo box, when a user opens it sometimes it jumps between user selection and that what the algorithm thinks is fine, the user selection has a priority over everything else). 回答1: Combo SWT component have method getListVisible() which returns flag if combo dropdown list part is visible or not.. see documentation for combo for details. 回答2: The

SWT DateTime format change

旧城冷巷雨未停 提交于 2019-12-10 14:04:09
问题 I'm using a DateTime SWT component, and it has an American format when displayed (mm/dd/yyyy). Is there any way to change the format to dd/mm/yyyy ? 回答1: DateTime uses the OS specific user preferences to format the date. (On Windows these are the Regional and Language Options in the system settings). A possible workaround is described here (scroll down to the latest two entries). But I haven't tried this myself. 回答2: You need to set the locale to change the date format, e.g. to Italy who use

How to create large SWT image?

落爺英雄遲暮 提交于 2019-12-10 13:57:49
问题 In my eclipse-rcp application I need to create an image with dimensions 30000x10000 px or more. This image is NatTable representation. Using standard image creation approach, it fails with different problems: OutOfMemory, SWTError - IllegalArgument or my PC stops responding (btw, its windows 7, 64bit, 4 RAM - client have much slower laptops, but the picture is still needs to be created). Here is a code snippet: private Image getNattableImageRepresentation(final Display display) { final

How to add Swing component to SWT?

不想你离开。 提交于 2019-12-10 13:25:46
问题 I want to add a Swing component ( JTree ) to my code which employs SWT. Is there any way by which we can accomplish this? I know that we have TreeViewer component in SWT/Jface, but i have got an already developed Jtree implemenatation and would like to add that, instead of rewriting using TreeViewer. 回答1: You can use the SWT/AWT Bridge. Composite composite = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND); Frame frame = SWT_AWT.new_Frame(composite); The SWT_AWT.newFrame(Compisite)

What's the difference between GC and FontData for getting font height?

懵懂的女人 提交于 2019-12-10 13:08:26
问题 This explains font metrics I think we can get "Font height" in SWT like these; GC gc = new GC(label); System.out.println( gc.textExtent(label.getText()) ); System.out.println( label.getFont().getFontData()[0].getHeight() ); Why this two outs aren't same? And which one is correct height for a string ? 回答1: GC#textExtent() returns extent in pixels , while FontData returns in font points . The units are different here. 回答2: Use FontMetrics.getHeight() to get height in pixels. FontMetrics

SWT - Table vs. TableViewer

天涯浪子 提交于 2019-12-10 12:58:16
问题 I am creating a new project using SWT. I will have 3 or 4 different tables in the project. I am fairly new to SWT and I find myself asking should I be using just the Table or should it be a TableViewer . I am wanting to learn some good guidelines on when to use just the Table and when a TableViewer is the best route. What is the benefit of using a TableViewer instead of a Table ? Should all the tables have a TableViewer ? If I am working with data from the table, is just the Table the best

Horizontal Scrollbar is not working under composite inside a CTabItem

两盒软妹~` 提交于 2019-12-10 12:17:05
问题 I have CtabItem inside which, there is a Composite widget. Then, I have added a few components inside it. The code goes like this - Composite composite = new Composite(tabFolder, SWT.H_SCROLL); tabItem.setControl(composite); Label lblName = new Label(composite, SWT.NONE); lblName.setBounds(10, 28, 55, 15); lblName.setText("Name"); textName = new StyledText(composite, SWT.BORDER); String myText = tree.getSelection()[0].getText(); textName.setText(myText); Point textNamesize = textName

SWT issues with cascaded MenuItem accelerators

元气小坏坏 提交于 2019-12-10 11:52:12
问题 The MenuItem objects having a SWT.CASCADE style (like 'File') won't drop down when the accelerator key combo is pressed. In the example below, pressing Alt-F triggers the Selection event (I see "File" in the console) but the menu itself won't drop down. I couldn't find a method to programmatically make the menu drop down either. Any idea? (The package I'm using is org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar provided with the current version of Eclipse Juno.) public class MenuTest {

Display IplImage (JavaCV) on an SWT canvas

南楼画角 提交于 2019-12-10 11:46:39
问题 I'm using JavaCV for a university project. It is essentially a motion detector. I use the OpenCVFrameGrabber class to get the frames from a webcam and I want to display the grabbed frames on my GUI. I'm using SWT and I thought it would be good to display the frames into a Canvas component. I have a problem because the OpenCVFrameGrabber provides images as instances of the IplImage class and SWT uses org.eclipse.swt.graphics.Image image class. So I should convert the image someway from

How to detect internet connection with SWT browser (or handle server not available)

不羁的心 提交于 2019-12-10 11:42:41
问题 I have a SWT Java application with a SWT Browser that is displayed on startup to display the news page of my website to the user, and also so the user can view "live" help files. However, I need a way to check if internet is not available so I can display a local, offline copy of the help and welcome pages. On Mac a dialog pops up if there is no internet, stating: "Page load failed with error: Could not connect to the server." I'd like to handle this without the popup going to the user