https://jflash.dev.java.net/JFlash has the aim to create a pure Java player for Macromedia .SWF flash media files wit support for J2SE and J2ME (CLDC 1.0 / MIDP 2.0).The current J2SE version is an early ALPHA that works fine with some older .SWF files.........
package homework; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon;import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException;/** * This code was edited or generated using CloudGarden's Jigloo * SWT/Swing GUI Builder, which is free for non-commercial * use. If Jigloo is being used commercially (ie, by a corporation, * company or business for any purpose whatever) then you * should purchase a license for each developer using Jigloo. * Please visit www.cloudgarden.com for details. * Use of Jigloo implies acceptance of these licensing terms. * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE. */ public class LoginPanel extends JFrame{ private JLabel jLabel1; private JLabel jLabel2; private JPasswordField jPasswordField1; private JButton jButton1; private JButton jButton2; private JTextField jTextField1; public LoginPanel() { { this.setSize(315, 291); setResizable(false); setLocation(400,300); setLayout(null); setDefaultCloseOperation(EXIT_ON_CLOSE); setTitle("登陆界面V1.1__小四"); setVisible(true); this.setIconImage(new ImageIcon(getClass().getClassLoader().getResource("homework/小四.png")).getImage()); { jLabel1 = new JLabel(); getContentPane().add(jLabel1); jLabel1.setText("\u7528\u6237\u540d"); jLabel1.setBounds(29, 120, 41, 18); } { jLabel2 = new JLabel(); getContentPane().add(jLabel2); jLabel2.setText("\u5bc6\u7801 "); jLabel2.setBounds(29, 172, 41, 18); } { jTextField1 = new JTextField(); getContentPane().add(jTextField1); jTextField1.setBounds(107, 118, 138, 22); } { jPasswordField1 = new JPasswordField(); getContentPane().add(jPasswordField1); jPasswordField1.setBounds(107, 170, 138, 22); } { jButton1 = new JButton(); getContentPane().add(jButton1); jButton1.setText("\u786e\u5b9a"); jButton1.setBounds(21, 226, 81, 28); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String username=jTextField1.getText().trim(); String password=jPasswordField1.getText().trim(); if(username.equals("xiaosi")||password.equals("xiaosi")) { JOptionPane.showMessageDialog(null, "登陆成功,你真厉害,那我就跑路了!", "登陆成功提示", JOptionPane.INFORMATION_MESSAGE); dispose(); } else{ JOptionPane.showMessageDialog(null, "哎,问问密码再来吧,小样的!", "登陆失败提示", JOptionPane.QUESTION_MESSAGE); return; } }
如果你觉得jflash很麻烦的话那我还有最后一个更优化的解决方案 不过需要你的actionscript的朋友一起配合而且需要你100分来买 你愿意吗?
如果你需要的话 把这个帖子结了 然后开一个100分的吧 啊哈哈哈哈哈哈
但是考虑到jflash是一个比较繁琐 并且要下载还需要什么贡献 我觉得比较恶心替代的解决办法是 1. 用ActionScript把swf搞成一个Adobe AIR
2. AIR和JAVA用 C/S 通信
3. 你说是登陆界面 也就是在java刚刚起来的时候 就launch AIR
4. 结束的时候把AIR关掉就可以了5. 中间会有一个很麻烦的bug 就是最上层的界面问题 因为AIR会和Swing抢onTop的那一层
6. #5的解决方案是 在登录界面的swing里面挖一个洞 把AIR正好嵌入进去
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class LoginPanel extends JFrame{
private JLabel jLabel1;
private JLabel jLabel2;
private JPasswordField jPasswordField1;
private JButton jButton1;
private JButton jButton2;
private JTextField jTextField1;
public LoginPanel()
{
{
this.setSize(315, 291);
setResizable(false);
setLocation(400,300);
setLayout(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setTitle("登陆界面V1.1__小四");
setVisible(true);
this.setIconImage(new ImageIcon(getClass().getClassLoader().getResource("homework/小四.png")).getImage());
{
jLabel1 = new JLabel();
getContentPane().add(jLabel1);
jLabel1.setText("\u7528\u6237\u540d");
jLabel1.setBounds(29, 120, 41, 18);
}
{
jLabel2 = new JLabel();
getContentPane().add(jLabel2);
jLabel2.setText("\u5bc6\u7801 ");
jLabel2.setBounds(29, 172, 41, 18);
}
{
jTextField1 = new JTextField();
getContentPane().add(jTextField1);
jTextField1.setBounds(107, 118, 138, 22);
}
{
jPasswordField1 = new JPasswordField();
getContentPane().add(jPasswordField1);
jPasswordField1.setBounds(107, 170, 138, 22);
}
{
jButton1 = new JButton();
getContentPane().add(jButton1);
jButton1.setText("\u786e\u5b9a");
jButton1.setBounds(21, 226, 81, 28);
jButton1.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e) {
String username=jTextField1.getText().trim();
String password=jPasswordField1.getText().trim();
if(username.equals("xiaosi")||password.equals("xiaosi"))
{
JOptionPane.showMessageDialog(null, "登陆成功,你真厉害,那我就跑路了!", "登陆成功提示", JOptionPane.INFORMATION_MESSAGE);
dispose();
}
else{
JOptionPane.showMessageDialog(null, "哎,问问密码再来吧,小样的!", "登陆失败提示", JOptionPane.QUESTION_MESSAGE);
return;
}
}
});
}
{
jButton2 = new JButton();
getContentPane().add(jButton2);
jButton2.setText("\u53d6\u6d88");
jButton2.setBounds(170, 226, 81, 28);
jButton2.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e) {
int option=JOptionPane.showConfirmDialog(LoginPanel.this, "您确定要退出了吗?","确定退出",JOptionPane.OK_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE);
if(option==JOptionPane.OK_OPTION)
{
dispose();
}
if(option==JOptionPane.CANCEL_OPTION)
{
return;
}
}
});
}
} }
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
SwingUtilities.invokeLater((new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
LoginPanel lp=new LoginPanel();
}
}));
}}
这是源代码 请你修改一下 成功了分就给你了!
指的是???
哎 觉得还是用jflash 比较好 不过你给的地址好像找不到在那儿!