DebugGraphics class of java
Hello Guys,
I need your help to know about the DebugGraphics class of java. There are some inbuilt classes of java which are very complicated and rarely used. I think DebugGraphics class id one them. I am not able to understand the exact use of DebugGraphics class of java. If anyone have sound knowledge about the this DebugGraphics class of java, then please let know it. I would really appreciate your any help over DebugGraphics class.
Re: DebugGraphics class of java
Hi friend,
A DebugGraphics class of java is taken from the 'java.awt.Graphics' package. This java class extends 'Graphics' interface of java. A 'java.awt.Graphics' package of java is also the sub-package of 'java.lang.Object'. A DebugGraphics class support various fields such as NONE_OPTION , BUFFERED_OPTION, LOG_OPTION, FLASH_OPTION. There are total three constructors of this java inbuilt class.
Re: DebugGraphics class of java
Please go through the following example of DebugGraphics class of java:
Code:
import javax.swing.DebugGraphics;
public class DebugGraphicsDM {
public static void main(String[] am) {
JFrame frame1 = new JFrame();
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton bn1 = new JButton();
RepaintManager repaintManager = RepaintManager.currentManager(bn);
repaintManager.setDoubleBufferingEnabled(false);
bn.setDebugGraphicsOptions(DebugGraphics.BUFFERED_OPTION | DebugGraphics.FLASH_OPTION
| DebugGraphics.LOG_OPTION);
frame1.add(bn1);
frame1.setSize(400, 300);
frame1.setVisible(true);
frame1.add(bn);
}
}
Re: DebugGraphics class of java
Hi friend,
Please review following some methods of DebugGraphics class:
- setXORMode(Color aClr)
- setLogStream(PrintStream strm)
- setFlashTime(int flashTm)
- setFlashCount(int flashCnt)
- setFlashColor(Color flashClr)
Re: DebugGraphics class of java
Hi,
I suggest you to study following example of 'DebugGraphics class'. I which I have used 'BUFFERED_OPTION' property of DebugGraphics class:
Code:
import javax.swing.DebugGraphics;
import javax.swing.RepaintManager;
public class GPHMain
{
public static void main(String[] aln) {
JFrame FN = new JFrame();
FN.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton CJ = new JButton();
RepaintManager XN = RepaintManager.currentManager(CJ);
XN.setDoubleBufferingEnabled(false);
CJ.setDebugGraphicsOptions(DebugGraphics.BUFFERED_OPTION | DebugGraphics.FLASH_OPTION
| DebugGraphics.LOG_OPTION);
FN.add(CJ);
FN.setSize(300, 300);
FN.setVisible(true);
FN.add(CJ);
}
}
Re: DebugGraphics class of java
Conductors of DebugGraphics class of java:
- DebugGraphics(Graphics grphs, JComponent cmpnt)
- DebugGraphics(Graphics grphcs)
- DebugGraphics()
- draw3DRect(int x1, int y1, int width, int height, boolean bl)
- create(int x1, int y1, int width, int height)