swt

SWT window becomes unresponsive while updating progressbar from a thread

风格不统一 提交于 2019-12-25 04:35:19
问题 I am writing an java swt application to process the server log files and generate a excel sheet with some analytics and I have no issues doing that. The problem arises when I try to update the progress bar. Here is a basic flow of the code. The user selects the log file using a directoryDialog and presses a start button. When the button is clicked the following code is executed. startButton.addMouseListener(new MouseAdapter() { public void mouseUp(MouseEvent e) { pm.setUserData(ud,progressBar

how can I change buttons's text in org.eclipse.jface.wizard.Wizard

*爱你&永不变心* 提交于 2019-12-25 03:55:24
问题 I want to change text of button in org.eclipse.jface.wizard.Wizard to arabic in button bar? I mean I wanna change label "Next" button to "بعدی". 回答1: The language of the Wizard 's labels is handled by JFace and uses your OS's region settings. That means if you're machine is set to "English (UK)" you will see the labels in English, if it's set to "Germany" you'll see them in German, etc. There are related questions here: JFace dialog button translation How to set custom text on buttons in

Add keyevent to switch ViewPart under IPageLayout

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 03:54:07
问题 how to assign key for switch focus on different viewpart?? example: (press "SWT.F7" to focus on viewpartA, "SWT.F8" to focus on viewpartB) public class UserPerspective implements IPerspectiveFactory{ ...... ...... public void createInitialLayout(IPageLayout layout){ final IFolderLayout leftPanel = layout.createFolder(......); leftPanel.addView(viewpartA.ID); final IFolderLayout rightPanel = layout.createFolder(......); rightPanel.addView(viewpartB.ID); } } 回答1: You can use the following key

SWT tandem scrollbars in composite

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 03:47:08
问题 I'm trying to add a button above the create two ScrolledComposites that scroll in tandem snippet from swt snippets the problem is that if I put the example code in a different Composite than the shell the example not working import org.eclipse.swt.*; import org.eclipse.swt.custom.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class tandemWithButton { public static void main(String[] args) { Display display = new Display(); Shell

How to reduce composite size within the ScrolledComposite in swt?

六眼飞鱼酱① 提交于 2019-12-25 03:24:57
问题 I am struggling to reduce the size of components within the scrolled composite. The problem is , always components(Tableviewer) getting bigger size.Unable to reduce the size.i tried setSize method of components .But no effect public void createForm(final Form form, final FormToolkit toolkit) { parent = toolkit.createComposite(form.getBody()); GridLayout singleCol = new GridLayout(1, true); canvas.setLayout(singleCol); GridData fillData = new GridData(SWT.FILL, SWT.FILL, true, true); //

Java SWT - ScrolledComposite inside Group

杀马特。学长 韩版系。学妹 提交于 2019-12-25 03:10:26
问题 I have a problem with putting ScrolledComposite inside the Group - it doesn't show inside the Group . ScrolledComposite has to scroll the Label . final private static Group group_netpbmOutput = new Group(shell, SWT.NONE); final private static ScrolledComposite scroll_netpbmOutput = new ScrolledComposite(group_netpbmOutput, SWT.V_SCROLL | SWT.H_SCROLL); final private static Label labelImage_netpbmOutput = new Label(scroll_netpbmOutput, SWT.BORDER); //init Group group_netpbmOutput.setLayout(new

Overriding Cut/Copy/Paste in SWT Text control

我只是一个虾纸丫 提交于 2019-12-25 03:05:11
问题 What is the correct way to override the cut(), copy(), and paste() methods of the Text control? What triggers the execution of these methods? I have created an example application with a custom class that overrides these methods. Unfortunately, nothing seems to execute these overridden methods, including the act of using Ctrl + X / Ctrl + C / Ctrl + V or selecting cut/copy/paste from the context menu. Custom Text Class: import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets

Add a Key Listener to TitleAreaDialog

余生长醉 提交于 2019-12-25 02:58:51
问题 I need to add a key listener to my TitelAreaDialog is there any solution to do this ? 回答1: You can add a Listener to the Display by using: Listener listener = new Listener() { public void handleEvent(Event event) { System.out.println(event.character); } } getShell().getDisplay().addFilter(SWT.KeyDown, listener); This will output all pressed keys without consuming the events, i.e. the underlying widgets will still register the events. Remember to remove it again in the close() method of the

SWT: Periodically update GUI

三世轮回 提交于 2019-12-25 02:08:07
问题 I have an SWT GUI which displays a list taken from a database. What I would like for it to do is to periodically update the GUI, which would involve clearing everything in the shell and running the populateList() method again. I have tried several suggested strategies for this, but the GUI never updates. My latest attempt is using display.asyncexec to create a thread to handle this. This appears to give me an invalid thread access error. Here's my code: package display; import java.io

SWT- using void function in the Group

断了今生、忘了曾经 提交于 2019-12-25 01:33:08
问题 I drawWitness(model) instruction in my code which its return type is void but it draws a shape. How can I insert it in the grpModelProperties1 ? When I use it in the below form I have NullPointerException error. ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL); scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); Composite