를 왼쪽으로 추가하고, 나는 두 가지 구성 요소, 다른 상단에 하나를 배치하고 싶습니다.BoxLayout에서는 내가 <code>BoxLayout</code> (페이지 축)이있는 JPanel에있어 마진
내 문제는 어떻게이 제거 할 수있는 큰 lipsum 상자의 왼쪽에 여백을 무엇입니까? 상위 구성 요소를 추가하지 않으면 여백이 없습니다. 여기
번째 화상headerPanel
를 첨가하지 않음으로써 만들어 내 코드이다 :
가
JLabel commandLabel = new JLabel(command);
JLabel paramLabel = new JLabel(params);
JLabel descLabel = new JLabel("<html><body style='width: 200px;'>" + description + "</body></html>");
Font baseFont = commandLabel.getFont(), commandFont, paramFont, descFont;
commandFont = baseFont.deriveFont(Font.BOLD);
paramFont = baseFont.deriveFont(Font.ITALIC);
descFont = baseFont.deriveFont(Font.PLAIN);
commandLabel.setFont(commandFont);
paramLabel.setFont(paramFont);
descLabel.setFont(descFont);
descLabel.setAlignmentX(LEFT_ALIGNMENT);
descLabel.setBorder(BorderFactory.createStrokeBorder(new BasicStroke()));
JPanel headerPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
headerPanel.add(commandLabel);
headerPanel.add(paramLabel);
this.add(headerPanel);
this.add(descLabel);
이 클래스 JPanel
연장하고
pack()
이다하는
JFrame
에 첨가
'여기 내 code'의 - A는 적절한 [mcve] 문제를 보여줍니다 해당 게시물. 제공된 코드는 컴파일/실행할 수 없습니다. – camickr