如何用JAVA调整系统的分辨率?(在线等待。。。) 要是调整系统的分辨率的化,只有调用windows的api了,好像没有其它方法 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 例子:import java.applet.Applet;import java.awt.*;public class ScreenRes extends Applet { int height; int width; public ScreenRes() { } public void init() { setBackground(Color.white); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); height = dimension.height; System.out.println("height---" + height); width = dimension.width; System.out.println("width---" + width); } public void paint(Graphics g) { String s = "Resolution: " + width + " x " + height; Font font = new Font("Helvetica", 0, 12); g.setFont(font); g.drawString(s, 0, 15); } public static void main(String[] args) { Frame a = new Frame(); ScreenRes aa = new ScreenRes(); aa.init(); a.add(aa); a.setSize(200, 200); a.setVisible(true); }} 我说的是调整分辨率,不显示分辨率。JAVA类库中提供了类似的方法不过我没使用成功。 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); //System.out.println("GraphicsDevice number:"+gs.length); DisplayMode ds = gs[0].getDisplayMode(); //System.out.println("bit depth:"+ds.getBitDepth()); //System.out.println("heigth:"+ds.getHeight()); //System.out.println("weight:"+ds.getWidth()); gs[0].setDisplayMode(new DisplayMode(800,600,16,85));//此处设显示模式为:分辨率800X600,色深16位,刷新率85。运行到这里有UnsupportOperationException. 怪!第三行和最后行 m_id = 0 ,为什么不是1和4? maven 把多个jar放在一个目录下 如何只输出小数有效数字 刚学For循环语句,出现小问题,请指教.谢谢... java excel 导出 socket文件互传问题 急.在线等!! 各位高手看看.超难的问题 想学java,请推荐几本好书和下载地址 有点急,向各位大虾请教两个jbuilder8开发中的小问题。 看看谁能解决这个问题? 关于sax读取XML文件的内容? [求助]Java程序UI显示有问题
import java.awt.*;public class ScreenRes
extends Applet { int height;
int width; public ScreenRes() {
} public void init() {
setBackground(Color.white);
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
height = dimension.height;
System.out.println("height---" + height);
width = dimension.width;
System.out.println("width---" + width);
} public void paint(Graphics g) {
String s = "Resolution: " + width + " x " + height;
Font font = new Font("Helvetica", 0, 12);
g.setFont(font);
g.drawString(s, 0, 15);
} public static void main(String[] args) {
Frame a = new Frame();
ScreenRes aa = new ScreenRes();
aa.init();
a.add(aa);
a.setSize(200, 200);
a.setVisible(true);
}
}
JAVA类库中提供了类似的方法不过我没使用成功。
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
//System.out.println("GraphicsDevice number:"+gs.length);
DisplayMode ds = gs[0].getDisplayMode();
//System.out.println("bit depth:"+ds.getBitDepth());
//System.out.println("heigth:"+ds.getHeight());
//System.out.println("weight:"+ds.getWidth());
gs[0].setDisplayMode(new DisplayMode(800,600,16,85));//此处设显示模式为:分辨率800X600,色深16位,刷新率85。运行到这里有UnsupportOperationException.