java - Different JFrames on different displays -
i have central database, connect jdbc , after preparations data, produce 6 different jframes, , display each on different display (monitor) on different walls of building, can reach on ip (by wifi) @ same time. can solve graphicsenvironment somehow?
i greatful advice!
if each screen can seen os seperate graphics device, should able use like...
import java.awt.eventqueue; import java.awt.graphicsconfiguration; import java.awt.graphicsdevice; import java.awt.graphicsenvironment; import java.awt.rectangle; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.uimanager; import javax.swing.unsupportedlookandfeelexception; public class testgc { public static void main(string[] args) { eventqueue.invokelater(new runnable() { @override public void run() { try { uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); } catch (classnotfoundexception | instantiationexception | illegalaccessexception | unsupportedlookandfeelexception ex) { } graphicsdevice[] sds = graphicsenvironment.getlocalgraphicsenvironment().getscreendevices(); (graphicsdevice sd : sds) { system.out.println(sd.getidstring()); graphicsconfiguration gc = sd.getdefaultconfiguration(); jframe f = new jframe(gc); f.add(new jlabel(sd.getidstring())); f.setdefaultcloseoperation(jframe.exit_on_close); f.pack(); centeron(f, gc); f.setvisible(true); } } }); } private static void centeron(jframe f, graphicsconfiguration gc) { rectangle bounds = gc.getbounds(); int x = bounds.x + ((bounds.width - f.getwidth()) / 2); int y = bounds.y + ((bounds.height - f.getheight()) / 2); f.setlocation(x, y); } }
Comments
Post a Comment