2012-07-12 4 views
0

JDesktopPane은 내부에있는 JInternalFrames이 최대화되어 파란색 배경을 완전히 차단할 수 있어야합니다 (최소한 Mac에서는 파란색). JDesktopPane 이 데모를 실행하면 JInternalFrame을 최대화하면 전체 JDesktopPane을 차지하지 않는다는 것을 알 수 있습니다. JInternalFrame이 전체 JDesktopPane을 차지하도록 JDesktopPane을 어떻게 설정할 수 있습니까?JDesktopPane 경계 - JInternalFrame이 데스크탑 전체를 채우지 못함

이 이미지에서는 아래 코드를 실행하고 JInternalFrame의 최대화 버튼을 눌렀지만 아직 JDesktopPane에 "파란색"이 표시되어 있습니다.

enter image description here

import java.awt.BorderLayout; 
import javax.swing.JDesktopPane; 
import javax.swing.JFrame; 
import javax.swing.JInternalFrame; 
import javax.swing.JTextArea; 

/** 
* 
* @author Robert 
*/ 
public class Temp { 

    Temp() { 
     boolean resizable = true; 
boolean closeable = true; 
boolean maximizable = true; 
boolean iconifiable = true; 
String title = "Frame Title"; 
JInternalFrame iframe = new JInternalFrame(title, resizable, closeable, maximizable, iconifiable); 

// Set an initial size 
int width = 200; 
int height = 50; 
iframe.setSize(width, height); 

// By default, internal frames are not visible; make it visible 
iframe.setVisible(true); 

// Add components to internal frame... 
iframe.getContentPane().add(new JTextArea()); 

// Add internal frame to desktop 
JDesktopPane desktop = new JDesktopPane(); 
desktop.add(iframe); 

// Display the desktop in a top-level frame 
JFrame frame = new JFrame(); 
frame.getContentPane().add(desktop, BorderLayout.CENTER); 
frame.setSize(300, 300); 
frame.setVisible(true); 
    } 
    public static void main (String[] args) { 
     new Temp(); 
    } 
} 
+0

도움이 될 수도 있지만, 당신은 당신의 타고 싶어 의미합니까 틀?? 스크린 샷을 게시 할 수 있습니까? – MadProgrammer

+0

grr, 이미지를 업로드하려고했지만 작동하지 않습니다. 기본적으로 JDesktop 내부의 JInternalFrame을 최대화하면 볼 수있는 파란색이 여전히 남아 있습니다 (데스크톱을 계속 볼 수 있음). JInternalFrame은 실제로 JDesktop 전체를 채우지 않습니다. 나는 그것이 전체 JDesktop을 채우도록하려고 노력하고있다. – CodeGuy

+0

아, 그래서 "프레임"이 제거되도록 그것을 원한다. 이것은 "none"trival 문제입니다. 프레임 메뉴 바를 고려해야합니다. 나는 몇 가지 아이디어를 가지고 놀고, 내가 무엇을 생각해 내는지 볼 것입니다 ... – MadProgrammer

답변

2

Google에서 찾아 볼 수있는 놀라운 기능입니다. 나는 자신이 체크 아웃 한 적이 없다, 그러나 이것은 미주리에서 내 Mac에서하지 뿅

Disabling the shadow around JInternalFrames with the Aqua Look and Feel

+0

그 문제는이 질문과 관련이 없습니다, 불행히도. – CodeGuy

+1

정말요? 내가 말할 수있는 것, 내부 프레임이 바탕 화면 영역을 채우지 않는 이유는 프레임 주위의 그림자 삽 입을 고려하기 때문입니다. – MadProgrammer

+0

@CodeGuy : 클라이언트 속성은이 [예제] (http : //)에서 작동합니다. stackoverflow.com/a/8199839/230513); +1; – trashgod

1

당신은 당신의 JDesktopPane에서 사용하는 DesktopManagermaximizeFrame() 방법을 대체 할 수 있습니다. 관련된 예제가 here입니다.

0

티르이

// Add internal frame to desktop 
JDesktopPane desktop = new JDesktopPane(); 
desktop.add(iframe); 
iframe.setMaximum(true); 
관련 문제