I am new to Java programming. I am facing this error, and not understanding how to resolve this. Any help would be appreciated.
public class ThermostatView extends JFrame
{
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
ThermostatView frame = new ThermostatView();
frame.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
/**
* Constructs a ThermostatView
*/
public ThermostatView()
{
thermostatObj = new Thermostat();
initComponents();
}
}
And this is my other class:
public class Thermostat extends ThermostatView
{
private static final long serialVersionUID = 1L;
public void setActualTempFunc(String actualTemp)
{
if(actualTemp.length() != 0)//actualTemp != null && !actualTemp.isEmpty())
lblActualTemp.setText(actualTemp);
else
lblActualTemp.setText("-");
}
}
the error is:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
JFrame cannot be resolved to a type
at Thermostat.<init>(Thermostat.java:3)
at ThermostatView.<init>(ThermostatView.java:145)
at ThermostatView$1.run(ThermostatView.java:128)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Looks like its getting caught in recursion.
Any help ???
I can see a few errors with your code.
You need to ensure you have all the required packages imported (e.g. java.awt.* etc).
Where are you delcaring lblActualTemp and thermostatObj ? You need to explicity delcare their type.
Using an IDE (development software) such as Eclipse, IntelliJ or Netbeans etc. usually spot these errors before you compile.
Related
I am using Sikuli with Java to create a small automation tool. I am having trouble with this Unhandled Exception error. I am trying to pass a method I created to the GUI actionPerformed method.
package mission;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
import tools.ChooseMission;
public class Story {
public static void runStoryMissions(int chapter, int stage) throws FindFailed, InterruptedException {
Screen screen = new Screen();
ChooseMission.ChooseChapter(screen,chapter);
ChooseMission.ChooseStage(screen, stage);
int dailyBiometricCount = ChooseMission.dailyBiometricCount(screen);
Pattern start = new Pattern("img/chapters/start.png");
Pattern replay = new Pattern("img/chapters/replay.png");
Pattern next = new Pattern("img/chapters/next.png");
Pattern mission_finish_bar = new Pattern("img/chapters/mission_finish_bar.png");
screen.click(start);
System.out.println("The mission has started.");
Thread.sleep(2000);
while (find(screen, mission_finish_bar) == false) {
System.out.println("Still playing the mission...");
}
if (screen.exists(mission_finish_bar) != null){
System.out.println("The mission has finished.");
}
System.out.println("Wait for 5 Seconds");
Thread.sleep(5000);
System.out.println("Click repeat button");
screen.click(replay);
}
Here is the code for my actionPerformed listener button:
btnStartMissions.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int chapter = Integer.parseInt(txtFldChapter.getText());
int stage = Integer.parseInt(txtFldStage.getText());
System.out.println("Chapter #: " + chapter);
System.out.println("Stage #: " + stage);
try {
Story.runStoryMissions(chapter, stage);
} catch (FindFailed e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
There is a error at Story. runStoryMissions(chapter,stage) it says: Unhandled Exception type FindFailed and InterruptedException
Stack Trace:
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at mission.Story.runStoryMissions(Story.java:12)
at GuiFrame1$2.actionPerformed(GuiFrame1.java:94)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.IllegalThreadStateException: Cannot call method from the event dispatcher thread
at java.awt.Robot.checkNotDispatchThread(Unknown Source)
at java.awt.Robot.waitForIdle(Unknown Source)
at org.sikuli.script.Mouse.move(Mouse.java:345)
at org.sikuli.script.Mouse.move(Mouse.java:318)
at org.sikuli.script.Mouse.init(Mouse.java:59)
at org.sikuli.script.Screen.initScreens(Screen.java:89)
at org.sikuli.script.Screen.<clinit>(Screen.java:58)
... 38 more
Okay, I found the answer to my problem if anyone is interested.
Sikuli uses the java.awt features so scripts cannot implement and use Swing elements.
Java AWT Robot actions cannot be called froma Java swing container.
Solution is to create a new Thread:
new Thread(() -> {
try {
Story.runStoryMissions(chapter, stage);
} catch (FindFailed | InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}).start();
I am trying to create a label in RCP application which which is initially not visible. When I click Save button, it becomes visible. Again, it should be invisible with 5 seconds.
For this purpose I wrote this following code:
saveButton.addSelectionListener(new SelectionListener() {
#Override
public void widgetSelected(SelectionEvent e) {
// TODO Auto-generated method stub
System.out.println(textName.getText());
String text = textName.getText();
tree.getSelection()[0].setText(text);
String nodeId = ((TreeStructure) tree.getSelection()[0]
.getData()).getNodeId();
// update the database
UpdateTree updateTree = new UpdateTree();
updateTree.renameNode(text, nodeId);
label.setBounds(xForFirstButton, yIndexForButtons
+ Constants.BUTTON_BUFFER, Constants.BUTTON_WIDTH,
Constants.BUTTON_HEIGHT);
label.setVisible(true);
AbstractAction myAction = new AbstractAction() {
private static final long serialVersionUID = 1L;
#Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
label.setVisible(false);
}
};
Timer myTimer = new Timer(5000, myAction);
myTimer.start();
}
But, this code, while running gives this following error:
Exception in thread "AWT-EventQueue-0" org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4441)
at org.eclipse.swt.SWT.error(SWT.java:4356)
at org.eclipse.swt.SWT.error(SWT.java:4327)
at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:367)
at org.eclipse.swt.widgets.Control.setVisible(Control.java:3781)
at com.app.editor.views.EditorView$2$1.actionPerformed(EditorView.java:183)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Can please anyone point what is the issue?
Thanks in advance!
All code which changes the UI must run in the UI thread - Timer is running the code in a different thread.
Instead of Timer use:
Display.getDefault().timerExec(milliseconds, runnable);
To update you ui from a thread which is not the ui thread you have to use this:
Display.getDefault().syncExec(new Runnable() {
public void run() {
// Update UI here
}
});
syncExec will perform your actions within the ui thread of your rcp application.
This is similar to the invokeLater() method in Swing.
I was trying my first code in java swing and got many errors. my code is:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Swinging extends JFrame
{
JTextField ans;
int count =0;
static final long serialVersionUID = 1L;
Swinging()
{
Container cp= getContentPane();
cp.setLayout(new FlowLayout());
cp.add(new JLabel("value",7));
ans=new JTextField("0",10);
cp.add(ans);
JButton inc= new JButton("increment");
cp.add(inc);
inc.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
++count;
ans.setText(count+"");
}
});
setSize(200,200);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
public class Usingswing {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new Swinging(); // Let the constructor do the job
}
});
}
}
and the errors are as follows:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: horizontalAlignment
at javax.swing.JLabel.checkHorizontalKey(Unknown Source)
at javax.swing.JLabel.setHorizontalAlignment(Unknown Source)
at javax.swing.JLabel.<init>(Unknown Source)
at javax.swing.JLabel.<init>(Unknown Source)
at hopeso.Swinging.<init>(Usingswing.java:16)
at hopeso.Usingswing$1.run(Usingswing.java:45)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
i tried solving my problem using the questions posted by other people but it didn't workout. please help.
The error occurs because of the following line:
cp.add(new JLabel("value",7));
You're using JLabel's constructor that receives the text and the horizontal alignment. The alignment is an int, but it has to be one of the following constants, otherwise it will throw the IllegalArgumentException:
LEFT (2)
CENTER (0)
RIGHT (4)
LEADING (10)
TRAILING (11)
These constants are defined in SwingConstants, so you can just write something like this:
cp.add(new JLabel("value", SwingConstants.CENTER));
I have problems with idS. in sellContainer idS is 1 and in sellCtr is always 0 so the method addItemToSell is not working. Always give null pointer exception.
public class SellCtr{
private SellContainer sellContainer;
private OrderLineSell ols;
private int idS;
private int idOls;
public SellCtr(){
sellContainer = SellContainer.getInstance();
}
public void createSell(String date, Customer c, Employee e){
Sell sell = new Sell(date,c,e);
sellContainer.addSell(sell);
idS = sell.getId();
}
public void addItemToSell(OrderLineSell orderLineSell){
sellContainer.findSell(idS).addOrderLineSell(orderLineSell);
}
public int getId(){
return idS;
}
public int getIdOls(){
return idOls;
}
public Sell findSell(int idS){
return sellContainer.findSell(idS);
}
}
and the other class is :
public class SellContainer{
private ArrayList<Sell> sales;
private static int idS=0;
private static SellContainer instance=null;
public SellContainer(){
sales = new ArrayList<>();
}
public static SellContainer getInstance(){
if(instance == null){
instance = new SellContainer();
}
return instance;
}
public void addSell(Sell s){
idS++;
s.setId(idS);
sales.add(s);
}
public Sell findSell(int idS){
for(Sell sell : sales){
if(sell.getId()==idS){
return sell;
}
}
return null;
}
}
This is the error :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at controlLayer.SellCtr.addItemToSell(SellCtr.java:24)
at tuiLayer.SaleAddItemToSaleGUI$2.actionPerformed(SaleAddItemToSaleGUI.java:93)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I have rebuild the project and the exceptions changed.
EDIT 3 : I have made idS static and now it works. Thanks a lot guys!
I suggest you
make sure you are compiling all your classes. A build tool like maven or gradle will help.
you use enum for singletons. These are thread safe and simpler.
disable the feature in eclipse which allows you to run code which doesn't compile. This only delays finding errors which makes them worse.
I would replace
public class SellContainer{
private ArrayList<Sell> sales;
private static int idS=0;
private static SellContainer instance=null;
public SellContainer(){
sales = new ArrayList<>();
}
public static SellContainer getInstance(){
if(instance == null){
instance = new SellContainer();
}
return instance;
}
with
public enum SellContainer {
INSTANCE;
private final List<Sell> sales = new ArrayList<>();
private int idS = 0;
Initiate the object before the return object is back to the called method.
In SellContainer, if condition failure leads to give back the Sell Object as NULL.
You need to modify this logic.
return null;
My program seems to work quite well, but I keep getting "IllegalStateExceptions: RunnableQueue not started or has exited" from time to time, when I try to resize my component. I have set the documentState to ALWAYS_DYNAMIC and I have read that you are supposed to use the JSVGCanvas' UpdateManager and call invokelater(). I understand that it is available after the first time that
gvtBuildCompleted(GVTTreeBuilderEvent e)
is called, so I check whether it is running before I use it but I still get the exception.
The following method is called by a thread repeatedly and seems to cause the exception:
private void updateDomTree(final SVGComponent component, final Document doc)
{
if(component.getSvgCanvas().getUpdateManager() != null && component.getSvgCanvas().getUpdateManager().isRunning())
{
component.getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable()
{
public void run()
{
final Node newNode = doc.getChildNodes().item(0).getFirstChild();
//could be easier to get this value, but ... it works.
String newNodeId = newNode.getAttributes().getNamedItem("id").getFirstChild().getNodeValue();
NodeList nodes = component.getSvgDocument().getDocumentElement().getChildNodes();
Node updateNode = findElementById(nodes, newNodeId);
resizeComponent(component, doc);
component.getSvgCanvas().getSVGDocument().adoptNode(newNode);
component.getSvgCanvas().getSVGDocument().getDocumentElement().replaceChild(newNode, updateNode);
component.refreshSVGCanvas();
}
});
}
}
The actual resizing is done here:
protected void resizeComponent(SVGComponent component, Document doc)
{
Element svgRoot = doc.getDocumentElement();
final int svgWidth = Integer.parseInt(svgRoot.getAttribute("width"));
final int svgHeight = Integer.parseInt(svgRoot.getAttribute("height"));
String[] viewBox = svgRoot.getAttribute("viewBox").split(" ");
int viewBoxLeft = Integer.parseInt(viewBox[0]);
int viewBoxTop = Integer.parseInt(viewBox[1]);
final float factor = component.getScaleFactor();
String[] viewBoxOld = component.getSvgDocument().getDocumentElement().getAttribute("viewBox").split(" ");
int viewBoxLeftOld = Integer.parseInt(viewBoxOld[0]);
int viewBoxTopOld = Integer.parseInt(viewBoxOld[1]);
int xDiff = (int) ((viewBoxLeftOld - viewBoxLeft)*factor);
int yDiff = (int) ((viewBoxTopOld - viewBoxTop)*factor);
if ( viewBoxLeftOld != viewBoxLeft ) //If there is additional content left
{
component.setLocation(component.getLocation().x - xDiff, component.getLocation().y);
}
if ( viewBoxTopOld != viewBoxTop ) //If there is additional content right)
{
component.setLocation(component.getLocation().x, component.getLocation().y - yDiff);
}
component.getSvgDocument().getDocumentElement().setAttribute("width",""+svgWidth);
component.getSvgDocument().getDocumentElement().setAttribute("height",""+svgHeight);
component.getSvgDocument().getDocumentElement().setAttribute("viewBox", ""+viewBoxLeft+" "+viewBoxTop+" "+svgWidth+" "+svgHeight);
component.setSize((int)(svgWidth*factor),(int)(svgHeight*factor));
}
The method
refreshJSVGCanvas()
calls
JSVGCanvas.setDocument(Document);
JSVGCanvas.setSize(int, int);
Here's the full stack trace:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: RunnableQueue not started or has exited
at org.apache.batik.util.RunnableQueue.invokeLater(RunnableQueue.java:277)
at org.apache.batik.swing.svg.AbstractJSVGComponent.updateRenderingTransform(AbstractJSVGComponent.java:1057)
at org.apache.batik.swing.gvt.AbstractJGVTComponent$1.componentResized(AbstractJGVTComponent.java:237)
at java.awt.AWTEventMulticaster.componentResized(Unknown Source)
at java.awt.Component.processComponentEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Thanks in advance, I have searched everywhere and tried a lot, but could not find a solution.
Edit:
This is the invokeLater-Method of Batik where the Exception is actually thrown:
public void invokeLater(Runnable r) {
if (runnableQueueThread == null) {
throw new IllegalStateException
("RunnableQueue not started or has exited");
}
synchronized (list) {
list.push(new Link(r));
list.notify();
}
}
runnableQueueThrad is set inside that class' run()-Method and set to null at the end.
So I guess I have to do some kind of synchronization.
Hazard a guess, the "public void run()" code should not be inside another method and really is a thread class/interface objects so called constructor(interface version actually).
Remove it to its own class(e.g. nested subclass to preserve scope) and implement the "thread runnable" interface on the class to place the "run()" method in it to use.
Stack trace says the run method is not available because it does not actually have such a method(or at least not properly declared) so it is in an "illegal state".