public Main() { JPanel contentPane = new JPanel(new BorderLayout()); RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60); textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); textArea.setCodeFoldingEnabled(true); textArea.setAntiAliasingEnabled(true); contentPane.add(new RTextScrollPane(textArea)); // A CompletionProvider is what knows of all possible completions, and // analyzes the contents of the text area at the caret position to // determine what completion choices should be presented. Most // instances of CompletionProvider (such as DefaultCompletionProvider) // are designed so that they can be shared among multiple text // components. CompletionProvider provider = createCompletionProvider(); // An AutoCompletion acts as a "middle-man" between a text component // and a CompletionProvider. It manages any options associated with // the auto-completion (the popup trigger key, whether to display a // documentation window along with completion choices, etc.). Unlike // CompletionProviders, instances of AutoCompletion cannot be shared // among multiple text components. AutoCompletion ac = new AutoCompletion(provider); ac.install(textArea); setContentPane(contentPane); setTitle("AutoComplete Demo"); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); }
/** Create the GUI and show it. */ public static void createFindProf() { // Create and set up the window. JFrame frame = new JFrame("Find Profesor"); frame.setBounds(600, 300, 80, 40); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // Create and set up the content pane. JComponent newContentPane = new FindProf(); newContentPane.setOpaque(true); // content panes must be opaque frame.setContentPane(newContentPane); frame.setResizable(false); AutoCompletion.enable(patternList); // Display the window. frame.pack(); frame.setVisible(true); }