import java.awt.BorderLayout;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Locale;
import java.util.MissingResourceException ;
import java.util.ResourceBundle;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class SplitAndMergemain extends InitFrame{
private static final long serialVersionUID = 1L;
public SplitAndMergemain()
{
super("文件切割合并器","file_split.png",420,220);
this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
init();
this.setVisible(true);
}
private void init()
{
this.setLayout(new BorderLayout());
// 初始化面板
centerPanel = new JPanel();
// 设置面板布局
centerPanel.setLayout(new GridBagLayout());
this.add(centerPanel,BorderLayout.CENTER);
this.setResizable(false);
button_split = new JButton(" 文 件 切 割",new ImageIcon(SplitAndMergemain.class.getResource("/resources/split_编辑.png")));
button_split.addActionListener(listener);
button_merge = new JButton(" 文 件 合 并",new ImageIcon(SplitAndMergemain.class.getResource("/resources/merge_编辑.png")));
button_merge.addActionListener(listener);
button_help = new JButton("帮 助",new ImageIcon(SplitAndMergemain.class.getResource("/resources/help.png")));
button_help.addActionListener(listener);
button_about = new JButton("关 于",new ImageIcon(SplitAndMergemain.class.getResource("/resources/about.png")));
button_about.addActionListener(listener);
centerPanel.add(button_split,new GBC(0,0,3,2));
centerPanel.add(button_merge,new GBC(0,2,3,2));
centerPanel.add(button_help,new GBC(0,5,1,1));
centerPanel.add(button_about,new GBC(2,5,1,1));
}
private class ChoiceListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==button_split)
{
new Split();
}else if(e.getSource()==button_merge)
{
new Merge();
}else if(e.getSource()==button_help)
{
new Help();
}else if(e.getSource()==(button_about))
{
new About();
}
}
}
public static void main(String[] args)
{
new SplitAndMergemain();
}
ChoiceListener listener = new ChoiceListener();
private JPanel centerPanel;
private JButton button_split ;
private JButton button_merge;
private JButton button_help;
private JButton button_about;
}