Refine search
public SendDialog(Frame parent, Node dest, String src, RpcDispatcher disp) { super(parent, "Send message to " + dest.lbl + " at " + dest.addr, true); Panel p1=new Panel(), p2=new Panel(); Button send=new Button("Send"), send_all=new Button("Send to all"); Button cancel=new Button("Cancel"); this.disp=disp; this.dest=dest; sender=src; send.setFont(default_font); send_all.setFont(default_font); cancel.setFont(default_font); msg.setFont(default_font); p1.setLayout(new BorderLayout()); p1.add(msg); p2.setLayout(new FlowLayout()); send.addActionListener(this); send_all.addActionListener(this); cancel.addActionListener(this); p2.add(send); p2.add(send_all); p2.add(cancel); add("Center", p1); add("South", p2); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); setVisible(true); }
public MessageDialog(Frame parent, String sender, String msg) { super(parent, "Msg from " + sender); Button ok=new Button("OK"); setLayout(new BorderLayout()); setBackground(Color.white); ok.setFont(default_font); text.setFont(default_font); text.setEditable(false); text.setText(msg); ok.addActionListener(this); add("Center", text); add("South", ok); setSize(300, 150); Point my_loc=parent.getLocation(); my_loc.x+=50; my_loc.y+=150; setLocation(my_loc); Toolkit.getDefaultToolkit().beep(); show(); }
import java.awt.*; import java.awt.event.*; public class Party { public void buildInvite() { Frame f = new Frame(); Label l = new Label("Party at Tim's"); Button b = new Button("You Bet"); Button c = new Button("Shoot Me"); Panel p = new Panel(); p.add(l); p.add(b); p.add(c); f.add(p); f.pack(); f.setVisible(true); } public static void main(String[] args) { new Party().buildInvite(); } }
setLayout(panel_gb); button_panel = new Panel(); save_button = new Button("SAVE"); button_panel.add(save_button); addGridComponent(this, save_button.addActionListener( this );
public void addCompletingButton( String key, String text ) { Button newButton = new Button(text); newButton.addActionListener(this); completingButtons.add(newButton); }
public void init() { setBackground(Color.cyan); // see Graphics chapter. Panel p = new Panel(); p.setBackground(Color.red); p.add(applyB = new Button("Apply")); applyB.setBackground(Color.white); p.add(exitB = new Button("Exit")); exitB.setForeground(Color.red); add(p); // add (connect) "p" to "this", the Applet } }
public void go() { try { panel=new Panel(); sub_panel=new Panel(); resize(200, 200); add("Center", panel); clear_button=new Button("Clear"); clear_button.setFont(default_font); clear_button.addActionListener(this); leave_button=new Button("Exit"); leave_button.setFont(default_font); leave_button.addActionListener(this); mbr_label=new Label("0 mbr(s)"); mbr_label.setFont(default_font);
import java.awt.*; import java.awt.event.*; import java.applet.*; public class ButtonDemo extends Applet implements ActionListener { public void init() { setLayout(null) Button yes= new Button("Yes"); yes.setBounds(0,30,30,60); add(yes); yes.addActionListener(this); } public void actionPerformed (ActionEvent ae) { } }
BordLayPanel() { super("BordLayPanel"); Panel p; setLayout(new BorderLayout()); add(BorderLayout.NORTH, p = new Panel()); p.setLayout(new FlowLayout()); p.add(new Label("FileName:")); p.add(fileName = new TextField(40)); p.add(new Button("Load")); // now you need to add an action listener to the button add(BorderLayout.CENTER, main = new TextArea(24,80)); add(BorderLayout.SOUTH, status = new Label("")); pack(); // Don't forget to add a window listener so the quit control works }
Panel mainPanel = new Panel(layout); startBrowser = new Button("Start Browser"); startBrowser.setFocusable(false); startBrowser.setActionCommand("console"); startBrowser.addActionListener(this); startBrowser.setFont(font); mainPanel.add(startBrowser, constraintsButton);
import java.awt.*; import java.awt.event.*; import java.io.Serializable; class MyApp implements ActionListener, Serializable { BigObjectThatShouldNotBeSerializedWithAButton bigOne; Button aButton = new Button(); MyApp() { // Oops, now aButton has a listener with a reference // to bigOne! aButton.addActionListener(this); } public void actionPerformed(ActionEvent e) { System.out.println("Hello There"); } }
panel.setBackground(Color.white); add("Center", panel); Panel p = new Panel(); leave_button = new Button("Exit"); leave_button.setFont(default_font); leave_button.addActionListener(this); mbr_label = new Label("1 mbr(s)"); mbr_label.setFont(default_font);
private Button addButton(String label) { final Button b = new Button(" "+label+" "); b.addActionListener(this); panel.add(b); return b; }
setLayout(panel_gb); button_panel = new Panel(); save_button = new Button("SAVE"); button_panel.add(save_button); addGridComponent(this, save_button.addActionListener( this );
void addButton(String label) { Button b = new Button(label); b.addActionListener(this); panel.add(b); } void addLabel(String label) {
Panel makeButtonPanel(GenericDialog gd) { Panel panel = new Panel(); //buttons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0)); colorButton = new Button("\"Show All\" Color..."); colorButton.addActionListener(this); panel.add(colorButton); return panel; }
public void init() { add(b1 = new Button("A button")); b1.addActionListener(this); add(b2 = new Button("Another button")); b2.addActionListener(this); }
Panel makeButtonPanel(GenericDialog gd) { Panel panel = new Panel(); //buttons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0)); colorButton = new Button("\"Show All\" Color..."); colorButton.addActionListener(this); panel.add(colorButton); return panel; }
private Button addButton(String label) { final Button b = new Button(" "+label+" "); b.addActionListener(this); panel.add(b); return b; }
/** Creates a panel containing "Save...", "Save..." and "Preview" buttons. */ Panel makeButtonPanel(GenericDialog gd) { Panel buttons = new Panel(); buttons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0)); open = new Button("Open..."); open.addActionListener(this); buttons.add(open); save = new Button("Save..."); save.addActionListener(this); buttons.add(save); return buttons; }