现在我程序中就是禁用了最小化按钮可是还是切换到别的程序中时候还是自动最小化了
package imm;import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;import comm.FileUtil;
public class ShowImage {
static testPanel test = null;
static String imageName=null;
String urlALL=null;
/**
* @param args
*/
public static void main(String[] args) {
test = new testPanel(); Thread tt = new Thread(new Runnable() {
int i = 1; @Override
public void run() {
File file = new File("config/SENDCOM6.ini");
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace(); }
if (file.exists()) {
try {
FileReader in = new FileReader(file);
char byt[] = new char[256];
int len = in.read(byt);
if (len != -1) {
imageName = new String(byt, 0, len);// 得到系统发送的数据 in.close();
FileUtil.rewrite(file, "", false);// 清空数据
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(imageName!=null)
test.setPanelImageURL("d:/" + imageName + ".jpg");
imageName=null; } }
});
tt.start();
}
}package imm;import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;public class testPanel { private JDialog f = new JDialog();
private Box horizontal = Box.createHorizontalBox(); public void setPanelImage(Image image) {
horizontal.removeAll();
JTestPanel panel = new JTestPanel(image);
horizontal.add(panel);
f.add(horizontal);
f.setVisible(true);
} public void setPanelImageURL(String URL) {
ImageIcon iimageIcon = new ImageIcon(URL);
Image image = iimageIcon.getImage();
this.horizontal.removeAll();
JTestPanel panel = new JTestPanel(image); this.horizontal.add(panel);
this.f.add(this.horizontal);
this.f.setVisible(true);
} /**
* Create the application.
*/
public testPanel() {
init();
} /**
* 指定显示位置
*
* @param screen
* @param frame
*/
public static void showOnScreen(int screen, JFrame frame) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
if (screen > -1 && screen < gs.length) {
gs[screen].setFullScreenWindow(frame);
} else if (gs.length > 0) {
gs[0].setFullScreenWindow(frame);
} else {
throw new RuntimeException("No Screens Found");
}
} /**
* 指定显示位置(弹出窗口的指示)
*
* @param screen
* @param frame
*/
public static void showOnScreen(int screen, JDialog dialog) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
if (screen > -1 && screen < gs.length) {
gs[screen].setFullScreenWindow(dialog);
} else if (gs.length > 0) {
gs[0].setFullScreenWindow(dialog);
} else {
throw new RuntimeException("No Screens Found");
}
} public void init() { showOnScreen(2, f); f.setVisible(true); }}
package imm;import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;import comm.FileUtil;
public class ShowImage {
static testPanel test = null;
static String imageName=null;
String urlALL=null;
/**
* @param args
*/
public static void main(String[] args) {
test = new testPanel(); Thread tt = new Thread(new Runnable() {
int i = 1; @Override
public void run() {
File file = new File("config/SENDCOM6.ini");
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace(); }
if (file.exists()) {
try {
FileReader in = new FileReader(file);
char byt[] = new char[256];
int len = in.read(byt);
if (len != -1) {
imageName = new String(byt, 0, len);// 得到系统发送的数据 in.close();
FileUtil.rewrite(file, "", false);// 清空数据
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(imageName!=null)
test.setPanelImageURL("d:/" + imageName + ".jpg");
imageName=null; } }
});
tt.start();
}
}package imm;import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;public class testPanel { private JDialog f = new JDialog();
private Box horizontal = Box.createHorizontalBox(); public void setPanelImage(Image image) {
horizontal.removeAll();
JTestPanel panel = new JTestPanel(image);
horizontal.add(panel);
f.add(horizontal);
f.setVisible(true);
} public void setPanelImageURL(String URL) {
ImageIcon iimageIcon = new ImageIcon(URL);
Image image = iimageIcon.getImage();
this.horizontal.removeAll();
JTestPanel panel = new JTestPanel(image); this.horizontal.add(panel);
this.f.add(this.horizontal);
this.f.setVisible(true);
} /**
* Create the application.
*/
public testPanel() {
init();
} /**
* 指定显示位置
*
* @param screen
* @param frame
*/
public static void showOnScreen(int screen, JFrame frame) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
if (screen > -1 && screen < gs.length) {
gs[screen].setFullScreenWindow(frame);
} else if (gs.length > 0) {
gs[0].setFullScreenWindow(frame);
} else {
throw new RuntimeException("No Screens Found");
}
} /**
* 指定显示位置(弹出窗口的指示)
*
* @param screen
* @param frame
*/
public static void showOnScreen(int screen, JDialog dialog) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
if (screen > -1 && screen < gs.length) {
gs[screen].setFullScreenWindow(dialog);
} else if (gs.length > 0) {
gs[0].setFullScreenWindow(dialog);
} else {
throw new RuntimeException("No Screens Found");
}
} public void init() { showOnScreen(2, f); f.setVisible(true); }}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货