package de.onyxbits.giftedmotion;
import java.awt.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.net.*;
/**
* Core class
*/
public class Core extends JFrame implements WindowListener, ActionListener,
ComponentListener, MouseMotionListener, MouseListener {
/**
* Program version as shown in the title
*/
public static final String VERSION="GiftedMotion "+Package.getPackage("de.onyxbits.giftedmotion").getImplementationVersion();
/**
* Back reference to the running program
*/
public static Core app;
/**
* Quit program
*/
private JMenuItem quit = new JMenuItem(Dict.get("core.quit"),KeyEvent.VK_Q);
/**
* Load files
*/
private JMenuItem load = new JMenuItem(Dict.get("core.load"),KeyEvent.VK_L);
/**
* Export as animated GIF
*/
private JMenuItem export = new JMenuItem(Dict.get("core.export"),KeyEvent.VK_S);
/**
* Save the sequence as individual files
*/
private JMenuItem extract = new JMenuItem(Dict.get("core.extract"),KeyEvent.VK_E);
/**
* Display license
*/
private JMenuItem license = new JMenuItem(Dict.get("core.license"));
/**
* Go to homepage
*/
private JMenuItem handbook = new JMenuItem(Dict.get("core.handbook"));
/**
* Go to FAQ
*/
private JMenuItem faq = new JMenuItem(Dict.get("core.faq"));
/**
* Play animation
*/
private JButton play = new JButton(IO.createIcon("Tango/22x22/actions/media-playback-start.png",Dict.get("core.play")));
/**
* Pause animation
*/
private JButton pause = new JButton(IO.createIcon("Tango/22x22/actions/media-playback-pause.png",Dict.get("core.pause")));
/**
* Record (same as export)
*/
private JButton record = new JButton(IO.createIcon("Tango/22x22/actions/media-record.png",Dict.get("core.record")));
/**
* Import (same as load)
*/
private JButton open = new JButton(IO.createIcon("Tango/22x22/actions/document-open.png",Dict.get("core.open")));
/**
* Toggle displaying of the settings window
*/
private JButton togglesettings = new JButton(IO.createIcon("Tango/22x22/categories/preferences-desktop.png",Dict.get("core.togglesettings")));
/**
* Sequence Editor
*/
private SequenceEditor seqedit;
/**
* Frame Display
*/
private FrameDisplay display;
/**
* Settings editor
*/
private SettingsEditor setedit = new SettingsEditor();
/**
* The main workspace
*/
private JDesktopPane workspace = new JDesktopPane();
/**
* The framesequence being worked upon
*/
private FrameSequence seq;
/**
* Directory, to open filedialogs with
*/
private File directory = new File(System.getProperty("user.dir"));
/**
* Used for doing an animation preview
*/
private Player player;
/**
* For displaying status messages
*/
private JLabel status = new JLabel();
/**
* Construct a new instance of the program. There may only be one object
* of this class present.
*/
public Core() {
// Wire listeners up
load.addActionListener(this);
extract.addActionListener(this);
export.addActionListener(this);
quit.addActionListener(this);
faq.addActionListener(this);
handbook.addActionListener(this);
license.addActionListener(this);
open.addActionListener(this);
play.addActionListener(this);
pause.addActionListener(this);
record.addActionListener(this);
togglesettings.addActionListener(this);
// Fancy stuff
quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,ActionEvent.CTRL_MASK));
load.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L,ActionEvent.CTRL_MASK));
export.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,ActionEvent.CTRL_MASK));
handbook.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1,0));
open.setToolTipText(((ImageIcon)open.getIcon()).getDescription());
play.setToolTipText(((ImageIcon)play.getIcon()).getDescription());
pause.setToolTipText(((ImageIcon)pause.getIcon()).getDescription());
togglesettings.setToolTipText(((ImageIcon)togglesettings.getIcon()).getDescription());
record.setToolTipText(((ImageIcon)record.getIcon()).getDescription());
pause.setEnabled(false);
status.setBorder(new BevelBorder(BevelBorder.LOWERED));
// Build menus
JMenu file = new JMenu(Dict.get("core.core.file"));
file.add(load);
file.add(extract);
file.add(export);
file.add(new JSeparator());
file.add(quit);
JMenu help = new JMenu(Dict.get("core.core.help"));
help.add(handbook);
help.add(faq);
help.add(new JSeparator());
help.add(license);
JMenuBar mbar = new JMenuBar();
mbar.add(file);
mbar.add(Box.createHorizontalGlue());
mbar.add(help);
mbar.setBorder(new BevelBorder(BevelBorder.RAISED));
setJMenuBar(mbar);
// Build toolbar
JToolBar tbar = new JToolBar();
tbar.setRollover(true);
tbar.setFloatable(true);
tbar.add(open);
tbar.add(togglesettings);
tbar.addSeparator();
tbar.add(play);
tbar.add(pause);
tbar.add(record);
tbar.addSeparator();
// Put all together and display
JPanel content = new JPanel();
content.setLayout(new BorderLayout());
content.add(tbar,BorderLayout.NORTH);
content.add(workspace,BorderLayout.CENTER);
content.add(status,BorderLayout.SOUTH);
setContentPane(content);
workspace.add(setedit);
postStatus("");
}
/**
** Various event listeners interface implementations
**/
public void windowClosing(WindowEvent e) { handleQuit(); }
public void focusLost(FocusEvent e) {}
public void windowOpened(WindowEvent e) {}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
if (src == quit) handleQuit();
if (src == load || src == open ) handleLoad();
if (src == extract) handleExtract();
if (src == export || src == record) handleExport();
if (src == handbook) handleHandbook();
if (src == faq) handleFAQ();
if (src == license) handleLicense();
if (src == play || src == pause ) handlePlayPause();
if (src == togglesettings ) handleTogglesettings();
}
public void componentHidden(ComponentEvent e) {}
public void componentMoved(ComponentEvent e) {}
public void componentShown(ComponentEvent e) {}
public void componentResized(ComponentEvent e) {
Component c = (Component)e.getSource();
Integer size[] = {
new Integer(c.getWidth()),
new Integer(c.getHeight())
};
postStatus(Dict.get("core.componentresized",size));
}
public void mouseMoved(MouseEvent e) {}
public void mouseDragged(MouseEvent e) {
if (seq.selected==null) return;
Integer pos[] = {
new Integer(seq.selected.position.x),
new Integer(seq.selected.position.y)
};
postStatus(Dict.get("core.mousedragged",pos));
}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mouseClicked(MouseEvent e) {}
public void mousePressed(MouseEvent e) {
if (seq.selected==null) return;
Integer pos[] = {
new Integer(seq.selected.position.x),
new Integer(seq.selected.position.y)
};
postStatus(Dict.get("core.mousepressed",pos));
}
public void mouseReleased(MouseEvent e) {
postStatus("");
}
/**
** Handlers for events created by GUI elements
**/
public void handleQuit() {
System.exit(0);
}
public void handleLoad() {
try {
postStatus(Dict.get("core.handleload.hint"));
LoadAccessory loadAccessory = new LoadAccessory();
JFileChooser jfc = new JFi
没有合适的资源?快使用搜索试试~ 我知道了~
小程序 GIF动画制作工具 GiftedMotion(源码).zip
共44个文件
java:21个
png:14个
properties:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 46 浏览量
2023-02-03
13:24:36
上传
评论
收藏 74KB ZIP 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
小程序 GIF动画制作工具 GiftedMotion(源码).zip (44个子文件)
onyxbits-GiftedMotion-da67b55
resources
logo-64x64.png 3KB
LICENSE 18KB
logo-32x32.png 1KB
logo-96x96.png 5KB
logo.svg 4KB
i18n_pt_BR.properties 4KB
i18n_de.properties 3KB
i18n_it.properties 4KB
icons
Tango
22x22
categories
preferences-desktop.png 512B
actions
document-open.png 1001B
edit-copy.png 725B
go-down.png 874B
go-up.png 877B
media-playback-pause.png 655B
media-record.png 1KB
edit-delete.png 1KB
media-playback-start.png 961B
16x16
actions
process-stop.png 820B
i18n.properties 4KB
logo-48x48.png 2KB
i18n_pl_PL.properties 4KB
src
de
onyxbits
giftedmotion
Core.java 14KB
FrameCanvas.java 3KB
FrameDisplay.java 591B
NeuQuant.java 13KB
Settings.java 408B
ImageFileFilter.java 845B
CatchOldJava.java 2KB
SettingsEditor.java 3KB
SingleFrame.java 3KB
SequenceEditor.java 11KB
AnimatedGifEncoder.java 13KB
LZWEncoder.java 8KB
IO.java 5KB
PlayerHelper.java 230B
Dict.java 1KB
LoadAccessory.java 1KB
FrameSequenceListener.java 363B
ColorIcon.java 856B
Player.java 1KB
FrameSequence.java 4KB
Preview.java 1KB
.gitignore 24B
build.xml 719B
共 44 条
- 1
资源评论
大富大贵7
- 粉丝: 389
- 资源: 8868
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功