swt

How do I detect that a SWT dialog has been opened and is visible?

不打扰是莪最后的温柔 提交于 2019-12-12 17:03:18
问题 I have an SWT WizardDialog with a number of pages. When this dialog first opens I have to do a check for some conditions and if those conditions are met I need to show a popup over the freshly opened dialog. So I have this code to listen for SWT.Show event. The event listener responds to SWT.Show to conduct its tests and show a message box: final WizardDialog dialog = new WizardDialog(shell, wizard); dialog.setTitle("New Wizard"); dialog.create(); dialog.getShell().addListener(SWT.Show, new

SWT: how to handle application events correctly on OS X

我的梦境 提交于 2019-12-12 16:04:37
问题 How to correctly handle OS X' application events (quit, about, preferences) correctly with SWT? For AWT/Swing the com.apple.eawt.Application and .ApplicationAdapter worked fine. 回答1: At least two possible answers from my boomarks: I have come across an Azureus solution that should be pretty portable... Also SWT 3.7 have some additional support for OSX as described at EclipseCon '11 But... I haven't tried any of this yet... 回答2: You can respond to the quit event with something along these

Java SWT User Input Validation

↘锁芯ラ 提交于 2019-12-12 15:21:04
问题 What is the Java convention when it comes to user input validation in SWT? I read that there are FieldEditors which are very convenient fields but sadly only for preferences and dialogue boxes. I also read that there is an IValidator interface. But it is often used with data binding, which is in my case, most of my inputs do not need any data binding yet. Also, IValidator requires me to write my own validation methods even for simple validations such as integer only, letters only, etc. Since

How to resize a scroll composite to always fit its contents horizontally?

倾然丶 夕夏残阳落幕 提交于 2019-12-12 15:02:07
问题 I have a scrolled composite ,it contains a tableViewer. My requirement is that if the table is increased in width,the scroll composite should not show horizontal scroll ,but it should expand to fit table's size. The only reason I have used a scrolled composite here is I want to show vertical scroll bar. 回答1: If you want to control the scrollbars of a Table in SWT - which is a sub-class of Scrollable - simply add one or more of the following styles in the constructor. If you construct a Viewer

Align an image in a SWT TableViewer

旧街凉风 提交于 2019-12-12 14:22:11
问题 I just found out, that its somehow impossible to align an image in a swt tableviewer. Creating a TableColumn with SWT.RIGHT (for instance) has no effect on that column if its labelprovider returns an image for it. Question: Is there any other way to align an image instead of modifiying the image file itself and put some extra pixel into it? 回答1: I believe that you're running into a limitation of the underlying platform (or something to that effect). You can have total control over what goes

JFileChooser is not opening default Win 7 File Explorer [duplicate]

牧云@^-^@ 提交于 2019-12-12 13:58:18
问题 This question already has answers here : Does Swing support Windows 7-style file choosers? (10 answers) Closed 4 years ago . I am using JFileChooser to open the File Explorer in WIN 7 and realized that its opening the old UI , but same SWT FileDialog is opening the WIN 7 File Explorer only. Is there any specific reason. JFileChooser : SWT FileDialog : 回答1: AFAIK this not possible for AWT / Swing, Java 6 / 7 missed that, some implementetion as for WinXP (maybe for Vista too, never used this

Does SWT StyledText have a height limit?

霸气de小男生 提交于 2019-12-12 13:35:20
问题 I am trying to create an application that contains a StyledText box displayed within a ScrolledComposite. I am having difficulties displaying a large number of lines in my StyledText box (over 2,550 seems to cause issues). The StyledText box must not itself have a scroll bar but must be scrollable via the ScrolledComposite. As there are other items below and above the StyledText that need to be scrollable to and I do not want multiple scroll bars. Hence with large amounts of data I have a

Scrolling canvas content

对着背影说爱祢 提交于 2019-12-12 13:21:11
问题 I have drawn some text and rectangles on canvas. package com.cavium.test.views; import org.eclipse.swt.SWT; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.ScrollBar; import org.eclipse.swt.widgets.Shell; public class Test2

Adding buttons to a table (java swt)

[亡魂溺海] 提交于 2019-12-12 12:13:17
问题 I'm trying to replicate a UI similar to this: http://librixxxi.blogspot.com/2011/06/punch-clock-021-and-clickable-edit.html and I have been following the authors instructions (without success) on how to create buttons that are in each column of my table. The difference between my project as his is I am trying to use a Tree rather than a Table , and I am doing it in the context of an eclipse TreeViewer plugin. In theory it seems the implementation should be straightforward, but I can't seem to

Moving an image of a TitleAreaDialog to the left

≡放荡痞女 提交于 2019-12-12 12:07:44
问题 I'm working on a SWT/Jface project based on Java SE, i want to move the image of a TitleAreaDialog to the left. is it possible ? if not is there anyway ? Thanks, 回答1: You can modify the layout data of the image label as follows: TitleAreaDialog tad = new TitleAreaDialog(getShell()) { @Override protected Control createContents(Composite parent) { Control control = super.createContents(parent); Label label = getTitleImageLabel(); FormData data = (FormData) label.getLayoutData(); data.left = new