oxeyeframe.java
来自「使用java技术写的一个图像处理框架,实现了目录树,分割窗格,任务栏图标等技术」· Java 代码 · 共 73 行
JAVA
73 行
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import org.jdesktop.jdic.desktop.Desktop;
import java.io.*;
public class OxeyeFrame extends JFrame
{
JPanel leftpane=new Leftpane(); //左面的窗格
JPanel rightpane=new Rightpane();//右边的窗格
JMenuBar menubar=null;
JToolBar toolbar=null;
JMenu filemenu=null;
JMenuItem file_new=null;
JButton openbutton=null;
public OxeyeFrame()
{
setMenubar();
setPanel();
}
/**
* 定义各面板的位置*/
public void setPanel()
{
JSplitPane horizontal=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,
leftpane,rightpane);
horizontal.setDividerLocation(200);
horizontal.setOneTouchExpandable(true);
this.getContentPane().add(horizontal,BorderLayout.CENTER);
this.getContentPane().add(setToolbar(),BorderLayout.NORTH);
}
/**
* 定义文件菜单*/
public JMenu setFileMenu()
{
file_new=new JMenuItem("新 建");
filemenu=new JMenu("文 件");
filemenu.add(file_new);
return filemenu;
}
/**
* 定义菜单条*/
public void setMenubar()
{
menubar=new JMenuBar();
menubar.add(setFileMenu());
this.setJMenuBar(menubar);
}
/**
* 定义工具栏*/
public JToolBar setToolbar()
{
openbutton=new JButton("打开");
openbutton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
try{
Desktop.open(new File("E:\\java tool\\resin-2.1.4.rar"));
}
catch(Exception e){}
}
});
toolbar=new JToolBar();
toolbar.setRollover(true);
toolbar.add(openbutton);
return toolbar;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?