My professor gave me these classes but when I try to run them it seems that AnimationNoApplet cannot find NoApplet the title is the error I receive. I have both files in the same folder and have tried switching the package names to be identical but no success.
This is AnimationNoApplet:
package noapplet.example;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.Timer;
import noapplet.NoApplet;
/** Reusable class implementing the animation idiom. */
#SuppressWarnings("serial")
public abstract class AnimationNoApplet extends NoApplet {
This is NoApplet
package noapplet;
#SuppressWarnings("serial")
public class NoApplet extends JPanel {
There is many lines to the two files but I believe this is the root of the problem. Another thing that I noticed was the class made for AnimationNoApplet was NoApplet$1.class. I'm not sure if this is relevant information but I thought I should call it out. The last thing I want to call out is that this is on visual studio code I have not used another editor.
Related
Specifically, I am trying to enable .SVG files to be usable by the core image component.
Right now I am making a sling model that ideally I would like to access the returned values of the getSrc() and getFileReference() classes in the core AEM Component interface located here.
I am very new to AEM development and Sling models. Am I missing some vital functionality that would let me do this?
Here is my code, which probably isn't at all helpful at this point.
package com.site.core.models;
import com.adobe.cq.wcm.core.components.models.Image;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.models.annotations.*;
import org.apache.sling.models.annotations.injectorspecific.*;
import org.apache.sling.settings.SlingSettingsService;
import javax.jcr.Node;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.inject.Inject;
#Model(adaptables = SlingHttpServletRequest.class)
public class ImageModel {
private String src = Image.getSrc();
return src;
}
As I mentioned in my comment, the link you are referring to is an interface, the implementation of that interface is here
In order to use your own implementation, you have two options:
In the image component html, change the data-sly-use to refer to your impl: com.site.core.models.ImageModel
Create a separate model that implements the Image interface and give it a high ranking to be picked up instead of the existing impl.
Disclaimer: I have not tested #2 but the documentation suggests that it's possible.
I am trying to make a Java applet. So far I have this:
import javax.swing.*;
import java.awt.*;
public class Applet extends JApplet {
public void start(){}
public void init(){}
public void paint(Graphics g){}
}
But I get this message: javax.swing.JApplet is not present in JRE Emulation Library
Also this message: java.awt.Graphics is not present JRE Emulation Library
If I change the import statements to the following:
import javax.swing.JApplet;
import java.awt.Graphics;
I still get the same message.
I have come across many links but nothing gives me the option to download javax.swing.JApplet and java.awt.Graphics to get my applet to work
I am working in an Android project recently. Our project uses a computer vision library called boofcv:
http://boofcv.org/index.php?title=Main_Page
After importing the library source code into our project, I found that Android Studio cannot revolve symbols from sun.awt.image.* and java.awt.color.ColorSpace.
package boofcv.core.image;
import boofcv.struct.image.*;
import sun.awt.image.ByteInterleavedRaster;
import sun.awt.image.IntegerInterleavedRaster;
import sun.awt.image.ShortInterleavedRaster;
import javax.swing.*;
import java.awt.*;
import java.awt.color.ColorSpace;
import java.awt.image.*;
import java.lang.reflect.Array;
/**
* Functions for converting to and from {#link BufferedImage}.
*
* #author Peter Abeles
*/
public class ConvertBufferedImage {
......
But then I wrote a very simple test program and found that my jdk did contain those classes. my program:
import sun.awt.image.ByteInterleavedRaster;
import sun.awt.image.IntegerInterleavedRaster;
import sun.awt.image.ShortInterleavedRaster;
import javax.swing.*;
import java.awt.*;
import java.awt.color.ColorSpace;
import java.awt.image.*;
class test{
public static void main(String[] args) {
ByteInterleavedRaster b;
IntegerInterleavedRaster i;
ShortInterleavedRaster s;
ColorSpace c;
System.out.println("testing");
}
}
Did I miss some configuration or it is just the issue of Android Studio?
Any help is greatly appreciated.
Don't use the visualization package for anything on Android. It's based off on swing which isn't supported on Android. Use the android package in integration. It has similar functions for visualizing data.
https://github.com/lessthanoptimal/BoofAndroidDemo
that might be useful for you.
I am new to java though I have some experience with R.
I have taken part of a java course and have read a book or two as well as the API guides published by interactive brokers. This API is higher level than anything I have worked with before, obviously.
The very first thing I want to do is simply connect to the software. I have been able to do this with the test GUI that Interactive Brokers provides. However, when writing my own script, I am getting an error: Uncompilable source code - Erroneous sym type. I have imported the javaclient/com directory into my new project.
The line that is causing the error is econnect(port=7496, clientid=0);
Reading the documentation, this should work, but obviously does not.
Below is the full code. All of the import calls were copied from a sample file that IB provided. onHowToDetermineStock() is copied from another part of the documentation. Before I can do anything, I obviously need to to connect.
Any ideas?
Thank you.
package ibapp;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.ArrayList;
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import com.ib.controller.ApiConnection.ILogger;
import com.ib.controller.ApiController;
import com.ib.controller.ApiController.IBulletinHandler;
import com.ib.controller.ApiController.IConnectionHandler;
import com.ib.controller.ApiController.ITimeHandler;
import com.ib.controller.Formats;
import com.ib.controller.Types.NewsType;
import com.ib.client.EClientSocket;
/**
*
* #author
*/
void onHowToDetermineStock(){
Contract contract = new Contract();
Order order = new Order();
contract.m_symbol = "IBKR";
contract.m_secType = "STK";
contract.m_exchange = "SMART";
contract.m_currency = "USD";
order.m_action = "BUY";
order.m_totalQuantity = 100;
order.m_orderType = "LMT";
order.m_lmtPrice = enteredLmtPrice;
m_client.placeOrder(GlobalOrderId, contract, order);
}
public class IBApp {
/**
* #param args the command line arguments
*/
public static void main(String[] args) {
econnect(port=7496, clientid=0);
onHowToDetermineStock();
}
}
There are a number of problems with your code that make it an invalid Java program.
In Java, all methods must be contained within a class, unlike your onHowToDetermineStock method. Also, unlike R, Java doesn't use named parameters (i.e. port=7496 is not valid except to assign a variable named port). There are other problems.
Java is an object-oriented language and is very different from R. I would suggest forgetting the IB API for the time being, and spending some time learning how to code a basic Java application. There are many free tutorials on the web.
E.g.: https://docs.oracle.com/javase/tutorial/
The error, Netbeans gives me, is:
static import only from classes and interfaces
which is somehow strange for me, as this:
import org.lwjgl.opengl.GL11;
works fine while this:
import static org.lwjgl.opengl.GL11;
doesn't. Why is it not working for me?
BTW, GL11 is a class and I don't know why but Netbeans, when importing statically, thinks opengl is the class I want to import.
You wanna write:
import static org.lwjgl.opengl.GL11.*;
You are importing the members of the class, thus the * at the end.
Static import allows you to import static fields of other class. For example you can say
import static java.awt.Color.RED;
And then use RED in your class without mentioning class where it is defined.