Java JTextPane JScrollPane Display Issue

后端 未结 2 1853
别那么骄傲
别那么骄傲 2021-01-23 23:59

The following class implements a chatGUI. When it runs okay the screen looks like this:

Fine ChatGUI http://img21.imageshack.us/img21/7177/rightchat.jpg

The prob

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-24 00:29

    The problem might be the layout manager you're using.

    You have a GridBagLayout for all the components. Try adding the bottom component in their own panel instead of align them with the history text area.

    Something like:

    JScrollPane history = new JScrollPane( new JTextPane() );
    
    JPanel inputClearSavePane = new JPanel();
    // layout the input, clear save button
    
    getContentPane().add( history );
    getContentPane().add( inputClearSavePane, BorderLayout.SOUTH );
    

    And see if that helps. edit

    BTW, it works on Mac

    Linux

    And windows:

提交回复
热议问题