?? interfaceapplet.java
字號:
package com.vimas.interfaceapplet;
import java.awt.*;
//import java.lang.reflect.*;
import java.awt.event.*;
import java.applet.*;
import java.net.*;
//import javax.swing.*;
import com.vimas.interfaceapplet.buttons.*;
//import com.vimas.rpapplet4800.RPApplet;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: Vimas technologies</p>
* @author miha
* @version 1.0
*/
//******************************************************************************
public class InterfaceApplet extends Applet
{
private boolean isStandalone = false;
Dispatcher d=null;
//RPApplet r=null;
BorderLayout borderLayout1 = new BorderLayout();
BorderLayout borderLayout2 = new BorderLayout();
BorderLayout borderLayout3 = new BorderLayout();
CardLayout cl= new CardLayout();
Panel audiocontrol = new Panel();
Panel filePanel = new Panel();
Panel leftPanel = new Panel();
Panel rightPanel = new Panel();
Panel bannerPanel = new Panel();
Panel headerPanel = new Panel();
Panel statusPanel = new Panel();
Panel mainPanel = new Panel();
Panel cardPanel = new Panel();
StopButton stop = new StopButton(20);
PauseButton pause = new PauseButton(20);
RecordButton record = new RecordButton(20);
PlayButton play = new PlayButton(20);
TextButton save = new TextButton("Upload",20);
TextButton open = new TextButton("Listen",20);
Component filename;// = new Choice();
TextField curtime = new TextField();
TextField postime = new TextField();
Label label1 = new Label();
TextField status = new TextField();
//Banner banner = new Banner("Vimas Web Recorder and Player");
Banner banner = new Banner(Messages.bannerString);
// Banner banner = new Banner("VIMAS voice recording/playing applet");
Label loadingLable = new Label();
FlowLayout flowLayout1 = new FlowLayout();
FlowLayout flowLayout2 = new FlowLayout();
Banner shara = new Banner("shara16.png",22,22);
//Get a parameter value
public String getParameter(String key, String def)
{
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//******************************************************************************
//Construct the applet
public InterfaceApplet()
{
System.out.println("Adding KEY LISTENER ");
}
//******************************************************************************
public String getAppletInfo()
{
return "Vimas InterfaceApplet for RPapplet";
}
//******************************************************************************
//Initialize the applet
public void init()
{
try
{
jbInit();
d=new Dispatcher(this);
d.setUserServerFolder(this.getParameter("UserServerFolder",""));
}
catch (Exception e)
{
e.printStackTrace();
}
}
//******************************************************************************
//Component initialization
private void jbInit() throws Exception
{
this.addKeyListener(new Keys());
mainPanel.setLayout(borderLayout1);
stop.addActionListener(new InterfaceApplet_stop_actionAdapter(this));
pause.addActionListener(new InterfaceApplet_pause_actionAdapter(this));
pause.setSunkable(true);
record.addActionListener(new InterfaceApplet_record_actionAdapter(this));
play.addActionListener(new InterfaceApplet_play_actionAdapter(this));
save.addActionListener(new InterfaceApplet_save_actionAdapter(this));
open.addActionListener(new InterfaceApplet_open_actionAdapter(this));
if(Messages.DiskVersion) save.setLabel("save");
if(Messages.DiskVersion)open.setLabel("open");
curtime.setColumns(6);
curtime.setEditable(false);
curtime.setEnabled(true);
curtime.setFont(new java.awt.Font("Dialog", 0, 24));
curtime.setForeground(Color.black);
//curtime.setText("00:00:00");
curtime.setText("");
// curtime.addKeyListener(new Keys());
postime.setColumns(8);
postime.setEditable(false);
postime.setEnabled(true);
postime.setFont(new java.awt.Font("Dialog", 0, 12));
postime.setForeground(Color.black);
postime.setText("");
// postime.addKeyListener(new Keys());
label1.setBackground(SystemColor.control);
label1.setFont(new java.awt.Font("Dialog", 0, 12));
if(Messages.DiskVersion)
{
label1.setText("Active file");
filename=new TextField();
((TextField)filename).setColumns(12);
((TextField)filename).setEditable(false);
((TextField)filename).setText("");
}
else
{
label1.setText("Uploaded files");
filename=new Choice();
((Choice)filename).add(" ");
((Choice)filename).setFont(new java.awt.Font("Dialog", 0, 12));
}
//filename.add(" ");
//filename.setFont(new java.awt.Font("Dialog", 0, 12));
//filename.setSize(40,20);
/*filename.setColumns(11);
filename.setEditable(false);
filename.setText("");*/
status.setColumns(10);
status.setEditable(false);
status.setEnabled(true);
status.setText("");
// status.addKeyListener(new Keys());
//banner.setAlignment(Label.LEFT);
//banner.setForeground(Color.blue);
//banner.setText(" Vimas Web Recorder and Player");
banner.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
etn_clicked();
}
});
flowLayout1.setAlignment(FlowLayout.LEFT);
mainPanel.setBackground(SystemColor.control);
audiocontrol.setLayout(flowLayout2);
flowLayout2.setAlignment(FlowLayout.LEFT);
loadingLable.setAlignment(Label.CENTER);
loadingLable.setFont(new java.awt.Font("Dialog", 3, 20));
loadingLable.setText("Loading Java applet");
leftPanel.setLayout(new BorderLayout(0,0));
leftPanel.add(curtime,BorderLayout.CENTER);
leftPanel.add(postime,BorderLayout.SOUTH);
rightPanel.setLayout(new BorderLayout());
rightPanel.add(filePanel,BorderLayout.NORTH);
rightPanel.add(audiocontrol,BorderLayout.CENTER);
headerPanel.setLayout(new BorderLayout(0,0));
headerPanel.add(leftPanel, BorderLayout.WEST);
headerPanel.add(rightPanel, BorderLayout.EAST);
//file panel construction
// flowLayout1.setHgap(0);
filePanel.setLayout(flowLayout1);
filePanel.add(label1, null);
if(Messages.DiskVersion)filePanel.add(new AllingmentComponent(0,20), null);
filePanel.add(filename, null);
//banner panel
bannerPanel.setLayout(new BorderLayout());
bannerPanel.add(banner,BorderLayout.CENTER);
shara.loadImage(this);
shara.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
bannerPressed();
}
});
bannerPanel.add(shara,BorderLayout.EAST);
//audio control panel construction
//audiocontrol.add(new AllingmentComponent(5,20), null);
//audiocontrol.setLayout(new FlowLayout(FlowLayout.LEFT,8,0));
audiocontrol.add(record, null);
audiocontrol.add(play, null);
audiocontrol.add(pause, null);
audiocontrol.add(stop, null);
audiocontrol.add(open, null);
audiocontrol.add(save, null);
//audiocontrol.add(shara,null);
//status panel construction
statusPanel.setLayout(borderLayout2);
statusPanel.add(new Panel(new FlowLayout()).add(status), BorderLayout.CENTER);
statusPanel.add(bannerPanel, BorderLayout.SOUTH);
//statusPanel.add(new AllingmentComponent(4,20), BorderLayout.WEST);
statusPanel.add(new AllingmentComponent(1,20), BorderLayout.EAST);
//
//adding all stuff to mainPanel
mainPanel.add(headerPanel, BorderLayout.CENTER);
//mainPanel.add(filePanel, BorderLayout.NORTH);
mainPanel.add(statusPanel, BorderLayout.SOUTH);
//creating card panel
cardPanel.setLayout(cl);
cardPanel.add("load",loadingLable);
cardPanel.add("main",mainPanel);
//adding all to applet
this.setLayout(borderLayout3);
this.add(cardPanel,BorderLayout.CENTER);
//3D Simulating
Color d = this.getBackground().darker();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -