• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Text Field Display

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Created a class MessageDisplay

public class MessageDisplay extends Window{
private IWorkbenchWindow window;
Text t;

MessageDisplay(Shell parent){
super(parent);
t=new Text(parent.getShell(),SWT.SINGLE | SWT.BORDER);

}

public static void createForm(Shell parent, String title){

MessageDisplay md=new MessageDisplay(parent);

md.open();



}


}

When the application [MessageDisplay.createForm(window.getShell(),"hi")] is run its only a window that is being displayed but no testbox appears though it has been added.

Please let me know where it has gone wrong.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Swing/AWT forum.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please use code tags to post code; it makes it easier to read.
Have you actually added the Text object? It has been created, but I can't seem to see you adding it.
 
deepa anandan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
t=new Text(parent.getShell(),SWT.SINGLE | SWT.BORDER);

Does it not add the Text object??
If I am wrong please correct me and pls do specify how to add the Text object.
 
Campbell Ritchie
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it creates the object, but you have to add it specifically. You use the add() calls so you can decide where to locate your object. Otherwise they might be put in the wrong position, or even on the wrong component.

Go through the API specifications, find the Window class and look through to find methods to add. (Hint ctrl-F may help .)

Do you really mean to use Window as a container rather than JFrame? Remember a Window has no border or toolbar or close button or anything.
 
reply
    Bookmark Topic Watch Topic
  • New Topic