SWT




How to refresh the canvas
Is there any method to refresh the canvas
-----------------------------------------

My case:
- The first group of images is loadded onto the canvas.
- When clicking the button to load the next group of those,...
- The second group of images is loadded onto the same canvas.

Condition:
- Two groups of images are displayed onto little canvas.
- Little canvas will later be displayed on (big) canvas.

Problems:
- The first group of images is supposed to disappear, but it is actually not!
- The second group normally appears, but it displays behind the previous pix.


My questions:
How to refresh the canvas
Is there any method to refresh the canvas
or
Is there any method to dispose little canvas


This code is right, but it does not work on my program. I do not know why\t...
if (canvasArray != null){
// clear existing array of canvas
for (int i = 0; i < canvasArray.length; i++)
{
canvasArray[i].dispose();
}
}

Do you have any suggestion
Thanx!
Posted On: Tuesday 23rd of October 2012 10:56:16 PM Total Views:  76
View Complete with Replies

RELATED TOPICS OF Swing / AWT / SWT PROGRAMMING LANGUAGE




Eclipse swt property strings

hallo , im working with eclipse swt to embed office files into jframes, is there a way to know all the property strings one can change, for example when you write: OleControlSite controlSite = new OleControlSite(frame, SWT.NONE, "Shell.Explorer"); OleAutomation automation = new OleAutomation(controlSite); int[] rgdispid = automation.getIDsOfNames(new String[]{"LocationName"}); int dispIdMember = rgdispid[0]; Variant result = automation.getProperty(dispIdMember); System.out.println("The Web Browser is currently viewing the URL "+result.getString());
VIEWS ON THIS POST

94

Posted on:

Wednesday 17th October 2012
View Replies!

swt trayicon send sms

hi, need some help please with swt trayicon. I have a swt trayicon, that displays tooltip messages but what I want is to display an alert message to the user of the trayicon at specific times, for instance a message is displayed to the user "you have worked 6 hours" this message is to be displayed after 6 hours of the trayicon invoked to the "systray". I dont want to stop there though, I also want an sms sent to the users moblie phone telling the user 6 hours has pasted. my first question is possible with swt trayicon second question does anyone know of an example where trayicon alerts user with a trayicon message and trayicon sends a sms to the users mobile phone as usual any help would be much appricated.
VIEWS ON THIS POST

98

Posted on:

Wednesday 17th October 2012
View Replies!

swt.jar

This is the first time I use SWT, please see the following program. I don't have swt.jar in my system. Would anyone instruct me how to make it work. I know I need swt.jar in my system. Where can I download the jar file and how to install it.
VIEWS ON THIS POST

98

Posted on:

Wednesday 17th October 2012
View Replies!

dynamically filling of embedded swt_awt frame

hello all, i wrote a plug-in which displays a empty awt frame within an editor (org.eclipse.ui.editors) by using the SWT_AWT bridge. by the using of plugin: exists any way to get the embadded frame from my open editor i want to load dynamically any awt-frames from any java-project. is that possible for suggestions
VIEWS ON THIS POST

102

Posted on:

Wednesday 17th October 2012
View Replies!

Exception in thread "AWT-EventQueue-0" org.eclipse.swt.SWTException: Invalid thread access

, For my application I have created a menu in the system tray. When you click left you get some dynamic data and when you click right on my menu you get a screen to add a new dynamic menuitem to my system tray menu. but when I try to add something to that menu I get this error: Exception in thread "AWT-EventQueue-0" org.eclipse.swt.SWTException: Invalid thread access this is my code: import java.awt.Frame; import java.awt.Dimension; import javax.swing.JButton; import java.awt.BorderLayout; import javax.swing.SwingConstants; import java.awt.event.KeyEvent; import java.awt.Rectangle; import javax.swing.JTextField; import javax.swing.JLabel; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; public class Test3 extends Frame { private static final long serialVersionUID = 1L; private JButton jButton = null; private JTextField txtInput = null; private JLabel lblInput = null; private JLabel lblResult2 = null; static Display display = new Display (); static Shell shell = new Shell (display); // @jve:decl-index=0: static MenuItem testMi = null; /** * This method initializes jButton * * @return javax.swing.JButton */ private JButton getJButton() { if (jButton == null) { jButton = new JButton(); jButton.setHorizontalTextPosition(SwingConstants.CENTER); jButton.setMnemonic(KeyEvent.VK_UNDEFINED); jButton.setBounds(new Rectangle(504, 246, 97, 29)); jButton.setText("Click"); //jButton.setSize(0,80); //jButton.addActionListener(new java.awt.event.ActionListener()); jButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent e) { //System.out.println("mouseClicked()"); // TODO Auto-generated Event stub mouseClicked() lblResult2.setText(txtInput.getText()); testMi.setText("Dynamic"); } }); //jButton.setRolloverEnabled(false); //jButton.setPreferredSize(new Dimension(50, 10)); } return jButton; } /** * This method initializes txtInput * * @return javax.swing.JTextField */ private JTextField getTxtInput() { if (txtInput == null) { txtInput = new JTextField(); txtInput.setBounds(new Rectangle(187, 73, 416, 22)); } return txtInput; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Test3 application = new Test3(); application.initialize(); application.setVisible(true); Image image = new Image (display, 16, 16); final Tray tray = display.getSystemTray (); if (tray == null) { System.out.println ("The system tray is not available"); } else { final TrayItem item = new TrayItem (tray, SWT.NONE); item.setToolTipText("SWT TrayItem"); item.addListener (SWT.Show, new Listener () { public void handleEvent (Event event) { System.out.println("show"); } }); item.addListener (SWT.Hide, new Listener () { public void handleEvent (Event event) { System.out.println("hide"); } }); final Menu mainMenu = new Menu (shell, SWT.POP_UP); for (int i =0; i
VIEWS ON THIS POST

108

Posted on:

Wednesday 17th October 2012
View Replies!

org.eclipse.swt.SWTException

i created one thread and in that thread i am creating another thread but i am getting this exception org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Display.error(Unknown Source) at org.eclipse.swt.widgets.Display.checkDevice(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at chrriis.dj.nativeswing.NativeInterfaceHandler.dispatch(NativeInterfac eHandler.java:300) at chrriis.dj.nativeswing.NativeInterfaceHandler.runEventPump(NativeInte rfaceHandler.java:293) at com.instacoll.livedocuments.oo.userinterface.ManageDocuments.showMana geApp(ManageDocuments.java:1615) at com.instacoll.livedocuments.oo.miscellaneous.InstaSecureTray$3$1.run( InstaSecureTray.java:208) org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Display.error(Unknown Source) at org.eclipse.swt.widgets.Display.checkDevice(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at chrriis.dj.nativeswing.NativeInterfaceHandler.dispatch(NativeInterfac eHandler.java:300) at chrriis.dj.nativeswing.NativeInterfaceHandler.runEventPump(NativeInte rfaceHandler.java:293) at com.instacoll.livedocuments.oo.userinterface.ManageDocuments.showMana geApp(ManageDocuments.java:1615) at com.instacoll.livedocuments.oo.miscellaneous.InstaSecureTray$3$1.run( InstaSecureTray.java:208) org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Display.error(Unknown Source) at org.eclipse.swt.widgets.Display.checkDevice(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at chrriis.dj.nativeswing.NativeInterfaceHandler.dispatch(NativeInterfac eHandler.java:300) at chrriis.dj.nativeswing.NativeInterfaceHandler.runEventPump(NativeInte rfaceHandler.java:293) [ May 19, 2008: Message edited by: ramesh kancherla ]
VIEWS ON THIS POST

97

Posted on:

Wednesday 17th October 2012
View Replies!

flash video (FLV) player in swt or swing application

Is it somehow possible to play flv files in an eclipse rcp application (which is based on swt) without using a webbrowser viepart Or in swing If one takes the webbrowser viewpart you get all the functionality you don't want like the contect menu, hot keys and so on. And - most important - you are not platform independent since you need flash. I checked google nbut found nothing.. perhaps I should consider to switch to apple's quicktime format. tony roth
VIEWS ON THIS POST

160

Posted on:

Wednesday 17th October 2012
View Replies!

swt hyperlink

can anybody please tell me with an example how to provide hyperlink text using SWT.I mean on clicking the text it goes to web page, i got idea of using html,it worked ...but its nopt working when other components are used in SWT.
VIEWS ON THIS POST

119

Posted on:

Thursday 18th October 2012
View Replies!

ticking clock in a swt application

Hi everybody. I am building an SWT application which serves as a support for a board game (keeping score etc.) and as one of the features it contains a timer as a part of the interface. The idea is to have a label which displays seconds left of the clock and two buttons - start(stop) and reset. I know this is a typical threading problem - I just need a thread which would tick every second and notify the label about it. However I can't fathom how to code this. I have tried with Timer and TimerTasks, but I always seem to get "org.eclipse.swt.SWTException: Invalid thread access". Can someone please help me and tell me how to do this
VIEWS ON THIS POST

92

Posted on:

Thursday 18th October 2012
View Replies!

Modify the height of rows in swt Table

I am fetching how can i modify the height of rows in swt Table. I used this code : table.addListener(SWT.MeasureItem, new Listener() { public void handleEvent(Event event) { event.gc.setLineWidth(varWidth); event.height = varHeight; } but the problem is that i can just increase the height of rows but not decreasing it. Can someone help me!
VIEWS ON THIS POST

77

Posted on:

Monday 22nd October 2012
View Replies!

org.eclipse.swt.SWTException: Widget is disposed

I'm new to SWT technologie, and when I was tring to create a multi forms aplication, I created a Button that opens an other Shell object : Display display = new Display(); final Shell shell = new Shell(display); final Shell ajouterForm = new Shell(shell,SWT.BORDER|SWT.CLOSE);
VIEWS ON THIS POST

73

Posted on:

Monday 22nd October 2012
View Replies!

swt buttons wont right-align

Hi , Good Day.. I need to create a dialog box for user to enter their name and implemented gridlayout. I divide the shell widget into 3 columns and I want the first column be occupied by the label having it left aligned. Then I merge the last two columns and wanted the two buttons place right aligned into the shell. But my problem is, the GUI does not draws itself correctly. Here's my code. public void createGUI() { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Project1"); GridLayout layout = new GridLayout(); layout.numColumns = 3; layout.makeColumnsEqualWidth = true; layout.verticalSpacing = 20; shell.setLayout(layout); GridData gridData = new GridData(GridData.FILL_BOTH); Label label = new Label(shell, SWT.NONE); label.setText("Please Enter Your Name:"); label.setLayoutData(gridData); Composite composite = new Composite(shell, SWT.NONE); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 2; composite.setLayoutData(gridData); layout = new GridLayout(); layout.numColumns = 1; composite.setLayout(layout); /**** Added to make it fit Label lblHidden = new Label(composite, SWT.NONE); gridData = new GridData(GridData.FILL_BOTH); gridData.heightHint = 1; lblHidden.setLayoutData(gridData); lblHidden.setVisible(false);*****/ gridData= new GridData(GridData.HORIZONTAL_ALIGN_END); Button cmdOK = new Button(composite, SWT.PUSH); gridData.widthHint =50; cmdOK.setLayoutData(gridData); cmdOK.setText("Ok"); Button cmdCancel = new Button(composite, SWT.PUSH); gridData= new GridData(GridData.HORIZONTAL_ALIGN_END); gridData.widthHint =50; cmdCancel.setLayoutData(gridData); cmdCancel.setText("Cancel"); gridData = new GridData(GridData.FILL_BOTH); gridData.heightHint = 15; gridData.horizontalSpan = 3; Text txtInput = new Text(shell, SWT.BORDER); txtInput.setLayoutData(gridData); shell.pack(); shell.open(); while(!shell.isDisposed()) { if(!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
VIEWS ON THIS POST

89

Posted on:

Monday 22nd October 2012
View Replies!

learning swt

Hi Everyone, Good Day.. I was given a task to customize a project that was written in a foreign language. As I browse all the classes, it was well written in SW. I dont know SWT so I am thinking about buying a book about it. Could you suggest me what good book to start with and also online resources for learning Also, I learned about MVC in the Struts framework, I want to know also if MVC can be applied in swt desktop programming and perhaps learn how to implement it here.
VIEWS ON THIS POST

60

Posted on:

Monday 22nd October 2012
View Replies!

org.eclipse.swt.widgets.List - how to set visibile row count?

I am using an SWT List (org.eclipse.swt.widgets.List) and need a way to set the height of the list to say 10 items. JList has a method setVisibleRowCount(int). What can I do to achieve this same effect
VIEWS ON THIS POST

70

Posted on:

Tuesday 23rd October 2012
View Replies!

what's the difference between swt/eclipse/Isaw...?

Hi I know this may sound stupid but what's the difference between swt eclipse Isaw..or are they just additonal tools that supporting java and if I want to creat a user interface ..base on using java Like a login window would I choose any of these tools if not what can I do ....I also wants to know how(swt eclipse Isaw)they relate to each other ........ Java is new to me please help
VIEWS ON THIS POST

67

Posted on:

Tuesday 23rd October 2012
View Replies!