この記事では、参照にスイングスプリットペインコントロールJSPlitPaneを使用する方法を共有しています。特定のコンテンツは次のとおりです
パッケージDay1115; Import Javax.swing。*; Import Java.awt.Color; public class test3 {public static void main(string [] args){jframe frame = new jframe( "Test Window"); frame.setDefaultCloseoperation(jframe.exit_on_close); frame.setVisible(true); jPanel J1 = new JPanel(); jPanel J2 = new JPanel(); j1.setbackground(color.red); j2.setbackground(color.green); JSplitPane splitPane=new JSplitPane();//Create a split container class splitPane.setOneTouchExpandable(true);//Let the split line display arrow splitPane.setContinuousLayout(true);//Operate the arrow and redraw the graph splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);//Set the vertical distribution ofスプリットライン方向SPLI TPANE.SESTLEFTCOMPONENT(J1); //コンポーネントSplitPane.SetRightComponent(J2); //コンポーネントsplitpane.setDividerSize(1); //スプリットラインsplitpane.setDividerLocation(50); //frame.pack()、この関数の関数は、ウィンドウのレイアウトとコンポーネントの優先サイズに基づいて、フレームの最適なサイズを決定することです。 frame.pack();}}複製画像:
スプリットラインの移動:
上記はこの記事のすべての内容です。みんなの学習に役立つことを願っています。誰もがwulin.comをもっとサポートすることを願っています。