private void CreateAndShowGUI() { //Make sure we have nice window decorations. JFrame.SetDefaultLookAndFeelDecorated(true); //Create and set up the window. frame = new JFrame("Stanford Named Entity Recognizer"); frame.SetDefaultCloseOperation(WindowConstantsConstants.ExitOnClose); frame.GetContentPane().SetLayout(new BorderLayout()); frame.GetContentPane().SetSize(Width, Height); frame.SetJMenuBar(AddMenuBar()); //frame.setSize(new Dimension(WIDTH, HEIGHT)); frame.SetSize(Width, Height); BuildTagPanel(); BuildContentPanel(); //Display the window. frame.Pack(); frame.SetSize(Width, Height); frame.SetVisible(true); }
// private String initText = "In"; private void BuildContentPanel() { editorPane = new JEditorPane(); editorPane.SetContentType("text/rtf"); editorPane.AddKeyListener(new NERGUI.InputListener(this)); // defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes(); StyleConstants.SetFontFamily(defaultAttrSet, "Lucinda Sans"); IDocument doc = new DefaultStyledDocument(); editorPane.SetDocument(doc); try { doc.InsertString(0, initText, defaultAttrSet); } catch (Exception ex) { throw new Exception(ex); } JScrollPane scrollPane = new JScrollPane(editorPane); frame.GetContentPane().Add(scrollPane, BorderLayout.Center); editorPane.SetEditable(true); }
public static void Main(String[] args) { Robot robot = new Robot(); size = Toolkit.GetDefaultToolkit().GetScreenSize(); JFrame frame = new JFrame("Ghost Mouse (tm)!"); JButton button = new JButton("Gho Ghost"); frame.GetContentPane().Add(button); button.AddActionListener(new CircleListener(robot)); frame.Pack(); frame.SetLocation((int)(size.Width - frame.GetWidth()) / 2, (int)(size.Height - frame.GetHeight()) / 2); frame.SetVisible(true); }
/// <exception cref="System.IO.IOException"/> public static void Main(string[] args) { TreeJPanel tjp = new TreeJPanel(); // String ptbTreeString1 = "(ROOT (S (NP (DT This)) (VP (VBZ is) (NP (DT a) (NN test))) (. .)))"; string ptbTreeString = "(ROOT (S (NP (NNP Interactive_Tregex)) (VP (VBZ works)) (PP (IN for) (PRP me)) (. !))))"; if (args.Length > 0) { ptbTreeString = args[0]; } Tree tree = (new PennTreeReader(new StringReader(ptbTreeString), new LabeledScoredTreeFactory(new StringLabelFactory()))).ReadTree(); tjp.SetTree(tree); tjp.SetBackground(Color.white); JFrame frame = new JFrame(); frame.GetContentPane().Add(tjp, BorderLayout.Center); frame.AddWindowListener(new _WindowAdapter_256()); frame.Pack(); frame.SetVisible(true); frame.SetVisible(true); }