⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 splitpane.java

📁 java技术内幕源代码,配合书籍看有事半功倍的效果
💻 JAVA
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

/*
<APPLET
    CODE = splitpane.class
    WIDTH = 600
    HEIGHT = 200 >
</APPLET>
*/

public class splitpane extends JApplet implements ActionListener
{
    JButton jbutton1, jbutton2, jbutton3;
    JTextField text1 = new JTextField("Text 1");
    JTextField text2 = new JTextField("Text 2");
    JSplitPane jsplitpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
        text1, text2);

    public void init()
    {
        Container contentPane = getContentPane();
        JPanel jpanel = new JPanel();

        jbutton1 = new JButton("Make one-touch expandable");
        jbutton1.addActionListener(this);
        jpanel.add(jbutton1);

        jbutton2 = new JButton("Make split horizontal");
        jbutton2.addActionListener(this);
        jpanel.add(jbutton2);

        jbutton3 = new JButton("Increase divider size");
        jbutton3.addActionListener(this);
        jpanel.add(jbutton3);

        contentPane.add(jsplitpane, BorderLayout.CENTER);
        contentPane.add(jpanel, BorderLayout.SOUTH);
    }

    public void actionPerformed(ActionEvent e)
    {
        if(e.getSource() == jbutton1) {
            jsplitpane.setOneTouchExpandable(true);
        }
        if(e.getSource() == jbutton2) {
            jsplitpane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
        }
        if(e.getSource() == jbutton3) {
            jsplitpane.setDividerSize(jsplitpane.getDividerSize() + 10);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -