이중 화면 모드에서 응용 프로그램을 실행해야합니다. 두 화면 모두에서 독립적 인 창으로 실행하지만 동일한 애플리케이션 모델을 공유하려면 어떻게해야합니까?이중 화면 응용 프로그램
4
A
답변
8
내가 잘못 아니에요 경우이 예를 들어, 당신이 도움이 될 수 있습니다. 첫 번째 위치는 각 화면의 프레임입니다.
frame1.setLocation(pointOnFirstScreen);
frame2.setLocation(pointOnSecondScreen);
은 극대화 :
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
작업 예 :
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
public class GuiApp1 {
protected void twoscreen() {
Point p1 = null;
Point p2 = null;
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
if (p1 == null) {
p1 = gd.getDefaultConfiguration().getBounds().getLocation();
} else if (p2 == null) {
p2 = gd.getDefaultConfiguration().getBounds().getLocation();
}
}
if (p2 == null) {
p2 = p1;
}
createFrameAtLocation(p1);
createFrameAtLocation(p2);
}
private void createFrameAtLocation(Point p) {
final JFrame frame = new JFrame();
frame.setTitle("Test frame on two screens");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel(new BorderLayout());
final JTextArea textareaA = new JTextArea(24, 80);
textareaA.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));
panel.add(textareaA, BorderLayout.CENTER);
frame.setLocation(p);
frame.add(panel);
frame.pack();
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new GuiApp1().twoscreen();
}
});
}
}
2
GraphicsDevice API를 살펴볼 필요가 있습니다. 좋은 예가 있습니다. 오라클에서 공급
: 멀티 스크린 환경에서
는, GraphicsConfiguration 오브젝트는 여러 화면에 구성 요소를 렌더링하는 데 사용할 수 있습니다. 다음 코드 샘플은 GraphicsEnvironment의 각 스크린 디바이스 GraphicsConfiguration마다 JFrame 객체를 생성하는 방법을 보여줍니다
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
for (int j = 0; j < gs.length; j++) {
GraphicsDevice gd = gs[j];
GraphicsConfiguration[] gc =
gd.getConfigurations();
for (int i=0; i < gc.length; i++) {
JFrame f = new
JFrame(gs[j].getDefaultConfiguration());
Canvas c = new Canvas(gc[i]);
Rectangle gcBounds = gc[i].getBounds();
int xoffs = gcBounds.x;
int yoffs = gcBounds.y;
f.getContentPane().add(c);
f.setLocation((i*50)+xoffs, (i*60)+yoffs);
f.show();
}
}
관련 문제
- 1. 응용 프로그램 화면 인쇄
- 2. 안드로이드 응용 프로그램 로딩 화면
- 3. Qt에서 응용 프로그램 화면 나누기
- 4. 안드로이드 응용 프로그램 전체 화면
- 5. 바탕 화면 기반 응용 프로그램
- 6. 분할 화면 응용 프로그램 iPad
- 7. 파이썬, 플라스크 및 이중 언어를 응용 프로그램
- 8. 응용 프로그램 목록에 이중 아이콘이 있음
- 9. Silverlight 응용 프로그램 Exit에서 이중 메시지 보내기
- 10. DirectDraw 전체 화면 응용 프로그램 위에 다른 응용 프로그램 표시
- 11. WPF는 화면 해상도로 응용 프로그램 창을 자릅니다.
- 12. 다른 해상도의 전체 화면 스윙 응용 프로그램
- 13. 화면 캡처 C# ASP.NET 웹 응용 프로그램
- 14. 공기 응용 프로그램 전체 화면 문제
- 15. 복수 화면 용 응용 프로그램 만들기
- 16. 응용 프로그램 점프 잠금 화면 실행
- 17. Javascript 또는 Jquery의 화면 캡처 응용 프로그램
- 18. Linux - Java 응용 프로그램 시작 화면
- 19. 고밀도 대형 화면 에뮬레이터에서 응용 프로그램 테스트
- 20. 코로나 응용 프로그램 개발을위한 고급 화면 해상도
- 21. 응용 프로그램 화면 캡처 및 렌더링
- 22. 간단한 C# 화면 공유 응용 프로그램
- 23. 방법 : 다중 화면/영역 Silverlight 응용 프로그램?
- 24. MVC4 단일 페이지 응용 프로그램 - 여러 화면
- 25. Menubar 응용 프로그램 : 바탕 화면 전환 버그
- 26. iPhone 응용 프로그램 화면 색조가 희미합니다.
- 27. 전체 화면 응용 프로그램 WM6 C#
- 28. 응용 프로그램 뒤에 자바 화면 캡쳐
- 29. 안드로이드에서 다중 화면 지원 응용 프로그램
- 30. Mac OSX 전체 화면 응용 프로그램 문제
+1을 제공하는 정보에. 그러나 당신의 답을 혼란스럽게하는 것은,'MSDN '이'Java'에 대한 도움말을 제공하기 시작한 이래로, 당신의 대답에 ** MSDN의 정보원으로 ** 표시 되었기 때문입니다. –