亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? player.java

?? Eclipse高級編程3源碼(書本源碼)
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
		// Create layout data for toolbar
		GridData data = new GridData();
		data.horizontalIndent = 5;
		data.verticalAlignment = GridData.END;
		data.grabExcessHorizontalSpace = true;
		data.grabExcessVerticalSpace = true;
		toolbar.setLayoutData(data);
	}

	/**
	 * Convenience method for creating a toolbar button.
	 * 
	 * @param bar
	 *            the ToolBar instance
	 * @param style
	 *            the button type
	 * @param text
	 *            text for button label
	 * @param tip
	 *            tool tip
	 * @return ToolItem - the created toolbar button
	 */
	private ToolItem makeToolItem(ToolBar bar, int style, String text,
			String tip) {
		ToolItem item = new ToolItem(bar, style);
		if (style != SWT.SEPARATOR) {
			item.setText(text);
			item.setToolTipText(tip);
			// Add event processing for button clicks
			item.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					processButton(e);
				}
			});
		}
		return item;
	}

	/**
	 * This method processes all ToolItem events.
	 * 
	 * @param e
	 *            the event object
	 */
	private void processButton(SelectionEvent e) {
		Widget widget = e.widget;
		if (widget == playButton) {
			play();
		} else if (widget == stopButton) {
			stop();
		} else if (widget == pauseButton) {
			pause();
		} else if (widget == forwardButton) {
			forward();
		} else if (widget == backButton) {
			back();
			// The following buttons are of type CHECK.
			// We must retrieve their state to react correctly.
		} else if (widget == descriptionButton) {
			if (descriptionButton.getSelection())
				showDescription();
			else
				hideDescription();
		} else if (widget == playlistButton) {
			if (playlistButton.getSelection())
				showPlaylist();
			else
				hidePlaylist();
		}
	}

	/**
	 * Create status panel with total duration and operating mode.
	 * 
	 * @param parent
	 *            the containing Composite
	 */
	private void createStatusPanel(Composite parent) {
		// Create panel as a new Composite
		statusPanel = new Composite(parent, SWT.NONE);
		statusPanel.setBackground(parent.getBackground());
		// Use a vertical row layout for the panel
		RowLayout rowLayout = new RowLayout();
		rowLayout.type = SWT.VERTICAL;
		rowLayout.wrap = false;
		rowLayout.pack = false;
		statusPanel.setLayout(rowLayout);
		// Now create the widgets of the status panel
		lengthLabel = createStatusLabel(statusPanel, timeFormat(0));
		statusLabel = createStatusLabel(statusPanel, IDLE);
	}

	private Label createStatusLabel(Composite panel, String text) {
		Label label = new Label(panel, SWT.RIGHT);
		label.setBackground(panel.getBackground());
		label.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
		label.setText(text);
		return label;
	}

	/**
	 * Converts the duration into an appropriate display format.
	 * 
	 * @param sec
	 *            Seconds
	 * @return String mm:ss.s
	 */
	private static String timeFormat(double sec) {
		int sec10 = (int) (sec * 10);
		return twoDigitFormat(sec10 / 600) + ":"
				+ twoDigitFormat((sec10 / 10) % 60) + "." + (sec10 % 10);
	}

	/**
	 * Format an integer into a two-digit string with leading zeros.
	 * 
	 * @param n
	 *            the integer value
	 * @return String - the result string
	 */
	private static String twoDigitFormat(int n) {
		if (n < 10)
			return "0" + n;
		return String.valueOf(n);
	}

	/** * Update SWT-Thread ** */
	/**
	 * Updates SWT-Widgets, caused by events from other threads, are executed
	 * via this method. By performing the updates under the SWT-thread
	 * (display.asyncExec()) we avoid an SWT thread error.
	 */
	private void updateGUI() {
		display.asyncExec(new Runnable() {
			public void run() {
				if (!toplevelShell.isDisposed()) {
					// Update scale
					scale.setMaximum(maxPosition);
					scale.setSelection(currentPosition);
					// Update operation mode
					updateText(statusLabel, mediaState);
					// Update total length
					updateText(lengthLabel, timeFormat(lengthInSec));
					// Check if we have to start the next sound file
					if (state == EOM) {
						state = STOP;
						forward();
					}
				}
			}
		});
	}

	/**
	 * Updates the text of a label
	 * 
	 * @param c
	 *            the Label instance
	 * @param s
	 *            the new text
	 */
	private void updateText(Label c, String s) {
		// test against current content to avoid screen flicker
		if (!c.getText().equals(s))
			c.setText(s);
	}

	/** ** Button actions *** */
	/**
	 * Positions in the sound file when the scale is modified by the end user
	 * (only for .WAV files).
	 */
	private void seek() {
		try {
			double position = ((double) scale.getSelection())
					/ ((double) scale.getMaximum());
			soundPlayer.setSeek(position);
			updateGUI();
		} catch (IOException e) {
			System.out.println(e.toString());
		}
	}

	/**
	 * Stops playing.
	 */
	private void stop() {
		if (state != STOP) {
			soundPlayer.stopPlayback();
			state = STOP;
			mediaState = IDLE;
			lengthInSec = 0;
		}
		updateGUI();
	}

	/**
	 * Pauses the playing process.
	 */
	private void pause() {
		switch (state) {
		case PLAY:
			soundPlayer.pausePlayback();
			state = PAUSE;
			mediaState = PAUSED;
			break;
		case PAUSE:
			soundPlayer.resumePlayback();
			state = PLAY;
			mediaState = PLAYING;
		}
		updateGUI();
	}

	/**
	 * Starts playing.
	 */
	private void play() {
		if (state == PLAY)
			// Current play processes are stopped
			stop();
		try {
			switch (state) {
			case PAUSE:
				// If the playing process was paused, we resume it.
				soundPlayer.resumePlayback();
				break;
			case STOP:
				// Otherwise we start all over again.
				// Fetch name of background image and title
				currentImage = playlistModel.getFeature(IMAGEFILE);
				currentTitle = playlistModel.getFeature(TITLE);
				// Update description window
				updateDescription();
				// Fetch name of sound file
				String filename = playlistModel.getFeature(SOUNDFILE);
				// Enforce a redraw of the canvas
				canvas.redraw();
				// Do nothing if the sound file does not
				// exist any more.
				if (!doesFileExist(filename))
					return;
				// Otherwise configure the engine
				soundPlayer.setDataSource(openFile(filename));
				soundPlayer.startPlayback();
				soundPlayer.setGain(0.5f);
				soundPlayer.setPan(0.5f);
				// Fetch the total duration of the sound file
				lengthInSec = soundPlayer.getTotalLengthInSeconds();
				maxPosition = (int) lengthInSec;
				// If the sound format is not WAV we deactivate
				// disable the scale (no scrolling possible).
				boolean canSeek = ((soundPlayer.getAudioFileFormat() != null) && (soundPlayer
						.getAudioFileFormat().getType().toString()
						.startsWith("WAV")));
				scale.setEnabled(canSeek);
			}
			// Now set the operation modus and update the GUI.
			state = PLAY;
			mediaState = PLAYING;
			updateGUI();
		} catch (UnsupportedAudioFileException e) {
			System.out.println(e.toString());
		} catch (LineUnavailableException e) {
			System.out.println(e.toString());
		} catch (IOException e) {
			System.out.println(e.toString());
		}
	}

	/**
	 * If the playlist has a next element, we stop playing the current sound
	 * file and start again with the next.
	 */
	private void forward() {
		if (playlistModel.next()) {
			stop();
			play();
		}
	}

	/**
	 * If the playlist has a previous element, we stop playing the current sound
	 * file and start again with the previous.
	 */
	private void back() {
		if (playlistModel.previous()) {
			stop();
			play();
		}
	}

	/** ** Manage windows ** */
	/**
	 * Creates a new DescriptionViewer if it not yet exists. Supplies the
	 * DescriptionViewer with new text content.
	 */
	private void showDescription() {
		if (descriptionWindow == null) {
			// Create window
			descriptionWindow = new DescriptionWindow(toplevelShell,
					playlistModel);
			// Initialize window
			descriptionWindow.create();
			// Fetch Shell instance
			Shell shell = descriptionWindow.getShell();
			Rectangle bounds = toplevelShell.getBounds();
			// Position at the right hand side of the main window
			shell.setBounds(bounds.x + bounds.width - 5, bounds.y + 10, 320,
					240);
			// React to shell抯 close button
			shell.addShellListener(new ShellAdapter() {
				public void shellClosed(ShellEvent e) {
					// Update toolbar button
					hideDescription();
				}
			});
			// Open the window
			descriptionWindow.open();
		}
	}

	/**
	 * Closes the description window
	 */
	private void hideDescription() {
		// Reset the description toolbar button
		descriptionButton.setSelection(false);
		// Close window
		if (descriptionWindow != null) {
			descriptionWindow.close();
			descriptionWindow = null;
		}
	}

	/**
	 * Updates the window with new text
	 */
	private void updateDescription() {
		if (descriptionWindow != null)
			descriptionWindow.update();
	}

	/**
	 * Creates a new playlist window
	 */
	private void showPlaylist() {
		if (playlistWindow == null) {
			// Create new PlaylistWindow instance
			playlistWindow = new PlaylistWindow(toplevelShell, playlistModel);
			// Initialize the window to allow us to retrieve
			// the shell instance
			playlistWindow.create();
			Shell shell = playlistWindow.getShell();
			shell.addShellListener(new ShellAdapter() {
				public void shellClosed(ShellEvent e) {
					hidePlaylist();
				}
			});
			// Position the shell below the main window
			Rectangle bounds = toplevelShell.getBounds();
			shell.setBounds(bounds.x + bounds.width / 8, bounds.y
					+ bounds.height - 5, 400, 240);
			// Open the window.
			playlistWindow.open();
		}
	}

	/**
	 * Closes playlist window
	 */
	private void hidePlaylist() {
		// Reset playlist toolbar button.
		playlistButton.setSelection(false);
		// Close window
		if (playlistWindow != null) {
			playlistWindow.close();
			playlistWindow = null;
		}
	}

	/**
	 * @see javazoom.jlGui.BasicPlayerListener#updateMediaData(byte)
	 */
	public void updateMediaData(byte[] data) {
	}

	/**
	 * @see javazoom.jlGui.BasicPlayerListener#
	 *      updateMediaState(java.lang.String)
	 */
	public void updateMediaState(String newState) {
		// At file end set operation mode to IDLE
		if (newState.equals("EOM") && state != STOP) {
			this.state = EOM;
			mediaState = IDLE;
			// Update GUI
			updateGUI();
		}
	}

	/**
	 * @see javazoom.jlGui.BasicPlayerListener#updateCursor(int, int)
	 */
	public void updateCursor(int cursor, int total) {
		// Save maximum position and current position; update GUI
		maxPosition = total;
		currentPosition = cursor;
		updateGUI();
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩va亚洲va欧美va久久| 日本道精品一区二区三区| 色综合一个色综合| 日韩免费视频一区| 一区二区不卡在线视频 午夜欧美不卡在| 日日摸夜夜添夜夜添精品视频 | 国产视频一区二区在线| 一区二区在线免费| 成人高清av在线| 精品动漫一区二区三区在线观看| 亚洲综合图片区| 99re这里只有精品视频首页| 久久精品一区二区| 极品尤物av久久免费看| 欧美色国产精品| 亚洲综合区在线| 91亚洲精品一区二区乱码| 国产欧美一区二区精品仙草咪| 久久国产福利国产秒拍| 欧美一区二区观看视频| 亚洲国产精品久久人人爱蜜臀| av成人动漫在线观看| 国产精品久线在线观看| 成人高清视频免费观看| 亚洲国产精品t66y| 国产不卡一区视频| 国产人久久人人人人爽| 国产成人aaa| 国产精品网站在线播放| 国产剧情av麻豆香蕉精品| 久久综合中文字幕| 国产一区二区三区久久久| 久久综合久久综合亚洲| 国产成人综合在线观看| 中文字幕国产一区| 99久久久久久| 国产欧美一区二区在线| 91在线视频免费91| 亚洲精品免费视频| 欧美久久久影院| 日本视频免费一区| 精品美女一区二区三区| 国产高清无密码一区二区三区| 国产欧美日韩在线视频| 91视频你懂的| 亚洲国产美女搞黄色| 欧美高清精品3d| 国产乱理伦片在线观看夜一区 | 91精品在线麻豆| 另类小说视频一区二区| 国产日韩欧美不卡在线| 不卡视频在线看| 午夜精品成人在线| 亚洲精品在线免费观看视频| 丁香六月综合激情| 一区二区三区视频在线看| 欧美一区中文字幕| 国产99久久久久| 亚洲午夜免费电影| 精品国产乱码久久久久久1区2区| 成人午夜精品在线| 日本亚洲天堂网| 欧美国产丝袜视频| 51午夜精品国产| av一本久道久久综合久久鬼色| 三级不卡在线观看| 国产精品久久国产精麻豆99网站 | 日韩精品一区二区三区三区免费 | 欧美日本一道本| 韩国av一区二区三区| 一区2区3区在线看| 精品国偷自产国产一区| 99免费精品视频| 麻豆久久一区二区| 亚洲欧美区自拍先锋| 精品国产亚洲在线| 欧美亚洲国产怡红院影院| 国产一区二区三区最好精华液| 亚洲三级免费电影| 精品国产乱码久久久久久蜜臀| 99久久夜色精品国产网站| 久久国产精品72免费观看| 曰韩精品一区二区| 国产欧美中文在线| 欧美成人a视频| 欧美无砖砖区免费| 91亚洲精品久久久蜜桃网站| 国模少妇一区二区三区| 日韩国产在线一| 亚洲免费观看高清完整版在线观看熊 | 国产精品色噜噜| xnxx国产精品| 91超碰这里只有精品国产| 91视视频在线观看入口直接观看www | 欧美午夜电影网| 91色婷婷久久久久合中文| 国产原创一区二区三区| 日韩成人av影视| 亚洲成人av资源| 亚洲综合丝袜美腿| 亚洲欧美成人一区二区三区| 久久精品人人做| 精品国产青草久久久久福利| 91精品国产入口| 欧美美女一区二区三区| 色久综合一二码| 色综合视频一区二区三区高清| 大美女一区二区三区| 国内精品在线播放| 国产在线看一区| 国产综合色视频| 激情综合网最新| 蜜臀av在线播放一区二区三区| 亚洲午夜一区二区三区| 夜夜精品视频一区二区 | ww久久中文字幕| 久久久久久久久99精品| 欧美大片在线观看| 久久日韩粉嫩一区二区三区| 久久众筹精品私拍模特| 精品国产伦一区二区三区观看体验 | 国产一区在线视频| 国产精品一区不卡| 成人激情视频网站| 91老师国产黑色丝袜在线| 日本道精品一区二区三区| 91激情五月电影| 欧美精品 日韩| 欧美成人伊人久久综合网| 国产视频一区二区在线观看| 国产精品欧美精品| 亚洲午夜精品在线| 老司机免费视频一区二区 | 中文字幕一区三区| 综合久久久久久| 五月天一区二区| 精品一区二区三区的国产在线播放| 国产麻豆成人传媒免费观看| 成人一区二区三区在线观看| 色婷婷综合久久久久中文一区二区 | 色综合天天视频在线观看| 欧美日韩精品电影| 精品国精品国产尤物美女| 国产精品丝袜91| 日韩中文字幕区一区有砖一区| 蜜桃一区二区三区在线| 国产成人精品午夜视频免费| 色乱码一区二区三区88| 日韩免费视频线观看| 亚洲图片另类小说| 免费国产亚洲视频| 99国产精品久久久久| 91精品免费在线观看| 亚洲欧美自拍偷拍色图| 午夜精品一区在线观看| 国产高清不卡二三区| 欧美高清视频在线高清观看mv色露露十八 | 亚洲国产精品国自产拍av| 亚洲成人av资源| 99久久精品免费看| 久久亚洲精精品中文字幕早川悠里 | 欧美96一区二区免费视频| 成人av免费在线观看| 69久久夜色精品国产69蝌蚪网| 中文字幕欧美国产| 日本va欧美va精品发布| 91猫先生在线| 久久久国产午夜精品 | 亚洲欧美自拍偷拍| 久久av老司机精品网站导航| 99久久精品免费看| 日本一区二区三区在线不卡| 玖玖九九国产精品| 欧美妇女性影城| 亚洲六月丁香色婷婷综合久久 | 日本视频一区二区| 在线欧美小视频| 亚洲丝袜精品丝袜在线| 国产成人免费9x9x人网站视频| 91精品国产黑色紧身裤美女| 亚洲精品欧美二区三区中文字幕| 国产一区二区在线观看视频| 欧美一区二区精品久久911| 一区二区三区.www| 色哟哟日韩精品| 亚洲欧美日韩国产一区二区三区 | 亚洲欧美电影一区二区| 成人免费av资源| 亚洲国产精品t66y| 国产999精品久久久久久| 精品欧美久久久| 麻豆一区二区三区| 91精品福利在线一区二区三区 | 亚洲另类色综合网站| 91亚洲男人天堂| 亚洲精选免费视频| 91浏览器在线视频| 亚洲免费av高清| 欧美自拍偷拍午夜视频| 亚洲一区二区三区小说|