I try to test my application with FEST. Like in most other applications I have a System.exit() command in there. When I do nothing and run all tests, the test run is aborted when the System.exit() method is called for the first time.
I searched and found something here. It seemed to be what I was looking for, but it leads to an unexpected behavior. When I call System.exit() I get an infinite loop in System.exit() which every time throws the org.fest.swing.security.ExitException. If I catch the exception the application is not closed and the test never ends.
Does anyone have already used FEST like this?
For additional information here the complete stacktrace:
Exception in thread "AWT-EventQueue-0" org.fest.swing.security.ExitException: Application tried to terminate current JVM with status 0
at org.fest.swing.security.NoExitSecurityManager.checkExit(NoExitSecurityManager.java:84)
at java.lang.Runtime.exit(Unknown Source)
at java.lang.System.exit(Unknown Source)
at org.luciferius.banking.swingUi.internal.SwingUiBuilder$1.windowClosed(SwingUiBuilder.java:81)
at java.awt.AWTEventMulticaster.windowClosed(Unknown Source)
at java.awt.Window.processWindowEvent(Unknown Source)
at javax.swing.JFrame.processWindowEvent(Unknown Source)
at java.awt.Window.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(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)
Regards, Yggdrasil
Yes, the NoExitSecurityManager can be used to prevent tests being interrupted because the application under test calls System.exit.
The ExitException is thrown in such case and its stack trace is written to console, but unless you catch the exception, it does not prevent the test from continuing and succeeding because it runs on a different thread.
The catch might be in an uncaught exception handler. If you have something like Thread.setDefaultUncaughtExceptionHandler(...) in your code, you will get the infinite loop. Such exception handler needs to be disabled during the tests.
Related
Hi,
I'm trying to execute a jar file, overwriting some java originals interfaces to connect with the database, changing the method setBoolean to receive an object like parameter.
That's the original interface method:
void setBoolean(int parameterIndex, boolean x) throws SQLException;
That's my change:
void setBoolean(int parameterIndex, Boolean x) throws SQLException;
My changes were made at interface java.sql.PreparedStatement. For my changes to be called, when I start the application I'm using the command:
java -verbose:class -Xbootclasspath/p:C:/Users/user/Desktop/myproject/src/main/java -jar safepdv.jar
With the command "-verbose:class" I can verify that the class with my changes are being loaded.
However, when the method setBoolean is called by the application, he isn't founded, and my return is:
Exception in thread "AWT-EventQueue-0" [Loaded java.lang.Throwable$WrappedPrintStream from C:\Program Files\Java\jre1.8.0_91\lib\rt.jar]
java.lang.NoSuchMethodError: java.sql.PreparedStatement.setBoolean(IZ)V
at com.t2tierp.pafecf.controller.ConfigurationController.updateCS(ConfigurationController.java:613)
at com.t2tierp.pafecf.view.OpenMoviment.validaCamposLogin(OpenMoviment.java:448)
at com.t2tierp.pafecf.view.OpenMoviment.passwordTextSenhaUsuarioActionPerformed(OpenMoviment.java:403)
at com.t2tierp.pafecf.view.OpenMoviment.access$200(OpenMoviment.java:22)
at com.t2tierp.pafecf.view.OpenMoviment$4.actionPerformed(OpenMoviment.java:240)
at javax.swing.JTextField.fireActionPerformed(Unknown Source)
at javax.swing.JTextField.postActionEvent(Unknown Source)
at javax.swing.JTextField$NotifyAction.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(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.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(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.pumpEventsForFilter(Unknown Source)
at java.awt.WaitDispatchSupport$2.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(Unknown Source)
at java.awt.Dialog.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at java.awt.Dialog.setVisible(Unknown Source)
at com.t2tierp.pafecf.view.Caixa.verificarMovimentoExistente(Caixa.java:3392)
at com.t2tierp.pafecf.view.Caixa.<init>(Caixa.java:344)
at com.t2tierp.pafecf.view.Caixa$41.run(Caixa.java:2393)
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$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)
How can I make my method was really called instead of the original method?
The calling code is still trying to pass a null value to the old method's signature (which expects a boolean, and not a Boolean). You would need to recompile the calling code so that it binds to the new method signature: the method signatures to be called are fixed at compile-time.
Also, note that PreparedStatement is an interface - changing its definition is likely to break all classes implementing said interface. Most notably, each JDBC driver will include its own implementation; you would have to recompile the drivers from source to fix this.
It is possible, but ugly and unmaintainable, to decompile the calling code and simply fix it at the point where the null is being passed, and then recompile it. You can automate this to a certain point (think bytecode-editing libraries), but the gist is that not having access to the source code making the bad calls is a severe drawback.
This question already has an answer here:
Frame Buffer not Supported By this hardware. Java Processing library 2.2.1 and Unfolding Map Error
(1 answer)
Closed 6 years ago.
I have been getting the following error while executing sample code of EarthquakeCityMap.java. If you need java file then I can share.
Exception in thread "AWT-EventQueue-1" javax.media.opengl.GLException: Caught RuntimeException: Framebuffer objects are not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help. on thread AWT-EventQueue-1
at javax.media.opengl.GLException.newGLException(GLException.java:75)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1311)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1131)
at javax.media.opengl.awt.GLCanvas$11.run(GLCanvas.java:1394)
at javax.media.opengl.Threading.invoke(Threading.java:223)
at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:525)
at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:579)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.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.RuntimeException: Framebuffer objects are not supported by this hardware (or driver) Read http://wiki.processing.org/w/OpenGL_Issues for help.
at processing.opengl.PJOGL$PGLListener.init(PJOGL.java:890)
at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:640)
at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:662)
at javax.media.opengl.awt.GLCanvas$9.run(GLCanvas.java:1366)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1275)
... 28 more
Exception in thread "Animation Thread" java.lang.RuntimeException: Number of texture units not supported by this hardware (or driver)
at processing.opengl.PGL.bindTexture(PGL.java:2646)
at processing.opengl.PGL.createFBOLayer(PGL.java:660)
at processing.opengl.PGL.beginDraw(PGL.java:530)
at processing.opengl.PJOGL.beginDraw(PJOGL.java:617)
at processing.opengl.PGraphicsOpenGL.beginOnscreenDraw(PGraphicsOpenGL.java:6350)
at processing.opengl.PGraphicsOpenGL.beginDraw(PGraphicsOpenGL.java:1696)
at processing.core.PApplet.handleDraw(PApplet.java:2342)
at processing.opengl.PJOGL$PGLListener.display(PJOGL.java:873)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:690)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:672)
at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1383)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1277)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1131)
at javax.media.opengl.awt.GLCanvas$11.run(GLCanvas.java:1394)
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$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)
Anyone who came across the similar can help me please.
Thanks,
Girish S.
Framebuffer objects are not supported by this hardware (or driver)
You most likely do not have a proper driver installed for your graphics card, or OpenGL is not supported on your card (which is very unlikely, but still possible).
I have created a java application to connect to a MySQL database.
Once through the program install creator I created an .exe .
This executable runs, and the first form is login. When he tries to access the database to confirm the details of login gives this error.
java.lang.NullPointerException
Someone can help me solve this? The path is correct, because if run the .jar the application runs normally.
I apologize for the inconvenience.
Only have this to try explain better my question :S
I'm so sorry... I'm running a executable version from my java aplication.
java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at sensores.forms.jTMainMenu.initComponents(jTMainMenu.java:786)
at sensores.forms.jTMainMenu.<init>(jTMainMenu.java:57)
at sensores.forms.jTLoginConsulta.jBLoginActionPerformed(jTLoginConsulta.java:351)
at sensores.forms.jTLoginConsulta.access$000(jTLoginConsulta.java:59)
at sensores.forms.jTLoginConsulta$1.actionPerformed(jTLoginConsulta.java:110)
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)
You have an error in this class/line
jTMainMenu.java:786
Seems you tried to load a image in this point of your code, i don't know how you are generating a executable from your java code but this may be the source of the problem. Try to put this image outside of your executable/jar and use a relative path to load the image, like './my_image'.
You also have to take care if your user make a link to your executable, in this case a relative path can't resolve your problem. A simple way to solve this in java is get the source code location.
getClass().getProtectionDomain().getCodeSource().getLocation();
And use this location to find your image.
Please check the line number from the Stacktrace where you are getting the NullPointerException.
it is straight forward to find out the null pointer exception. Object is null or not initialize on which you are calling the method
try{
// add database connection statement here
}catch(Exception e){
e.printstacktrace();
}
// run the program from the command prompt.
// you can print the e.printstacktrace() on the popup as well to get the exception details
If you make a .jar, move that jar somewhere separate from the IDE (i.e. their classpaths), and start the jar, do you receive a NullPointerException?
This can be caused by resources, getResource, getResourceAsStreem, getBundle, as they are not case-sensitive in the Windows file system, but are case sensitive in a jar(and under Linux/MacOS).
(Also File cannot be used for jar resources.)
You might look in the jar with 7zip or so to inspect all paths.
I think it is not getting image icon in defined path
at javax.swing.ImageIcon.<init>(Unknown Source)
I have the following two guesses:
There is a problem with your path or classpath and loading the resource
The lines
at sensores.forms.jTMainMenu.initComponents(jTMainMenu.java:786)
at sensores.forms.jTMainMenu.(jTMainMenu.java:57)
indicate that something is initialized. Usually Swing/AWT uses multiple threads, so you might have a race condition here: The reference to the resource is handed to ImageIcon in your ìnitComponents method before another thread could set the value to something non-null. Try using proper synchronization/locking.
We've been struggling here at the office with a seemingly unsolvable bug in one of our (massive) applets, this one being a Java simulation of MS Word, for exam purposes. The exception seems to stem from swing itself, and I'm not sure how I would go about solving it. Here's what happens:
The applet loads with a loading screen till 100%. After this, the components are all displayed in a broken way as if some of their paint methods are not being called correctly, hovering the cursor over some buttons etc. does make them flash/display for a while. And an exception is printed to the console every second or so. (See below) This bug does NOT occur within Eclipse, only in the browser.
Summary: Applet components all get built without exceptions, but on every "paint" call of a some component (I assume), it visually bugs out and the following is printed every second:
Exception in thread "AWT-EventQueue-11" java.lang.ClassCastException: javax.swing.JLabel cannot be cast to javax.swing.text.JTextComponent
at javax.swing.text.html.EditableView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.ParagraphView.paint(Unknown Source)
at javax.swing.text.html.ParagraphView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.plaf.basic.BasicHTML$Renderer.paint(Unknown Source)
at javax.swing.plaf.basic.BasicLabelUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager$3.run(Unknown Source)
at javax.swing.RepaintManager$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$1000(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
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)
Help would be greatly appreciated, as this is driving me nuts, I can't seem to find what triggers this, as the code is from a previous developer, and an utter mess. I have tried different JDK versions.
Thanx.
java.lang.ClassCastException: javax.swing.JLabel cannot be cast to
javax.swing.text.JTextComponent
see components tree for JTextComponents, there isn't JLabel, JLabel isn't member of JTextComponents
safest could be to test if (Xxx instanceof JTextComponent) before any casting
Found a fix to my problem. The target Java version was wrong. In the build.xml file, there were the following lines:
<property name="target" value="1.5" />
<property name="source" value="1.5" />
Changed those to 1.7, and voila! This seems to have been a Swing bug that has been fixed in the newer versions of Java.
I've noticed that this problem can occur when a JLabel with tags around the content contains nested tags. The solution is to escape the angle brackets on the
I have a peculiar situation here in an application I've programmed using a Substance LookAndFeel. In my application, as seen in the screenshot below, I have three JMenus in the MenuBar.
The one all the way on the right (Take Screenshot) is click-able and takes a screenshot of the entire application window. It has no MenuItems beneath it and works as a standalone faux "button".
Upon being clicked, it works perfectly fine. But in the console I get a HUGE block of errors related to what I'm assuming is the current L&F I'm using (seeing as this didn't happen with the System Default L&F).
Another question I would like to have answered is how to fix the opaque part of the menu's shadow, also as seen in the screenshot provided. None of this affects execution of the application in any way, I would just like them both resolved to ensure execution is optimal.
If any of my code needs to be posted to help resolve the issue, please recommend where you think thr issue is originating from (i.e. the Robot, or the L&F, or the MenuBar, or whatever). I will post whatever is needed.
edit: I have done some more exploration and it seems to occur only when any of the Menus are selected, then I hover over to the Screenshot menu. My guess is simply because it has no MenuItems to be displayed, but I could be wrong. I still haven't a clue on how to resolve the issue, though.
Here's the error log:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Recta
ngle width and height must be > 0
at java.awt.Robot.checkValidRect(Unknown Source)
at java.awt.Robot.createScreenCapture(Unknown Source)
at org.pushingpixels.substance.internal.contrib.jgoodies.looks.common.Sh
adowPopup.snapshot(ShadowPopup.java:286)
at org.pushingpixels.substance.internal.contrib.jgoodies.looks.common.Sh
adowPopup.show(ShadowPopup.java:198)
at javax.swing.JPopupMenu.getPopup(Unknown Source)
at javax.swing.JPopupMenu.setVisible(Unknown Source)
at javax.swing.JPopupMenu.show(Unknown Source)
at javax.swing.JMenu.setPopupMenuVisible(Unknown Source)
at javax.swing.JPopupMenu.menuSelectionChanged(Unknown Source)
at javax.swing.MenuSelectionManager.setSelectedPath(Unknown Source)
at javax.swing.plaf.basic.BasicMenuUI.appendPath(Unknown Source)
at javax.swing.plaf.basic.BasicMenuUI.access$200(Unknown Source)
at javax.swing.plaf.basic.BasicMenuUI$Handler.mousePressed(Unknown Sourc
e)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(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$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$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)
This is a bug in Substance that is based on older code in JGoodies. Kirill took an older snapshot of ShadowPopup that didn't have code to check for things like zero width or height. Current versions of ShadowPopup look for that error and handle it properly.
Substance itself is no longer maintained by Kirill, but I do have a maintenence fork. Could you post this as an issue there?