swt

HTML code getter using SWT Browser

徘徊边缘 提交于 2019-12-11 01:39:32
问题 How I can get html-page code to String using SWT Broser? Display display = new Display(); Shell shell = new Shell(display); shell.setSize(100, 100); Browser browser = new Browser(shell, SWT.NONE); browser.setBounds(5, 75, 100, 100); shell.open(); browser.setUrl("https://google.com"); String html = browser.getText(); //NOTHING! while (!shell.isDisposed()) { if (!display.readAndDispatch() && html == null) { display.sleep(); } } display.dispose(); Syste.out.println(html); ////NOTHING! So, how I

SWT: FontDialog without color selector

北城余情 提交于 2019-12-11 01:37:19
问题 How to show the SWT FontDialog without the color option (in our application colors are configured independent of the font)? 回答1: Eclipse bug 35890 discusses this option, and it is labelled as fixed. There is a new method : fontDialog.setEffectsVisible(false); but when I try to use it on a Mac this is reporting cannot find symbol method setEffectsVisible(boolean) and will not compile. Windows only? Maybe? 回答2: It looks like that dialog depends on system, on my win7 is default dialog FontDialog

SWT- How to change ProgressBar color in Windows?

时间秒杀一切 提交于 2019-12-11 01:17:45
问题 Is there a way to change the color of a ProgressBar's bars in SWT? .setForeground() doesn't seem to work. If there is not a way to change the color programmatically, is there a way to change ProgressBar's color using the WindowBuilder GUI tools? Thanks! 回答1: In SWT there are 3 built-in states, each represented by a color: progressBar.setState(SWT.ERROR); //Red Fill color. Useful when the task is aborted. This state does not support an indeterminate progress bar style (SWT.INDETERMINATE).

SWT - Grey out and disable current shell

笑着哭i 提交于 2019-12-11 00:52:48
问题 When I have a operation running in the back ground, I am setting my cursor to busy until the process completes. Is there a way to also grey out and disable the current Display/Dialog/Shell until the process completes. I want to visually let the user know that something is working and they have to wait. EDIT plotButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event arg0) { getShell().setEnabled(!getShell().getEnabled()); getShell().setCursor(new Cursor(Display

Shall is not opening and Menu is not showing in swt in java

a 夏天 提交于 2019-12-11 00:05:46
问题 I want to embed microsoft word in java . My program will open a word document file in jframe . After searching a lot , I have found the following solution : Open MS documents into JFrame The code to embed MS documents into Jframe is as follows : import java.awt.Canvas; import java.io.File; import javax.swing.JFrame; import org.eclipse.swt.SWT; import org.eclipse.swt.SWTError; import org.eclipse.swt.SWTException; import org.eclipse.swt.awt.SWT_AWT; import org.eclipse.swt.browser.Browser;

SWT DropTargetListener has empty event data under Mac OS X

烈酒焚心 提交于 2019-12-10 23:38:49
问题 I'm currently experiencing a weird platform inconsistency between Mac OS X and Windows/Linux. I've implemented an SWT DropTargetListener and tried to analyze the data dropped in the dragEnter method. Unfortunately, the data attribute of the TransferData contained in the DropTargetEvent parameter is always null on OS X (but becomes valid in DropTargetListener.drop method where it's too late to give user feedback). It works fine under Windows and Linux. Can anybody help me out? Or is this a

How to set the font size of MenuItem in SWT?

荒凉一梦 提交于 2019-12-10 21:34:26
问题 I want to change the font size of the MenuItem in SWT, there doesn't seem to be a obvious way to do it. Is there a work around for this problem? 回答1: MenuItem s don't support fonts as you can see in this bug report and apparently they don't want to implement it in the future: Sorry, we have no plans to do this. 来源: https://stackoverflow.com/questions/14520157/how-to-set-the-font-size-of-menuitem-in-swt

SWT MessageBox with custom button titles

痞子三分冷 提交于 2019-12-10 20:32:34
问题 I want to add the custom button titles in my non-RCP SWT app. MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.ABORT | SWT.RETRY | SWT.IGNORE); messageBox.setText("Warning"); messageBox.setMessage("Save the changes before exiting?"); int buttonID = messageBox.open(); switch(buttonID) { case SWT.YES: // saves changes ... case SWT.NO: // exits here ... break; case SWT.CANCEL: // does nothing ... } System.out.println(buttonID); } It works fine but i button titles are "Abort",

How to make label backgrounds transparent in SWT

偶尔善良 提交于 2019-12-10 20:26:42
问题 I'm pretty new to java SWT, and while putting labels, it looks like i can't make the label background transparent. I'm using eclipse luna SWT desine form. this is what my window looks like: as you can see,all the label backgrounds are white. What should i do so the label backgrounds will be the same as the window background(grey) by default (meaning - not by changing each label background at runtime, which does work for me). it probably simple, but i just couldn't find on google how to do it.

Which is faster: 4 lines or a rectangle SWT Java

隐身守侯 提交于 2019-12-10 20:23:51
问题 Is there any performance differences between 4 lines or a rectangle when it comes to drawing in SWT. Even if its a small difference I am interested. The system I am creating can makes a ton of these calls per frame. 回答1: On a system I work on, after profiling it, we switched from drawing one rectangle + two lines for a polyline and we got a great boost on drawing. (to draw candles like those: ) It was, at least, twice as fast. 来源: https://stackoverflow.com/questions/12375175/which-is-faster-4