1
JApplet 만들기 2 개의 텍스트 필드, 버튼 및 텍스트 영역이 있습니다.자바 애플릿 크기에 따라 크기 조정에서 JApplet 구성 요소 중지
private JPanel addressEntryPanel = new JPanel(new GridLayout(1,3));
private JPanel outputPanel = new JPanel(new GridLayout(1,1));
private JTextField serverTf = new JTextField("");
private JTextField pageTf = new JTextField("");
private JTextArea outputTa = new JTextArea();
private JButton connectBt = new JButton("Connect");
private JScrollPane outputSp = new JScrollPane(outputTa);
public void init()
{
setSize(500,500);
setLayout(new GridLayout(3,1));
add(addressEntryPanel);
addressEntryPanel.add(serverTf);
addressEntryPanel.add(pageTf);
addressEntryPanel.add(connectBt);
addressEntryPanel.setPreferredSize(new Dimension(50,50));
addressEntryPanel.setMaximumSize(addressEntryPanel.getPreferredSize());
addressEntryPanel.setMinimumSize(addressEntryPanel.getPreferredSize());
add(outputPanel);
outputPanel.add(outputSp);
outputTa.setLineWrap(true);
connectBt.addActionListener(this);
문제는 애플릿 크기에 따라 구성 요소/패널의 크기가 조정되는 페이지에 디버깅하여 넣는 것입니다. 나는 이것을 원하지 않는다. 텍스트 필드를 특정 크기로, 텍스트 영역을 특정 크기로 지정합니다. 거기에 물건을 넣어서 크기를 정했지만 작동하지 않습니다. 실제로 구성 요소 나 JPanel의 엄격한 크기를 설정하는 방법은 무엇입니까?
나는 그것이 GridLayout과의 일부 같아요 그래, 내가 무시하고 싶지 않아,하지만 애플릿으로는거야 설정된 너비와 높이에 있어야하지만 구성 요소는보기 흉하고 일정한 크기로 늘어납니다. – Doug