[SOLVED] Can't add Swing component

Hi everyone,
I'm trying to add a Swing component into the editor, but I can't create Swing objects in the concept function. They won't appear in the autocomplete menu and when I try to write the class name out, it stays red. Do I need to set a dependency or sth. like that?

1 comment
Comment actions Permalink

Hi, you need to "import" the Java packages (aka stub models) that you want to refer to in your code. While in Java you would add "import" statements at the top of your file, in MPS you specify such "imports" through model dependencies - https://confluence.jetbrains.com/display/MPSD20172/Getting+the+dependencies+right#Gettingthedependenciesright-Usefulkeyboardshortcuts

In essence, press Control/Cmd + R and type the name of the class you want to make visible. Or press Control/Cmd + M and type the name of the Java package (e.g. java.swing).




Please sign in to leave a comment.