GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Text Field Display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Text Field Display" Watch "Text Field Display" New topic
Author

Text Field Display

deepa anandan
Greenhorn

Joined: Jun 06, 2006
Posts: 24
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.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Moving to the Swing/AWT forum.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39100
    
  23
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

Joined: Jun 06, 2006
Posts: 24
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
Sheriff

Joined: Oct 13, 2005
Posts: 39100
    
  23
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.
 
GeeCON Prague 2014
 
subject: Text Field Display