swt

Java List with line separation

混江龙づ霸主 提交于 2019-12-11 12:11:43
问题 Hey, how do i make my java SWT list look like here http://flavio.tordini.org/minitunes I mean that each element is separated by a line from eachother. Or i there any other solution to have a list like in the minitunes, so i can add number.. etc. 回答1: You should use ListCellRenderer to add the separators at specific positions... jList1 = new javax.swing.JList(); //String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; jList1.setModel(new javax.swing.AbstractListModel() {

java thread: Thread.interrupt() not working

ぐ巨炮叔叔 提交于 2019-12-11 11:12:44
问题 I need to kill a thread that is not created in my code. In other words, the thread object is created by api (Eclipse JFace). Here is my code ProgressMonitorDialog dialog = new ProgressMonitorDialog(null); try { IRunnableWithProgress rp = new IRunnableWithProgress(){ @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { Thread.sleep(3000); Thread t = Thread.currentThread(); t.getThreadGroup().list(); t.interrupt(); } }; dialog.run(true,

Showing SWT modal dialog from AWT/Swing

爷,独闯天下 提交于 2019-12-11 10:51:44
问题 Using Albireo, it's easy to see how to show a Swing dialog from SWT: private AwtEnvironment awtEnv = AwtEnvironment.getInstance(Display.getCurrent); ... // call from SWT thread void showSwingMessageDialog(String msg) { awtEnv.invokeAndBlockSwt(new Runnable() { public void run() { Frame parentFrame = awtEnv.createDialogParentFrame(); JOptionPane.showMessageDialog(parentFrame, msg); } } } I want to show an SWT dialog from AWT thread, i.e. // call from AWT thread void showSWTMessageDialog(String

How to combine images to use as SWT cursor

女生的网名这么多〃 提交于 2019-12-11 10:40:06
问题 Further to this question where I understand I cannot achieve my goal I have tried to create my own cursor from an image. In my example I am just trying to draw a green box with on top. I expect the result to look like Here's my code: import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt

SWT Table and Hyperlink widget integration

天大地大妈咪最大 提交于 2019-12-11 10:39:38
问题 I fight with SWT Table and Hyperlink for too long time. I've read all of the topics on stackoverflow and JFace Snippets and Eclipse SWT Snippets and I couldn't find an answer to my problem. I try to create SWT Table with column that contains "DELETE" hyperlink in every row. My problem is that I can't make it look ok. Maybe I will put my code first: import java.util.ArrayList; import java.util.List; import org.eclipse.jface.layout.TableColumnLayout; import org.eclipse.jface.viewers

How to set static width to view in SWT

北城余情 提交于 2019-12-11 10:09:14
问题 how can be configured static width of view in perspective? I'd like have on left side TreeViewer with static width and second view (ViewPart) want to expand horizontaly. I have this, witch used ratio, that i don't want: public class PerspectivaEkomaj implements IPerspectiveFactory { @Override public void createInitialLayout( IPageLayout layout ) { String editorArea = layout.getEditorArea(); layout.setEditorAreaVisible( false ); layout.addView( EkomajTreeView.RCP_ID, IPageLayout.LEFT, 0.25f,

How to Map System.out and System.in to SWT controls

浪尽此生 提交于 2019-12-11 10:01:31
问题 I am working on on a tool to connect to a remote server using jcraft.JSch (ssh to Unix server) and return the output and display its output. The script works fine when channel input outputs are System.in and System.out . But when I try with SWT controls, it is not able to display the exact output I am getting with System.out read from SWT Text control emulating System.in public void create() { dialogShell = new Shell(dialogShell, SWT.PRIMARY_MODAL | SWT.SHEET | SWT.RESIZE); GridLayout

Opening a new Window with Java RCP and SWT

末鹿安然 提交于 2019-12-11 09:26:38
问题 I'm currently developing an app, and for this, I'm using Java RCP with SWT. What I want : I have a window, and when I click on a Button, i need a whole window to be opened. The window works perfectly and looks like this : Window1 When I press it, a new window opens. It looks like this : Window2 (Yup, the middle pic has its importance) How it's currently done : The Window 1 is a TrimmedWindow done with the Application.e4xmi, with some Parts in. The button is included in one of these parts.

SWTChart mouse event handling

无人久伴 提交于 2019-12-11 09:19:26
问题 I have found SWTChart library and just wonder how it would be possible to select with the mouse a range e.g. 1 to 3 on the x-axis and I would get all y-axis values which belongs to the selected x values. (source: swtchart.org) package org.swtchart.examples; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.swtchart.Chart; import org.swtchart

If use databinding in a dialog, how to restore data when user cancelled the editing?

只谈情不闲聊 提交于 2019-12-11 09:13:07
问题 If I get a bean and a dialog, and they are coupled with bidirectional data-binding, what is the best way to roll back to the original bean when user canceled the editing. EDIT 1 If user opened up the dialog in edit mode, he then did some modification and pressed "OK", then this dialog closed and the underlying bean got updated. When I said "canceled the editing", I mean the user opened up the dialog and did some modification but pressed "cancel" button. In this case, the underlying bean