📄 circulateframe.java
字号:
package examples.itinerary;
import com.ibm.aglet.Message;
import com.ibm.aglet.util.AddressChooser;
import com.ibm.agletx.util.SeqItinerary;
import com.ibm.agletx.util.SeqPlanItinerary;
import java.awt.*;
import java.awt.event.*;
// Referenced classes of package examples.itinerary:
// CirculateAglet
class CirculateFrame extends Frame
implements WindowListener, ActionListener, ItemListener
{
CirculateAglet aglet;
List list;
AddressChooser address;
Choice choice;
Checkbox check;
CirculateFrame(CirculateAglet circulateaglet)
{
list = new List(10, false);
address = new AddressChooser(15);
choice = new Choice();
check = new Checkbox("Repeat");
aglet = circulateaglet;
setLayout(new BorderLayout());
add("Center", list);
addWindowListener(this);
check.addItemListener(this);
Panel panel = new Panel();
panel.setLayout(new FlowLayout());
panel.add(address);
panel.add(choice);
Button button = new Button("Add");
Button button1 = new Button("Remove");
button.addActionListener(this);
button1.addActionListener(this);
panel.add(button);
panel.add(button1);
add("North", panel);
panel = new Panel();
panel.setLayout(new FlowLayout());
panel.add(check);
Button button2 = new Button("Once More");
Button button3 = new Button("Start!");
button2.addActionListener(this);
button3.addActionListener(this);
panel.add(button2);
panel.add(button3);
add("South", panel);
choice.addItem("getLocalInfo");
choice.addItem("getProxies");
choice.addItem("printResult");
update();
}
public void actionPerformed(ActionEvent actionevent)
{
if("Once More".equals(actionevent.getActionCommand()))
aglet.oncemore();
else
if("Start!".equals(actionevent.getActionCommand()))
aglet.start();
else
if("Remove".equals(actionevent.getActionCommand()))
{
int i = list.getSelectedIndex();
if(i >= 0)
{
aglet.itinerary.removePlanAt(i);
list.remove(i);
}
} else
if("Add".equals(actionevent.getActionCommand()))
{
aglet.itinerary.addPlan(address.getAddress(), choice.getSelectedItem());
update();
}
}
public void itemStateChanged(ItemEvent itemevent)
{
aglet.itinerary.setRepeat(check.getState());
}
private void update()
{
list.removeAll();
SeqPlanItinerary seqplanitinerary = aglet.itinerary;
int i = seqplanitinerary.size();
for(int j = 0; j < i; j++)
{
String s = seqplanitinerary.getAddressAt(j) + " : " + seqplanitinerary.getMessageAt(j).getKind();
list.add(s);
}
check.setState(aglet.itinerary.isRepeat());
}
public void windowActivated(WindowEvent windowevent)
{
}
public void windowClosed(WindowEvent windowevent)
{
}
public void windowClosing(WindowEvent windowevent)
{
dispose();
}
public void windowDeactivated(WindowEvent windowevent)
{
}
public void windowDeiconified(WindowEvent windowevent)
{
}
public void windowIconified(WindowEvent windowevent)
{
}
public void windowOpened(WindowEvent windowevent)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -