Problem Importing ControlP5 in IntelliJ IDEA (used with Processing Core) - intellij-idea

I am developing an interactive program to simulate power grid switching and I have it working beautifully with the rendering tools in the Processing library. Now I want to add a user interface with menus and buttons, etc. I found the ControlP5 library and it seems like what I need, but I am having a hard time importing it into my project. I have the most current ControlP5 folders/files on my machine and I have added them as a project library. IntelliJ is recoginizing my import statement, but it won't let me declare a variable using the ControlP5 class.
My import statement seems good to go... it is greyed out as an unused import.
But the very last line in the code copied here generates an error "Cannot resolve symbol 'ControlP5'"
import processing.core.PApplet;
import processing.core.PConstants;
import processing.event.*;
import controlP5.*;
public class Main extends PApplet {
Viewport viewport = new Viewport();
Click click = new Click();
UserInterface ui = new UserInterface();
ControlP5 cp5;
Here is a screen shot of my libraries. I have the Processing Core library which I am using for drawing tools, and I want to also use classes from the ControlP5 library which I believe I have correctly linked as an external library here.
Here is a screen shot of my module dependencies.
Here is a screen shot of the bottom of my project tree. I can see that Processing is correctly shown, but I do not see the ControlP5 library here.
I have tried multiple different methods of adding just certain subfolders of the "controlp5-master" folder which I downloaded with no luck.
I have also searched through Google, Processing forum, and Stack Overflow and can't find an answer.
Any advice?

My problem was solved on the Processing Forum. I simply referenced the wrong file when establishing my external library. The ControlP5 download package includes a jar file that is buried several folders deep. Once I pointed the library to that jar file, I was in business.

Related

I don't manage to add a file to my QML project with Qt Creator Qt6

I feel a bit ashamed but I simply don't manage to add a file to my QML project in Qt Creator.
I use Qt 6.2.3 and my build system is qmake.
First off, I created a file MyButton.qml by doing a right click on the folder named QML of a project which only contains a main.qml file.
Then, when I type MyButton in main.qml I can use the autocompletion so I see Qt Creator detects my new type.
But during executation, I got this error :
QQmlApplicationEngine failed to load component
qrc:/MyProject/main.qml:9:5: MyButton is not a type
Anyone knows how to add a file to a project ?
I carefuly followed the official documentation (https://doc.qt.io/qt-6/qtqml-documents-definetypes.html) and several tutorials but nothing works. That's crazy.
EDIT :
I did what JarMan advises but I still get the same error.
Here is an image of my project arborescence
And the content of the qml.qrc file :
<RCC>
<qresource prefix="/">
<file>MyButton.qml</file>
<file>main.qml</file>
</qresource>
</RCC>
I believe the problem you're running into is simply that your executable doesn't know where to find your .qml file because the build folder is usually not the same as the source folder. To fix this, you should create a resource file (you can name it something like qml.qrc) and list all of your QML files in there. This allows the QML file to get bundled into the executable.
An example would look like this:
<RCC>
<qresource prefix="/">
<file>MyButton.qml</file>
</qresource>
</RCC>
Then in your .pro file, add this line:
RESOURCES += qml.qrc
EDIT:
You can do the same thing in Qt Creator.
Step 1:
You might already have a resource file in your project. If so, you'll see it in the Project view on the left side of the window. If you do, you can skip to Step 2. Otherwise, go to File->New File... and select Qt Resource File. Name it qml.qrc (or whatever you like).
Step 2:
Once you've created that file, it should now show up in the Project view on the left. You can right-click on the file name and select Add Existing Files. Choose your MyButton.qml file. That should do exactly what I mentioned in my original answer, but without manually typing any code.
I got the same error with Qt 6.3.1
I found the Qt Creator doesn't generate the qml.qrc file when you select Minimum required Qt version: to Qt 6.2.
So I switched the Minimum required Qt version: to Qt 5.15 in Qt Creator Wizard, the qml.qrc file will generated and my custom component qml file would be included automatically in it.
Also, the .pro configure file has different items between these two Qt version.
Solution 1:
add qml in the pro file:
resources.files = main.qml MyButton.qml
Solution 2:
add a qrc file into project and add qml as resource file

JFoenix library does not have JFXTabPane support in scenebuilder?

Why doesn't JFoenix have the JFXTabPane in the imported .jar in scenebuilder?
This means when I try to open my .fxml file with scenebuilder in intellij it gives me the .fxml file is not a FXML document error.
Even after importing the entire JFoenix library in scenebuilder I won't be able to use it because it can't open it without the JFXTabPane.
I downloaded the most recent versions of SceneBuilder (17) and jfoenix (9.0.10) and dragged the jfoenix jar to the library pane in SceneBuilder to import it. The import completed, JFXTabPane was displayed in the library. When I tried to drag a JFXTabPane from the library catalog into a scene, scene builder started behaving oddly (it broke and did not render the scene being built correctly). So it JFXTabPane still doesn't work with SceneBuilder. I advise you file an report with jfoenix to ask them to fix the issue (they have an issue tracker on their github site).
The asker did note in comments that, under the setup they are using:
jfoenix 9 is displaying the JFXTabPane
That might be due to using a different version of SceneBuilder than the version 17 I used.
If you continue to have issues, just use a plain TabPane in your FXML document rather than a JFXTabPane. I looked at the source and, functionally they are the same, JFXTabPane inherits from TabPane. In your code, create a new JFXTabPane and replace the TabPane injected by scene builder with your new pane (setting the children and properties the same as the fxml), and you should be fine to design in SceneBuilder but still use a JFXTabPane in your actual app. It is a bit of a hack, but not too bad.
There may be similar issues with using other jfoenix controls in SceneBuilder (I don't know, I haven't tried them), but basic jfoenix controls like JFXButton appeared to work in SceneBuilder fine, so perhaps it is on the JFXTabPane which experiences these issues.
For further information on troubleshooting SceneBuilder custom component import, see the following document (though it may not assist in all cases):
How to create an FXML file for an already created new component in java than add it to scene builder?
The answer to which features a SceneBuilder import troubleshooting section.

Intellij Flutter - Import via Alt+Enter not working

My team members and me often face the problem in Intellij that we cannot import some classes via Alt+Enter because Intellij hasn't indexed them successfully.
Our set up
We have different Flutter projects which belong and work together.
ProjectFolder:
our_project/customer_app
our_project/provider_app
our_project/server_app
our_project/model_app
Some of these projects have dependencies to other projects which are declared in the pubspec.yaml file.
Problem
E.g. the customer_app has a dependency to the model_app.
Now we add this new class in model_app such as class MyModel.
Later in the process we want to use MyModel inside of the customer_app.
If we type something like MyModel() and try to press Alt+Enter it doesn't find the class immediately. (it works miracously only sometimes)
What we have to do then is to copy the path of MyModel and do the import manually. Which is often time consuming.
We even tried to run flutter packages get which also doesn't help to find this import of MyModel. Ideally we want that Intellij find the import automatically by indexing it without copying the path out of the other project.
This is a known issue and planned to be fixed eventually.
You can upvote https://github.com/dart-lang/sdk/issues/25820

Add external libraries to my project issue

I try to add external library to my current project, but my project can't pick up the library.
I have MyLib.java file in other directory.
/Users/cat/myfile/github/JavaLib/MyLib.java
I want to my current project (/home/project/HelloWorld/HellowWorld.java) to use my MyLib.java
I'm following the steps to add Library to Intellij(15CE)
Menu->Project Structure->Libraries
click (+) symbol->select Java -> select my path(/home/lib/)
Here is the screenshot
Now that you have added your JavaLib directory to the project you should be able to use the code inside JavaLib in your code now. Intellij should offer auto-complete when you start to type the name of a JavaLib class and automatically include the import for you in your code.
The disabled Apply button you circled isn't an issue. I get that in my view too. It just means nothing has changed that needs to be applied currently.

Xcode 4 'QuartzCore/CIColor.h' file not found

I'm running Xcode 4 and trying to follow the steps in Apple's Image Kit Programming Guide (which is written for Xcode 3) on how to work with an Image View and the IKImageView class. I just imported the Quartz and Quartz Core frameworks (from /System/Frameworks directory) to my blank Cocoa Application project using File > Add Files to... menu, but when I try to Run my application I get this error:
Lexical or Preprocessor Issue 'QuartzCore/CIColor.h' file not found
Does anyone know what could be a reason?
Peter Hosey replied:
You're not supposed to import specific headers directly, and especially not from sub-frameworks (such as Core Image, sub-framework of QuartzCore). Only import a framework's overall header, which usually has the same name as the framework.
I didn't import any specific headers directly, I just choose File>Add Files to... then choose /system/Frameworks and choose two folders which contain those frameworks, after that they appeared in my project navigator view as they should, but the code wouldn't compile any more. It shows me NSColor.h file which is found in the AppKit framework, points at this line: #import and says Lexical or Preprocessor Issue 'QuartzCore/CIColor.h' file not found. I have no clue why it wouldn't compile. CI stands for Core Image. I'm now reading a guide on Core Image, maybe this will help. I'd like to post a screenshot but I can't (not enough rights yet).
I just imported the Quartz and Quartz Core frameworks (from /System/Frameworks directory) to my blank Cocoa Application project using File > Add Files to... menu, …
That's not importing; that's just adding it to the project (and hopefully the target). Importing is what you do with the #import directive.
… but when I try to Run my application I get this error: Lexical or Preprocessor Issue 'QuartzCore/CIColor.h' file not found
You're not supposed to import specific headers directly, and especially not from sub-frameworks (such as Core Image, sub-framework of QuartzCore). Only import a framework's overall header, which usually has the same name as the framework.
The problem was that the Guide I used was written for Xcode 3 so when I tried to import/add some frameworks to my project using "File>Add files" menu as described, it did add those frameworks and I could see them in the project navigator, but something went wrong. In Xcode 4 you should use a different way to add/import Frameworks by using the Project Editor> Summary tab> Linked Frameworks and Libraries> Click "+" and then choose the Frameworks you need. That fixed the issue.