fork download
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package JSplitDmeo;
  7.  
  8. import java.awt.BorderLayout;
  9. import java.awt.Dimension;
  10. import javax.swing.JFrame;
  11. import javax.swing.JPanel;
  12. import javax.swing.JSplitPane;
  13.  
  14. /**
  15.  *
  16.  * @author I'msimple
  17.  */
  18. public class DemoJSplit {
  19.  
  20. JFrame frame;
  21. JPanel jpnLeft,jpnRight;
  22. JSplitPane jsp00;
  23. JSplitPane jsp01;
  24.  
  25.  
  26. public DemoJSplit(String text) {
  27.  
  28. initContainer();
  29.  
  30. initComponent();
  31.  
  32. setAction();
  33. frame.setTitle(text);
  34. frame.setVisible(true);
  35. }
  36.  
  37. private void setAction() {
  38.  
  39.  
  40. }
  41. private void initContainer() {
  42. frame = new JFrame();
  43. frame.setLayout(new BorderLayout());
  44. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  45. frame.setSize(400,600);
  46. frame.setLocationRelativeTo(null);
  47. }
  48.  
  49. private void initComponent() {
  50. jpnLeft = new JPanel();
  51.  
  52. //Chinh kích thuoc cho panel
  53. jpnLeft.setPreferredSize(new Dimension(200, 0));
  54. jpnRight = new JPanel();
  55. jpnRight.setLayout(new BorderLayout());
  56. jsp00 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jpnLeft, jpnRight);
  57. jsp00.setOneTouchExpandable(true);
  58.  
  59.  
  60. //Ta chi jpnRight thanh 2 phan
  61. JPanel jpnTop = new JPanel();
  62. JPanel jpnBottom = new JPanel();
  63. jsp01 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jpnTop, jpnBottom);
  64. //Chinh kich thuoc jpnTop lon len
  65. jpnTop.setPreferredSize(new Dimension(0,200));
  66. jsp01.setOneTouchExpandable(true);
  67.  
  68.  
  69.  
  70. //add cac giao dien
  71. frame.add(jsp00);
  72. jpnRight.add(jsp01,BorderLayout.CENTER);
  73. }
  74.  
  75.  
  76. public static void main(String[] args) {
  77. new DemoJSplit("Chia đôi màn hình");
  78. }
  79.  
  80. }
  81.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:18: error: class DemoJSplit is public, should be declared in a file named DemoJSplit.java
public class DemoJSplit {
       ^
1 error
stdout
Standard output is empty