bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

java圖片自動播放代碼 java上傳圖片代碼

java:求一段代碼,很簡單,運行后直接播放一個小視頻,播放完后(或者自行定時)立刻自動關閉。

下載JMF(java media framework)

創(chuàng)新互聯(lián)專注于企業(yè)全網(wǎng)整合營銷推廣、網(wǎng)站重做改版、永順網(wǎng)站定制設計、自適應品牌網(wǎng)站建設、H5頁面制作、商城網(wǎng)站定制開發(fā)、集團公司官網(wǎng)建設、成都外貿(mào)網(wǎng)站建設公司、高端網(wǎng)站制作、響應式網(wǎng)頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為永順等各大城市提供網(wǎng)站開發(fā)制作服務。

下面是一個例子

import?java.awt.BorderLayout;

import?java.awt.Component;

import?java.net.MalformedURLException;

import?java.net.URL;

import?javax.media.Manager;

import?javax.media.MediaLocator;

import?javax.media.Player;

import?javax.swing.JFileChooser;

import?javax.swing.JFrame;

public?class?MediaPlayer?extends?javax.swing.JPanel?{

public?MediaPlayer(URL?mediauUrl)?{???????

initComponents();

setLayout(new?BorderLayout());

try?{

Player?mediaPlayer?=?Manager.createRealizedPlayer(new?MediaLocator(mediauUrl));

Component?video?=?mediaPlayer.getVisualComponent();

Component?control?=?mediaPlayer.getControlPanelComponent();

if?(video?!=?null)?{

add(video,?BorderLayout.CENTER);??????????//?place?the?video?component?in?the?panel

}

add(control,?BorderLayout.SOUTH);????????????//?place?the?control?in??panel

mediaPlayer.start();

}?catch?(Exception?e)?{

}

}

private?void?initComponents()?{

javax.swing.GroupLayout?layout?=?new?javax.swing.GroupLayout(getTopLevelAncestor());

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGap(0,?720,?Short.MAX_VALUE)

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGap(0,?480,?Short.MAX_VALUE)

);

}

public?static?void?main(String[]?args)?{

JFileChooser?fileChooser?=?new?JFileChooser();

fileChooser.showOpenDialog(null);

URL?mediaUrl?=?null;

try?{

mediaUrl?=?fileChooser.getSelectedFile().toURI().toURL();

}?catch?(MalformedURLException?ex)?{

System.out.println(ex);

}

JFrame?mediaTest?=?new?JFrame("Movie?Player");

mediaTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

MediaPlayer?mediaPanel?=?new?MediaPlayer(mediaUrl);

mediaTest.add(mediaPanel);

mediaTest.setSize(800,?700);?//?set?the?size?of?the?player

mediaTest.setLocationRelativeTo(null);

mediaTest.setVisible(true);

}

}

如何用java實現(xiàn)圖片預覽功能,求代碼

使用兩種不同的方法實現(xiàn)圖片預覽功能

Java代碼

BODY

script language="javascript"

function ShowImage(path){

document.all.divShow.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = path;

}

function test(){

document.all.showimg.src=document.all.file1.value;

}

/script

INPUT style="Z-INDEX: 101; LEFT: 232px; POSITION: absolute; TOP: 272px" type="file"onchange="ShowImage(this.value)"

div id="divShow" style="FILTER:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);WIDTH:274px;HEIGHT:100px"

input type="file" id="file1" onchange="test()"br/

img id="showimg" style="width:200px;height:200px;"

/BODY

"java如何打開本地播放器后自動播放視頻文件"

“執(zhí)行的程序” 文件路徑

//注意一:程序的路徑要打引號,我的迅雷看看在f盤 ,文件在e盤。

//注意二:程序和文件夾路徑中間有個空格.

根據(jù)下面的代碼自己修改吧

Runtime.getRuntime().exec("\"f:\\Program?Files?(x86)\\Thunder?Network\\Xmp\\Program\\XMP.exe\"?e:\\mp4\\high歌.mp4");

用JAVA在界面中實現(xiàn)幻燈片播放,求代碼

要讓照片隨機播放,需要把照片名改成比如photo1.jpg,photo2.jpg,photo3.jpg...的有序號順序排列的文件名,

然后把改名后的照片文件放到你的項目名的目錄下,比如你的項目名叫"slideshow",你就把照片文件放到slideshow文件夾下.

最后把下面的Java程序拷貝到你的項目中,把有DD類名的地方改成你的類名,就行了.

完整的讓一些照片在JFrame窗體里自動隨機播放的幻燈片程序如下

(我用的圖片文件是photo1.jpg,photo2.jpg,photo3.jpg,注意事項在注釋中注明

import java.awt.Graphics;

import javax.swing.ImageIcon;

import javax.swing.JFrame;

public class DD extends JFrame implements Runnable{

ImageIcon ii=new ImageIcon("photo1.jpg");//這里換成你的圖片文件名,放在你的項目名的文件夾中

DD(){

super("Slide");

setSize(400, 400);

setLocationRelativeTo(null);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setVisible(true);

}

public void paint(Graphics g){

super.paint(g);

g.drawImage(ii.getImage(),0,0,400,400,null);

}

@Override

public void run() {

while(true){

try {

Thread.sleep(500);//這里是幻燈片播放間隔的時間,這里為500毫秒=0.5秒

} catch (InterruptedException e) {

e.printStackTrace();

}

int i=(int)(Math.random()*3)+1;//這里是產(chǎn)生從1-3的隨機數(shù),如果你有6個圖片文件,把3改成6就是從1-6的隨機數(shù)了.

ii=new ImageIcon("photo"+i+".jpg");//這里調用你的圖片文件,如果你有6個圖片文件,改成從1-6的文件名方便調用

this.repaint();

}

}

public static void main(String[] args) {

DD d=new DD();

Thread t=new Thread(d);

t.start();

}

}

請給我的JAVA程序添加一個自動播放圖片功能

//其余的類在qq上給你..

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Cursor;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Image;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.awt.event.WindowEvent;

import java.io.File;

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

import java.lang.reflect.AccessibleObject;

import java.lang.reflect.Field;

import java.util.Properties;

import javax.swing.BorderFactory;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFileChooser;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTextArea;

import javax.swing.LookAndFeel;

import javax.swing.SwingUtilities;

import javax.swing.UIManager;

import javax.swing.event.DocumentEvent;

import javax.swing.event.DocumentListener;

import javax.swing.filechooser.FileNameExtensionFilter;

public class ImageFrame extends JFrame implements ActionListener, MouseListener {

/**

*

*/

private static final long serialVersionUID = -5241799989073556019L;

static Properties property = new Properties();

static {

Class iClass;

try {

iClass = Class.forName("sun.awt.im.InputMethodContext");

Field field = iClass.getDeclaredField("belowTheSpotInputRequested");

AccessibleObject.setAccessible(new AccessibleObject[] { field },

true);

field.setBoolean(null, false);

} catch (Exception e) {

}

}

public JPanel imagePanel;

public JPanel buttonPanel;

public JPanel statePanel;

public JLabel imageLabel;

public JLabel stateLabel;

public JButton before;

public JButton play;

public JButton stop;

public JButton next;

public JButton bigger;

public JButton smaller;

static JTextArea area = new JTextArea(5, 60);

JScrollPane scroll = new JScrollPane(area);

public File picFile;

public Image img;

public ImageIcon imageIcon;

public String fileParent;

FileNameExtensionFilter imageFilter = new FileNameExtensionFilter(null,

"jpeg", "jpg", "png", "gif");

JFileChooser imageChooser = new JFileChooser();

public File filePath[];

public File imagePath[];

public static Picture images[];

public int imageFileNumber = 0;

public static int locationImage = 0;

public static ImageFrame myImageFrame;

private PlayTimer playTimer;

public Image[] imageOffer;

public int scale = 8;

public JScrollPane imageScrollPane;

public ImageFrame(String picPath) {

picFile = new File(picPath);

fileParent = picFile.getParent();

filePath = (new File(fileParent)).listFiles();

try {

img = javax.imageio.ImageIO.read(picFile);

} catch (IOException ex) {

ex.printStackTrace();

}

imageIcon = new ImageIcon(img);

imageLabel = new JLabel(imageIcon);

imagePanel = new JPanel(new BorderLayout());

imagePanel.setBackground(Color.black);

//R:238 G:243 B:250

//imagePanel.setBackground(new Color(238,243,250));

stateLabel = new JLabel();

final String windows = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";

try {

UIManager.setLookAndFeel(windows);

SwingUtilities.updateComponentTreeUI(this);// 更新控件的外觀

} catch (Exception e) {

e.printStackTrace();

}

setLayout(new BorderLayout());

setTitle("PowerSee 圖片查看器");

setIconImage(new ImageIcon("icon/powerSee.png").getImage());

setSize(800, 600);

this.setMinimumSize(new Dimension(600, 400));

setVisible(true);

setExtendedState(JFrame.MAXIMIZED_BOTH);

buttonPanel = makeButtonPanel();

area.setLineWrap(true);

// area.setWrapStyleWord(true);

area.addMouseListener(this);

// area.setFont(new Font(area.getFont().getFamily(), Font.PLAIN,

// 18));

LookAndFeel.installColorsAndFont(area, "Label.background",

"Label.foreground", "TextArea.font");

area.setBorder(BorderFactory.createTitledBorder("此處可添加照片描述:"));

area.setLineWrap(true);

area.setWrapStyleWord(true);

area.getDocument().addDocumentListener(new SWING_OnValueChanged());

/*

area.setText("");

area.setText("像素大小: " + imageIcon.getIconWidth() + "*"

+ imageIcon.getIconHeight() + " 文件位置: " + picFile.toString()

+ " 文件大小: " + picFile.length() / 1024 + "KB");

*/

/*

area.getDocument()

.addDocumentListener(new SWING_OnValueChanged());

*/

// area.setBackground(new Color() );

Font font = new Font("宋體", Font.PLAIN, 17);

area.setFont( font);

// area.setEditable(false);

statePanel = new JPanel();

//:36 G:53 B:71R:192 G:192 B:196

statePanel.setBackground(new Color(192,192,196));

stateLabel.setText("像素大小: " + imageIcon.getIconWidth() + "*"

+ imageIcon.getIconHeight() + " 文件位置: " + picFile.toString()

+ " 文件大?。?" + picFile.length() / 1024 + "KB");

//stateLabel;

imagePanel.add(imageLabel, BorderLayout.CENTER);

imageScrollPane = new JScrollPane(imagePanel);

add(imageScrollPane, BorderLayout.CENTER);

add(buttonPanel, BorderLayout.NORTH);

//statePanel.add(stateLabel);

//statePanel.setBackground(Color.black);

statePanel.add(area, BorderLayout.CENTER);//scroll

add(statePanel, BorderLayout.SOUTH);

imagePanel.repaint();

imagePanel.validate();

Load();

}

//對于此法可借鑒,返回一個panel竟然......

public JPanel makeButtonPanel() {

JPanel aButtonPanel = new JPanel();

before = new JButton("前一張");

next = new JButton("下一張");

play = new JButton("自動播放");

stop = new JButton("停止");

bigger = new JButton("放大");

smaller = new JButton("縮小");

stop.setEnabled(false);

before.addActionListener(this);

next.addActionListener(this);

play.addActionListener(this);

stop.addActionListener(this);

bigger.addActionListener(this);

smaller.addActionListener(this);

aButtonPanel.add(before);

aButtonPanel.add(play);

aButtonPanel.add(stop);

aButtonPanel.add(next);

aButtonPanel.add(smaller);

aButtonPanel.add(bigger);

return aButtonPanel;

}

/*

* //imageFileNumber 個圖像文件

//filePath.length 個文件

//filePath 以某個文件夾的所有文件為元素的數(shù)組, 以File類型為元素

//imagePath 以所有圖像文件為元素的數(shù)組,仍然以File類型為元素

*/

public void Load() {

imageChooser.setFileFilter(imageFilter);

//System.out.println(filePath.length+"----");

//filePath.length,也就是Image這個文件夾里有多少個文件.......所有種類的文件....!!

for (int i = 0; i filePath.length; i++) {

if (!filePath[i].isDirectory() imageFilter.accept(filePath[i])) {

imageFileNumber++;

} else {

filePath[i] = null;

}

}

//imageFileNumber 個圖像文件

//filePath.length 個文件

//filePath 以某個文件夾的所有文件為元素的數(shù)組, 以File類型為元素

//imagePath 以所有圖像文件為元素的數(shù)組,仍然以File類型為元素

imagePath = new File[imageFileNumber];

images = new Picture[imageFileNumber];

imageFileNumber = 0;

for (int i = 0; i filePath.length; i++) {

if (filePath[i] != null) {

imagePath[imageFileNumber++] = filePath[i];

}

}

imageFileNumber--;

for (int i = 0; i imagePath.length; i++) {

if (imagePath[i] == picFile) {

locationImage = i;

}

}

for (int i = 0; i imagePath.length; i++) {

initTxt(imagePath[i], i);

}

}

public void initTxt(File picFile, int i) {

try {

property.load(new FileInputStream("a.properties"));

/*

String txt = property.getProperty(picFile.getParent() + "."

+ picFile.getName());

*/

images[i] = new Picture(imagePath[i].getParent() + "."

+ imagePath[i].getName(), "");

} catch (Exception e) {

}

//初始化圖片的時候,要從資源文件里讀取所有文件的txt信息,可能花費時間較長

}

/*

*

//imageFileNumber 個圖像文件

//filePath.length 個文件

//filePath 以某個文件夾的所有文件為元素的數(shù)組, 以File類型為元素

//imagePath 以所有圖像文件為元素的數(shù)組,仍然以File類型為元素

*/

public void Before() {

scale = 8;

if (--locationImage 0) {

locationImage = imageFileNumber;

}

try {

img = javax.imageio.ImageIO.read(imagePath[locationImage]);

} catch (IOException ex) {

ex.printStackTrace();

}

imageIcon.setImage(img);

imageLabel.setIcon(imageIcon);

picFile = imagePath[locationImage];

/*

String text = "像素大?。?" + imageIcon.getIconWidth() + "*"

+ imageIcon.getIconHeight() + " 文件位置: " + picFile.toString()

+ " 文件大小: " + picFile.length() / 1024 + "KB";

*/

//System.out.println(picFile.toString());

//Picture p = new Picture(picFile, text);

try {

Properties property = new Properties();

property.load(new FileInputStream("a.properties"));

String areaTxt = "";

areaTxt = property.getProperty(picFile.getParent() + "."

+ picFile.getName());

area.setText("");

area.setText(areaTxt);

} catch (Exception e) {

}

imagePanel.repaint();

imagePanel.validate();

imageScrollPane.repaint();

imageScrollPane.validate();

}

/*

* //imageFileNumber 個圖像文件

//filePath.length 個文件

//filePath 以某個文件夾的所有文件為元素的數(shù)組, 以File類型為元素

//imagePath 以所有圖像文件為元素的數(shù)組,仍然以File類型為元素

*/

public void Next() {

scale = 8;

if (++locationImage imageFileNumber) {

locationImage = 0;

}

try {

img = javax.imageio.ImageIO.read(imagePath[locationImage]);

} catch (IOException ex) {

ex.printStackTrace();

}

imageIcon.setImage(img);

imageLabel.setIcon(imageIcon);

picFile = imagePath[locationImage];

try {

Properties property = new Properties();

property.load(new FileInputStream("a.properties"));

String areaTxt = "";

areaTxt = property.getProperty(picFile.getParent() + "."

+ picFile.getName());

area.setText("");

area.setText(areaTxt);

} catch (Exception e) {

}

imagePanel.repaint();

imagePanel.validate();

imageScrollPane.repaint();

imageScrollPane.validate();

}

public void Bigger() {

ImageIcon icon = imageIcon;

if (scale = 17) {

ImageIcon tmpicon = new ImageIcon(new DrawImage(icon.getImage(),

icon.getIconWidth() / 8, icon.getIconHeight() / 8, ++scale)

.getImage());

imageLabel.setIcon(tmpicon);

} else {

return;

}

}

public void Smaller() {

ImageIcon icon = imageIcon;

if (scale 1) {

ImageIcon tmpicon = new ImageIcon(new DrawImage(icon.getImage(),

icon.getIconWidth() / 8, icon.getIconHeight() / 8, --scale)

.getImage());

imageLabel.setIcon(tmpicon);

} else {

return;

}

}

public void actionPerformed(ActionEvent e) {

if (e.getSource().equals(before)) {

Before();

}

if (e.getSource().equals(next)) {

Next();

}

if (e.getSource().equals(play)) {

stop.setEnabled(true);

before.setEnabled(false);

next.setEnabled(false);

bigger.setEnabled(false);

smaller.setEnabled(false);

play.setEnabled(false);

playTimer = new PlayTimer(this);

playTimer.start();

}

if (e.getSource().equals(stop)) {

stop.setEnabled(false);

before.setEnabled(true);

next.setEnabled(true);

bigger.setEnabled(true);

smaller.setEnabled(true);

play.setEnabled(true);

playTimer.cancel();

}

if (e.getSource().equals(bigger)) {

Bigger();

}

if (e.getSource().equals(smaller)) {

Smaller();

}

}

public void mouseClicked(MouseEvent arg0) {

// 鼠標點擊

area.setEditable(true);

// pane.add(scroll, BorderLayout.CENTER);

}

public void mouseExited(MouseEvent arg0) {

// 鼠標離開區(qū)域

area.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); //鼠標離開Text區(qū)后恢復默認形態(tài)

area.setBackground(null);

//保存信息

//area.setEditable(false);

}

public void mousePressed(MouseEvent arg0) {

}

public void mouseReleased(MouseEvent arg0) {

// 鼠標釋放

}

public void mouseEntered(MouseEvent arg0) {

// 鼠標釋進入?yún)^(qū)域

area.setCursor(new Cursor(Cursor.TEXT_CURSOR)); //鼠標進入Text區(qū)后變?yōu)槲谋据斎胫羔?/p>

area.setBackground(new Color(255, 255, 170));

}

protected void processWindowEvent(WindowEvent e) {

super.processWindowEvent(e);

if (e.getID() == WindowEvent.WINDOW_CLOSING) {

try {

} catch (Exception ex) {

}

System.exit(0);

}

}

public static void main(String a[]) {

new ImageFrame("Image/p1.jpg");

}

}

class Picture {

String text;

String picFile;

Picture(String string, String text) {

this.picFile = string;

this.text = text;

}

String getText() {

return this.text;

}

String getFilePath() {

return this.picFile;

}

void setText(String text) {

this.text = text;

}

}

class SWING_OnValueChanged implements DocumentListener {

public void changedUpdate(DocumentEvent e) {

textValueChanged(e);

}

public void insertUpdate(DocumentEvent e) {

textValueChanged(e);

}

public void removeUpdate(DocumentEvent e) {

textValueChanged(e);

}

public void textValueChanged(DocumentEvent evt) {

//images

int i = 0;

System.out.println("Swing文本框的內(nèi)容改變了!" + ImageFrame.locationImage);

i = ImageFrame.locationImage;

//System.out.println("圖片!" + ImageFrame.images[i].getFilePath());

try {

ImageFrame.property.setProperty(ImageFrame.images[i].getFilePath(),

ImageFrame.area.getText());

// ImageFrame.images[i].setText(ImageFrame.area.getText());

ImageFrame.property.store(new FileOutputStream("a.properties"),

"a.properties");

} catch (Exception ex) {

}

}

}

怎么讓圖片在網(wǎng)頁里自動播放

那是一個JAVA的圖片切換代碼,您可以在那些網(wǎng)頁的原代碼里面找到。

一般循環(huán)的圖片不超過五張。當然超過是可以的只是要一行一行去寫,比較麻煩。代碼就不帖了,如果沒有從網(wǎng)站里面拷貝出來,也可以加我的QQ來找我。

當前題目:java圖片自動播放代碼 java上傳圖片代碼
文章分享:http://vcdvsql.cn/article40/hejdeo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供虛擬主機、網(wǎng)站收錄、網(wǎng)站制作靜態(tài)網(wǎng)站網(wǎng)站策劃、企業(yè)網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設公司