swt

How to set lines visible in SWT table, including widgets in cells?

主宰稳场 提交于 2019-11-30 21:12:47
问题 I created a table with SWT and I included SWT widgets such as Label, Text in the table cells using TableEditor. But now my problem is, the outlines of the table cells are not visible now. I want to make visible all the borders of columns and rows. How to do it? Setting table.setLinesVisible(true) is not a success! Table table = new Table(detailArea, SWT.BORDER | SWT.MULTI); table.setLinesVisible(true); for (int i = 0; i < 4; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column

Rendering of buttons with images in Eclipse Kepler is broken

对着背影说爱祢 提交于 2019-11-30 20:30:53
问题 With Kepler, the buttons in the Console view are sometimes rendered like this: when it should look like this: Moving once over the buttons with the mouse fixes the problem. Any idea what could be causing this? Versions: Eclipse Kelper SR1 (20130919-0819) Linux Kubuntu 13.04 raring libgtk2.0-bin: 2.24.17-0ubuntu2 回答1: Considering the various issues seen with Kubuntu, knowing that oxygen-gtk is the default, you could consider checking if the problem persists when switching to QtCurve. See for

Create a custom button with SWT

岁酱吖の 提交于 2019-11-30 20:01:35
I would like to ask the same thing than this question but using SWT: Is there a way to make a Button with your own button graphic not just with an image inside the button? If not is another way to create a custom button in java? public class ImageButton extends Canvas { private int mouse = 0; private boolean hit = false; public ImageButton(Composite parent, int style) { super(parent, style); this.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { switch (mouse) { case 0: // Default state e.gc.drawString("Normal", 5, 5); break; case 1: // Mouse over e.gc.drawString(

Java Interface for Multimedia Keys

若如初见. 提交于 2019-11-30 19:58:35
问题 Anyone has experiences about interfacing with multimedia [or Fn Function] keys in Java? There seems to be an incomplete discussion regarding multimedia buttons in Java here. There is also a library, JIntelliType, which can be used to register global hotkeys in Windows, but only works for registering globally, not media keys. 回答1: Incorrect. I am the author of JIntellitype and you can call registerIntellitypeListener in this example and it registers for the Multimedia keys of Windows like Play

How to draw over child elements of a Composite in SWT?

自古美人都是妖i 提交于 2019-11-30 19:38:51
I understand to draw on a Composite, you can add a paint listener, but that results in drawing under the children. What if I want to draw over the top of children? The following draws a line, but subc is drawn over it. Composite c = new Composite(shell, 0); c.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLUE)); c.setBounds(100, 100, 800, 600); c.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.drawLine(0, 0, 500, 1000); } }); final Composite subc = new Composite(c, 0); subc.setLayout(null); subc.setBounds(10, 10, 600, 400); Daniel Leschkowski

Selection and hover overrides Cell background color in an SWT Table component

浪子不回头ぞ 提交于 2019-11-30 19:37:18
I'm using SWT (and Eclipse RCP) to render a table. My problem is that if I change the background of a cell (a ViewerCell in fact) I can see that it has the new color. My problem is that if I select a row in my Table or if I hover over the row containing my cell in question then the selection/hover background overrides my cell color. How can I override this? Problem solved with StyledCellLabelProvider. Tell me if you want to see some code. Edit: We use it do display validation errors so ignore the validation stuff here: public class ValidationCellLabelProvider extends StyledCellLabelProvider {

Drawing on a transparent image using Java SWT

假如想象 提交于 2019-11-30 18:13:10
How do I create an in-memory fully transparent SWT image and draw a black line on it with antialias enabled? I expect the result to include only black color and alpha values ranging from 0 to 255 due to antialias... I googled and tried everything that I could... is this possible at all? This is how I did and it works: Image src = new Image(null, 16, 16); ImageData imageData = src.getImageData(); imageData.transparentPixel = imageData.getPixel(0, 0); src.dispose(); Image icon = new Image(null, imageData); //draw on the icon with gc I was able to make this work, although it feels a bit hacky:

How to add a tooltip for TableViewer cell's in Java SWT

别来无恙 提交于 2019-11-30 17:49:01
问题 I have a TableViewer where each row represents different values. The string being kinda long, I would like that when I hover the mouse over the specific cell, a tooltip should pop-up with the information from the cell. I wrote this code but tooltip is not displayed and getToolTipText method is never executed: columnMessage.setLabelProvider(new ColumnLabelProvider() { @Override public void update(ViewerCell cell) { // ... as now } @Override public String getToolTipText(Object element) { return

SWT table: auto resize all columns

醉酒当歌 提交于 2019-11-30 17:38:21
Qt solution is a single call to resizeColumnsToContent() , in .NET one can use TextRenderer.MeasureText() , JTable could use AUTO_RESIZE_ALL_COLUMNS . In SWT, is there a way to programmaticaly resize columns after populating them? Calling computeSize(SWT.DEFAULT, SWT.DEFAULT) returns the same value thus disregarding character left overs in columns. TableColumn has setWidth() , but how do I obtain the size hint for the current content taking into account font face, etc? In many cases, the table entries change at run-time to reflect changes in the data model. Adding entry to the data model

Testing SWT GUI with SWTBot

余生长醉 提交于 2019-11-30 15:23:03
问题 I want to test a simple SWT GUI application with SWTBot. Unfortunatly, I have no idea how to start. There are several tutorials which describe the testing of an Eclipse plug-in but I could not find anything regarding my problem. I don't even know if it is possible. 回答1: Well it is very much possible. Follow the step as mentioned below. Download SWTBot for SWT Testing Put it in the <eclipsehome>/dropins folder Restart your eclipse Now at this point you are ready to play with SWTBot . For the