javaswt源码(javaswt教程)
本文目录一览:
- 1、跪求用Java 的SWT 做出这个界面 要详细代码,,,跪求大神,, 背景可以不要,,最重要的是两个表格!!
- 2、java swt怎么实现播放音乐
- 3、求用JAVA的SWT做出来的24小时的时钟代码
- 4、如何在eclipse中查看SWT源码
- 5、求java源代码。使用swing或AWT。实现功能:点击按钮,选择一个txt文本文件,并将txt中
- 6、JAVA用SWT写时钟代码
跪求用Java 的SWT 做出这个界面 要详细代码,,,跪求大神,, 背景可以不要,,最重要的是两个表格!!
很简单的界面,自己做吧,eclilpse 从入门到精通,看这本书,1周就能搞定
java swt怎么实现播放音乐
java swt实现播放音乐代码如下:
public void play(String Filename)
{
try{
// 用输入流打开一音频文件
InputStream in = new FileInputStream(Filename);//FIlename 是你加载的声音文件如(“game.wav”)
// 从输入流中创建一个AudioStream对象
AudioStream as = new AudioStream(in);
AudioPlayer.player.start(as);//用静态成员player.start播放音乐
//AudioPlayer.player.stop(as);//关闭音乐播放
//如果要实现循环播放,则用下面的三句取代上面的“AudioPlayer.player.start(as);”这句
/*AudioData data = as.getData();
ContinuousAudioDataStream gg= new ContinuousAudioDataStream (data);
AudioPlayer.player.start(gg);// Play audio.
*/
//如果要用一个 URL 做为声音流的源(source),则用下面的代码所示替换输入流来创建声音流:
/*AudioStream as = new AudioStream (url.openStream());
*/
} catch(FileNotFoundException e){
System.out.print("FileNotFoundException ");
} catch(IOException e){
System.out.print("有错误!");
}
}
求用JAVA的SWT做出来的24小时的时钟代码
wa-eclipsemvc_ExampleViewer
File: wa-eclipsemvc_ExampleViewer
[
]
Dev tools: Java
File size: 32 KB
Update: 2008-07-16
Downloads: 6
Describe: Using java SWT realize MVC features, easy to use examples
Downloaders recently:
[]
Search in more than 1070000 codes/documents:
[] - swt development of information simple information management software to achieve an information query, sort, by adding, changing functions.
[] - swt calendar control, can be used three times can also be embedded in software, the interface development for SWT.
[] - Statements of pure swt libraries: SWT Report This is my library of previously developed, at present only a statement of printing, there are demo categ
[] - C8051F320 SOURCE CODE contents:* USB Bulk Driver Example* USB Bulk Firmware Example* Host Application (F32x_BulkFileTransfer.exe)* Host Application So
[] - swing Component Development
[] - windows imitate the mine prepared by the game swt needs log4j 1.2.4
File list(time 2005102222~2009121700)(Click to check if it's the file you need, and recomment it at the bottom):
ExampleViewer .............\ .............\ .............\bin .............\...\ExampleViewer .............\...\.............\common .............\...\.............\......\ComboFactory.class .............\...\.............\......\ExampleEditLayout.class .............\...\.............\......\LabelFactory.class .............\...\.............\......\Messages.class .............\...\.............\......\ .............\...\.............\......\TextFactory.class .............\...\.............\data .............\...\.............\....\ExampleViewContentProvider.class .............\...\.............\....\IExampleContentProvider.class .........
如何在eclipse中查看SWT源码
使用Eclipse开发Java程序,有时候需要查看一下某个类的源码,这时我们可以这样做,
鼠标放到你要查询的类名上,按住Ctrl键+鼠标左键就可以了!
如果发现出现错误---查不到源码,那么此时还需要设置一下,把JDK安装目录下的src.zip配置一下,此文件就是Java类库的源码。
以JDK1.8为例,查看一下src.zip文件
如果发现找不到源代码,则进行设置
点击Attach Source按钮,弹出视图,把JDK下的src.zip文件传入点击OK即可
此时按住Ctrl+鼠标左键指向Java类库当中的类,就可以查看类的源代码
求java源代码。使用swing或AWT。实现功能:点击按钮,选择一个txt文本文件,并将txt中
搞定了
package com.monubia;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* 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 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 Txt extends javax.swing.JFrame {
private JButton jButton_open;
private JTextArea jTextArea1;
/**
* Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Txt inst = new Txt();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
public Txt() {
super();
initGUI();
}
private void initGUI() {
try {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
{
jButton_open = new JButton();
getContentPane().add(jButton_open);
jButton_open.setText("Open");
jButton_open.setBounds(155, 114, 92, 49);
jButton_open.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
jButton_openMouseClicked(evt);
}
});
}
{
jTextArea1 = new JTextArea();
getContentPane().add(jTextArea1);
jTextArea1.setBounds(0, 0, 384, 262);
}
pack();
setSize(400, 300);
} catch (Exception e) {
//add your error handling code here
e.printStackTrace();
}
}
private void jButton_openMouseClicked(MouseEvent evt) {
//点击了打开
JFileChooser open=new JFileChooser();
FileNameExtensionFilter txt= new FileNameExtensionFilter("Txt File", "txt");
open.setFileFilter(txt);
int ret=open.showOpenDialog(this);
if(ret==JFileChooser.APPROVE_OPTION)
{
jButton_open.setOpaque(false);
jButton_open.setVisible(false);
System.out.println(open.getSelectedFile().getAbsolutePath());
try {
BufferedReader br=new BufferedReader(new FileReader(open.getSelectedFile().getAbsolutePath()));
String line=null;
while((line=br.readLine())!=null)
{
jTextArea1.append(line+"\n");
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
JAVA用SWT写时钟代码
#include time.h
#include stdio.h
#include stdlib.h
#define BUF_SIZE 80
int main()
{
time_t t;
struct tm *tm;
char s[BUF_SIZE];
if(time(t) == ((time_t)-1)) return 1;
tm = localtime(t);
if(!tm) return 1;
strftime(s, sizeof(s), ":%H:%M:%S", tm);
printf("%s\n", s);
system("pause");
return 0;
}