> Java > tools > debug
> Java > tools > debug
by ZweiBieren Package com.physpics.tools.debug Java coffee cup logo

These debugging tools reveal the sorts of difficulties I have had using Javax/Swing:

  • performance
  • component trees, especially their screen sizes
  • HTML document trees
  • event processing
src Jdoc class note
Java steaming cup doc with "J" DebugTools.java Provides tools for logging mouse events, printing the call stack, and showing the size data for AWT components.
Java steaming cup doc with "J" ElapsedTime.java Create and print strings for time elapsed from a given starting point.
Java steaming cup doc with "J" Image2Hex.java Convert some or all of an image to hex for inspection.
Java steaming cup doc with "J" ObjectName.java Produce a printable String describing an object. Ranges from just a name for simple objects to a tree for a complex object.

DebugTools has a main method that illustrates many of the tools in this package. It displays a simple window with one button:

window with a button labeled "Button"

The printed output is a log with outputs generated by most of the tools as revealed here by colorcoding:

from ObjectName   from ElapsedTime   from DebugTools.MouseLoggingAdapter

subject tree:   javax.swing.JPanel-0 (0x0)
subject tree:      javax.swing.JButton-"Button" (0x0)
0.231  seconds since start of application, before pack
*  javax.swing.JFrame:frame0 (140x91) (97,91,IMax)x(75,91,IMax)   nat pref (97, 75)
*      javax.swing.JRootPane-1 (124x52) (81,81,0)x(36,36,SMax)
*          javax.swing.JPanel:null.glassPane (124x52) (10,10,SMax)x(10,10,SMax)
*          javax.swing.JLayeredPane:null.layeredPane (124x52) (1,1,SMax)x(1,1,SMax)
*              javax.swing.JPanel-0 (124x52) (81,81,SMax)x(36,36,SMax)
*                  javax.swing.JButton-"Button" (71x26) (71,71,71)x(26,26,26)
0.282  seconds since start of application, before setVisibile
0.287  seconds since start of application, after setVisibile
    log MOUSE_MOVED<107,51>@javax.swing.JPanel-0 (124x52)
9.922  KEY_PRESSED@Button:S
    log MOUSE_MOVED<113,50>@javax.swing.JPanel-0 (124x52)
    log MOUSE_ENTERED<55,24>@Button
    log MOUSE_PRESSED<49,8>@Button
    log MOUSE_RELEASED<49,8>@Button
    log MOUSE_CLICKED<49,8>@Button
    log MOUSE_EXITED<48,26>@Button
    log MOUSE_MOVED<74,31>@javax.swing.JPanel-0 (124x52)
Copyright © 2020 ZweiBieren, All rights reserved. Feb 29, 2020 19:32 GMT Page maintained by ZweiBieren