0

outerPanel の全幅に到達する方法は?

    private JPanel createLabelPanel() {

        final JToolTip tt = new JToolTip();
        //tt.setSize(new Dimension(100,200));
        final CompoundBorder cb = new CompoundBorder(tt.getBorder(), BorderFactory.createEmptyBorder(2, 2, 2, 2));
        final JPanel innerPanel = new JPanel();
        innerPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));

        innerPanel.setBorder(cb);
        innerPanel.setBackground(tt.getBackground());
        innerPanel.add(displayLabel);
        innerPanel.setBorder(BorderFactory.createLineBorder(Color.GREEN));

        final JScrollPane tooltipscrool = new JScrollPane(innerPanel);
        //tooltipscrool.setMinimumSize(new Dimension(200,100));
        tooltipscrool.setPreferredSize(new Dimension(100,120));
        tooltipscrool.setBorder(BorderFactory.createLineBorder(Color.BLACK));

        final JPanel outerPanel = new JPanel();
        outerPanel.add(tooltipscrool);
        outerPanel.setBorder(BorderFactory.createLineBorder(Color.GREEN));
        //outerPanel.set
        return outerPanel;
    }

私を作る:

ここに画像の説明を入力

私の目的は、innerPanel (緑色のもの) の全幅を確保することです。

4

1 に答える 1