Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Swing problems in Eclipse.
Swing problems in Eclipse. [message #496654] Tue, 10 November 2009 19:36 Go to next message
Irum Godil is currently offline Irum GodilFriend
Messages: 35
Registered: July 2009
Member
Hi,

I have a Swing JPanel, inside which I have a JTextField. The panel is added to an Eclipse view. If I run the Swing application, I can easily enter text into the JText field.

But when inside the Eclipse view, I cannot even click inside the text field.

Does anyone know what is the solution to this.

Thanks in advance,
Irum.
Re: Swing problems in Eclipse. [message #496848 is a reply to message #496654] Wed, 11 November 2009 14:42 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Please provide us the SWT snippet, similar to http://www.eclipse.org/swt/snippets and we can have a look at it.

PW


Re: Swing problems in Eclipse. [message #496867 is a reply to message #496654] Wed, 11 November 2009 15:26 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
I haven't heard of this before, and the basic snippet below works for me on
Windows, so it must be somewhat dependent on your context. Which platform
do you see this on? Which version of SWT are you using? Can you change the
snippet below to show the failure? Or if not, can you provide a basic
plug-in with a view that shows the problem?

public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(10,10,200,200);
Button button = new Button(shell, SWT.PUSH);
button.setBounds(10,10,150,30);
button.setText("SWT Button");
Composite composite = new Composite(shell, SWT.EMBEDDED);
composite.setBounds(10,50,150,100);
java.awt.Frame fileTableFrame = SWT_AWT.new_Frame(composite);
java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout());
fileTableFrame.add(panel);
JTextField textField = new JTextField("JTextField");
panel.add(textField);
shell.open();
while(!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}

Grant


"Irum Godil" <irum@ca.ibm.com> wrote in message
news:hdcfbm$vjn$1@build.eclipse.org...
> Hi,
>
> I have a Swing JPanel, inside which I have a JTextField. The panel is
added to an Eclipse view. If I run the Swing application, I can easily enter
text into the JText field.
>
> But when inside the Eclipse view, I cannot even click inside the text
field.
>
> Does anyone know what is the solution to this.
>
> Thanks in advance,
> Irum.
Re: Swing problems in Eclipse. [message #498429 is a reply to message #496867] Mon, 16 November 2009 21:29 Go to previous messageGo to next message
Irum Godil is currently offline Irum GodilFriend
Messages: 35
Registered: July 2009
Member
Hi,

Thanks for your replies. I have created a basic Eclipse view and added the Text field called: "repeatIndex". If I run the application as it is through the "main" API everything is fine. But inside the Eclipse view, I cannot type in the text box.

Please let me know if you need anything else.

Thanks.
Irum.
Re: Swing problems in Eclipse. [message #498430 is a reply to message #498429] Mon, 16 November 2009 21:31 Go to previous messageGo to next message
Irum Godil is currently offline Irum GodilFriend
Messages: 35
Registered: July 2009
Member
Hi,

I am not sure if you can see my project. I have attached it, but I do not see it uploaded. If you cannot see it, please let me know how to attach it. Perhaps the buttons below are not working.

Thanks.
Re: Swing problems in Eclipse. [message #498832 is a reply to message #498429] Wed, 18 November 2009 18:10 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
This appears to be an swt bug so I've logged
https://bugs.eclipse.org/bugs/show_bug.cgi?id=295493 . Giving focus to the
JTextField always failed for me both as an eclipse view and as a stand-alone
app run from main().

I don't know what precisely is triggering the problem, but you may be able
to work around it by changing your awt/swing code (are you able to change
it?). For instance, I could make the snippet work with swt by changing its
populate() method to the body below. I know that the snippet now does not
resemble your app too closely, but perhaps sticking to awt rather than swing
as much as possible could help you work around it.

java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout());
JTextField repeatIndex = new JTextField();
repeatIndex.setText(" ");
panel.add(repeatIndex);
f.add(panel);

HTH,
Grant


"Irum Godil" <irum@ca.ibm.com> wrote in message
news:hdsg8d$30e$1@build.eclipse.org...
> Hi,
>
> Thanks for your replies. I have created a basic Eclipse view and added the
Text field called: "repeatIndex". If I run the application as it is through
the "main" API everything is fine. But inside the Eclipse view, I cannot
type in the text box.
>
> Please let me know if you need anything else.
>
> Thanks.
> Irum.
Previous Topic:applet in swt browser policy file affect
Next Topic:StyledText-AbstractDecoratedTextEditor
Goto Forum:
  


Current Time: Wed Apr 24 23:57:23 GMT 2024

Powered by FUDForum. Page generated in 0.03115 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top