我需要在Java中的文本文件中捕获异常.例如:
try {
File f = new File("");
}
catch(FileNotFoundException f) {
f.printStackTrace(); // instead of printing into console it should write into a text file
writePrintStackTrace(f.getMessage()); // this is my own method where I store f.getMessage() into a text file.
}
Run Code Online (Sandbox Code Playgroud)
使用getMessage()作品,但它只显示错误消息.我想要printStackTrace()包含行号的所有信息.
int width = 175;
Graphics2D gb = (Graphics2D) g;
bufferedimage = (BufferedImage) createImage(width, width);
Graphics2D graphics = bufferedimage.createGraphics();
graphics.setColor(/*this.getBackground()*/Color.red);
graphics.fillRect(0, 0, width, width);
Run Code Online (Sandbox Code Playgroud)
嗨,我有缓冲大尺寸...我必须调整缓冲图像... PLZ你能帮助我吗?
我对Jcombobox有疑问...例如,我有一个gui,其中包含一个jcombo框和一个按钮......在Jcombo框中,我添加了字符串数组对象,如颜色1,颜色2,颜色3:字符串[] colors = {"Color 1","Color 2","Color 3"}.我可以通过使用colorchooser点击按钮时选择颜色,它只会应用到按钮....但我想设置前景颜色到了"颜色1","颜色2"在tat组合框中...例如:如果我选择颜色为红色通过按钮,它应该应用于jcombobox上的前景颜色仅"SELECTED ITEM"(示例颜色1应显示为RED,其他应该是默认颜色!
...我是Java新手......如果有人知道,请帮助我..谢谢
可能重复:
如何在Java中绘制一个像样的圆圈.
嗨,我使用graphics2d在java中用中风绘制onw圈...但是我总是得到不规则的圆圈...我没有顺利得到圆圈...你能帮助我吗?
我有数组值
String[] value = {"1","2","3", "4","5","6","7","8","9","10"};
假设如果我将值“5”传递给 tat 数组,它应该像这样排序
{"5","6","7","8","9","10",1","2","3","4"};...
Run Code Online (Sandbox Code Playgroud)
怎么办?请问有人帮忙吗?感谢你
嗨,我正在努力从字节数组中检索最后32位/ 4字节.请有人帮帮我.
例:
byte[] b = scientificDatas;//1024bits
Run Code Online (Sandbox Code Playgroud)
我想从'b'中检索最后32位.我试过班次操作员.它不能正常工作.请有人帮帮我.